hash
stringlengths 40
40
| date
stringdate 2019-01-22 05:28:56
2025-03-19 19:23:00
| author
stringclasses 199
values | commit_message
stringlengths 18
96
| is_merge
bool 1
class | masked_commit_message
stringlengths 12
90
| type
stringclasses 74
values | git_diff
stringlengths 222
1.21M
|
|---|---|---|---|---|---|---|---|
10724a7cb346e57b0b97e4bd54c13c5c604dbf9c
|
2024-11-12 22:08:21
|
Andreas Kling
|
libjs: Use ConservativeVector when instantiating static class fields
| false
|
Use ConservativeVector when instantiating static class fields
|
libjs
|
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp
index 919b90e2245f..9ed24d38bc41 100644
--- a/Libraries/LibJS/AST.cpp
+++ b/Libraries/LibJS/AST.cpp
@@ -243,7 +243,7 @@ ThrowCompletionOr<ClassElement::ClassValue> ClassField::class_element_evaluation
FunctionParsingInsights parsing_insights;
parsing_insights.uses_this_from_environment = true;
parsing_insights.uses_this = true;
- initializer = make_handle(*ECMAScriptFunctionObject::create(realm, "field", ByteString::empty(), *function_code, {}, 0, {}, vm.lexical_environment(), vm.running_execution_context().private_environment, FunctionKind::Normal, true, parsing_insights, false, property_key_or_private_name));
+ initializer = ECMAScriptFunctionObject::create(realm, "field", ByteString::empty(), *function_code, {}, 0, {}, vm.lexical_environment(), vm.running_execution_context().private_environment, FunctionKind::Normal, true, parsing_insights, false, property_key_or_private_name);
initializer->make_method(target);
}
@@ -366,12 +366,12 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::create_class_const
prototype->define_direct_property(vm.names.constructor, class_constructor, Attribute::Writable | Attribute::Configurable);
- using StaticElement = Variant<ClassFieldDefinition, Handle<ECMAScriptFunctionObject>>;
+ using StaticElement = Variant<ClassFieldDefinition, JS::NonnullGCPtr<ECMAScriptFunctionObject>>;
ConservativeVector<PrivateElement> static_private_methods(vm.heap());
ConservativeVector<PrivateElement> instance_private_methods(vm.heap());
ConservativeVector<ClassFieldDefinition> instance_fields(vm.heap());
- Vector<StaticElement> static_elements;
+ ConservativeVector<StaticElement> static_elements(vm.heap());
for (size_t element_index = 0; element_index < m_elements.size(); element_index++) {
auto const& element = m_elements[element_index];
@@ -411,7 +411,7 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::create_class_const
VERIFY(element_value.has<Completion>() && element_value.get<Completion>().value().has_value());
auto& element_object = element_value.get<Completion>().value()->as_object();
VERIFY(is<ECMAScriptFunctionObject>(element_object));
- static_elements.append(make_handle(static_cast<ECMAScriptFunctionObject*>(&element_object)));
+ static_elements.append(NonnullGCPtr { static_cast<ECMAScriptFunctionObject&>(element_object) });
}
}
|
e6861cb5ef79d59b515f69484d2fc80c627c9ab6
|
2024-01-13 16:35:36
|
Shannon Booth
|
libweb: Port Element::insert_adjacent from ByteString
| false
|
Port Element::insert_adjacent from ByteString
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index cede5c853190..4767b385c15e 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -1468,7 +1468,7 @@ WebIDL::ExceptionOr<void> Element::insert_adjacent_html(String const& position,
}
// https://dom.spec.whatwg.org/#insert-adjacent
-WebIDL::ExceptionOr<JS::GCPtr<Node>> Element::insert_adjacent(ByteString const& where, JS::NonnullGCPtr<Node> node)
+WebIDL::ExceptionOr<JS::GCPtr<Node>> Element::insert_adjacent(StringView where, JS::NonnullGCPtr<Node> node)
{
// To insert adjacent, given an element element, string where, and a node node, run the steps associated with the first ASCII case-insensitive match for where:
if (Infra::is_ascii_case_insensitive_match(where, "beforebegin"sv)) {
@@ -1512,7 +1512,7 @@ WebIDL::ExceptionOr<JS::GCPtr<Node>> Element::insert_adjacent(ByteString const&
WebIDL::ExceptionOr<JS::GCPtr<Element>> Element::insert_adjacent_element(String const& where, JS::NonnullGCPtr<Element> element)
{
// The insertAdjacentElement(where, element) method steps are to return the result of running insert adjacent, give this, where, and element.
- auto returned_node = TRY(insert_adjacent(where.to_byte_string(), move(element)));
+ auto returned_node = TRY(insert_adjacent(where, element));
if (!returned_node)
return JS::GCPtr<Element> { nullptr };
return JS::GCPtr<Element> { verify_cast<Element>(*returned_node) };
@@ -1526,7 +1526,7 @@ WebIDL::ExceptionOr<void> Element::insert_adjacent_text(String const& where, Str
// 2. Run insert adjacent, given this, where, and text.
// Spec Note: This method returns nothing because it existed before we had a chance to design it.
- (void)TRY(insert_adjacent(where.to_byte_string(), text));
+ (void)TRY(insert_adjacent(where, text));
return {};
}
diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h
index 2f7e4a504da7..d14a94f6be29 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.h
+++ b/Userland/Libraries/LibWeb/DOM/Element.h
@@ -391,7 +391,7 @@ class Element
void invalidate_style_after_attribute_change(FlyString const& attribute_name);
- WebIDL::ExceptionOr<JS::GCPtr<Node>> insert_adjacent(ByteString const& where, JS::NonnullGCPtr<Node> node);
+ WebIDL::ExceptionOr<JS::GCPtr<Node>> insert_adjacent(StringView where, JS::NonnullGCPtr<Node> node);
void enqueue_an_element_on_the_appropriate_element_queue();
|
feab5e8a3ebbe3353432927ea6bf151aa6b7d882
|
2021-08-22 01:39:56
|
Itamar
|
utilities: Add cpp-lexer
| false
|
Add cpp-lexer
|
utilities
|
diff --git a/Userland/Utilities/CMakeLists.txt b/Userland/Utilities/CMakeLists.txt
index 35bc9423f13f..97a98ab2ea66 100644
--- a/Userland/Utilities/CMakeLists.txt
+++ b/Userland/Utilities/CMakeLists.txt
@@ -96,6 +96,7 @@ target_link_libraries(test-pthread LibThreading)
target_link_libraries(tt LibPthread)
target_link_libraries(unzip LibArchive LibCompress)
target_link_libraries(zip LibArchive LibCompress LibCrypto)
+target_link_libraries(cpp-lexer LibCpp)
target_link_libraries(cpp-parser LibCpp LibGUI)
target_link_libraries(cpp-preprocessor LibCpp LibGUI)
target_link_libraries(wasm LibWasm LibLine)
diff --git a/Userland/Utilities/cpp-lexer.cpp b/Userland/Utilities/cpp-lexer.cpp
new file mode 100644
index 000000000000..5264997331ed
--- /dev/null
+++ b/Userland/Utilities/cpp-lexer.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021, the SerenityOS developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibCore/ArgsParser.h>
+#include <LibCore/File.h>
+#include <LibCpp/Lexer.h>
+
+int main(int argc, char** argv)
+{
+ Core::ArgsParser args_parser;
+ const char* path = nullptr;
+ args_parser.add_positional_argument(path, "Cpp File", "cpp-file", Core::ArgsParser::Required::Yes);
+ args_parser.parse(argc, argv);
+
+ auto file = Core::File::construct(path);
+ if (!file->open(Core::OpenMode::ReadOnly)) {
+ perror("open");
+ exit(1);
+ }
+ auto content = file->read_all();
+ StringView content_view(content);
+
+ Cpp::Lexer lexer(content);
+ auto tokens = lexer.lex();
+
+ for (auto& token : tokens) {
+ outln("{}", token.to_string());
+ }
+}
|
9af966f87d74fda68002eafb141735a508cf295c
|
2024-03-25 17:09:23
|
Andreas Kling
|
libweb: Avoid unnecessary Vector copying when generating line boxes
| false
|
Avoid unnecessary Vector copying when generating line boxes
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
index b65067f863bf..a45e3229a95c 100644
--- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
@@ -348,7 +348,7 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
item.margin_end,
item.width,
text_node.computed_values().line_height(),
- item.glyph_run);
+ move(item.glyph_run));
break;
}
}
diff --git a/Userland/Libraries/LibWeb/Layout/LineBox.cpp b/Userland/Libraries/LibWeb/Layout/LineBox.cpp
index 70ed94af2928..e8b458972719 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/LineBox.cpp
@@ -15,7 +15,7 @@
namespace Web::Layout {
-void LineBox::add_fragment(Node const& layout_node, int start, int length, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, CSSPixels border_box_top, CSSPixels border_box_bottom, Span<Gfx::DrawGlyphOrEmoji const> glyph_run)
+void LineBox::add_fragment(Node const& layout_node, int start, int length, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, CSSPixels border_box_top, CSSPixels border_box_bottom, Vector<Gfx::DrawGlyphOrEmoji> glyph_run)
{
bool text_align_is_justify = layout_node.computed_values().text_align() == CSS::TextAlign::Justify;
if (!text_align_is_justify && !m_fragments.is_empty() && &m_fragments.last().layout_node() == &layout_node) {
@@ -24,15 +24,14 @@ void LineBox::add_fragment(Node const& layout_node, int start, int length, CSSPi
// Expand the last fragment instead of adding a new one with the same Layout::Node.
m_fragments.last().m_length = (start - m_fragments.last().m_start) + length;
m_fragments.last().set_width(m_fragments.last().width() + content_width);
- for (auto glyph : glyph_run) {
+ for (auto& glyph : glyph_run) {
glyph.visit([&](auto& glyph) { glyph.position.translate_by(fragment_width.to_float(), 0); });
m_fragments.last().m_glyph_run->append(glyph);
}
} else {
- Vector<Gfx::DrawGlyphOrEmoji> glyph_run_copy { glyph_run };
CSSPixels x_offset = leading_margin + leading_size + m_width;
CSSPixels y_offset = 0;
- m_fragments.append(LineBoxFragment { layout_node, start, length, CSSPixelPoint(x_offset, y_offset), CSSPixelSize(content_width, content_height), border_box_top, move(glyph_run_copy) });
+ m_fragments.append(LineBoxFragment { layout_node, start, length, CSSPixelPoint(x_offset, y_offset), CSSPixelSize(content_width, content_height), border_box_top, move(glyph_run) });
}
m_width += leading_margin + leading_size + content_width + trailing_size + trailing_margin;
m_height = max(m_height, content_height + border_box_top + border_box_bottom);
diff --git a/Userland/Libraries/LibWeb/Layout/LineBox.h b/Userland/Libraries/LibWeb/Layout/LineBox.h
index 6ea03a28c150..172ee5e43b47 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBox.h
+++ b/Userland/Libraries/LibWeb/Layout/LineBox.h
@@ -20,7 +20,7 @@ class LineBox {
CSSPixels bottom() const { return m_bottom; }
CSSPixels baseline() const { return m_baseline; }
- void add_fragment(Node const& layout_node, int start, int length, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, CSSPixels border_box_top, CSSPixels border_box_bottom, Span<Gfx::DrawGlyphOrEmoji const> = {});
+ void add_fragment(Node const& layout_node, int start, int length, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, CSSPixels border_box_top, CSSPixels border_box_bottom, Vector<Gfx::DrawGlyphOrEmoji> = {});
Vector<LineBoxFragment> const& fragments() const { return m_fragments; }
Vector<LineBoxFragment>& fragments() { return m_fragments; }
diff --git a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
index e16dd3cb8ed2..cf7d861516bd 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
@@ -97,9 +97,9 @@ void LineBuilder::append_box(Box const& box, CSSPixels leading_size, CSSPixels t
};
}
-void LineBuilder::append_text_chunk(TextNode const& text_node, size_t offset_in_node, size_t length_in_node, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, Span<Gfx::DrawGlyphOrEmoji> glyph_run)
+void LineBuilder::append_text_chunk(TextNode const& text_node, size_t offset_in_node, size_t length_in_node, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, Vector<Gfx::DrawGlyphOrEmoji> glyph_run)
{
- ensure_last_line_box().add_fragment(text_node, offset_in_node, length_in_node, leading_size, trailing_size, leading_margin, trailing_margin, content_width, content_height, 0, 0, glyph_run);
+ ensure_last_line_box().add_fragment(text_node, offset_in_node, length_in_node, leading_size, trailing_size, leading_margin, trailing_margin, content_width, content_height, 0, 0, move(glyph_run));
m_max_height_on_current_line = max(m_max_height_on_current_line, content_height);
}
diff --git a/Userland/Libraries/LibWeb/Layout/LineBuilder.h b/Userland/Libraries/LibWeb/Layout/LineBuilder.h
index 80bbe6193d60..3515740a5646 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBuilder.h
+++ b/Userland/Libraries/LibWeb/Layout/LineBuilder.h
@@ -25,7 +25,7 @@ class LineBuilder {
void break_line(ForcedBreak, Optional<CSSPixels> next_item_width = {});
void append_box(Box const&, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin);
- void append_text_chunk(TextNode const&, size_t offset_in_node, size_t length_in_node, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, Span<Gfx::DrawGlyphOrEmoji>);
+ void append_text_chunk(TextNode const&, size_t offset_in_node, size_t length_in_node, CSSPixels leading_size, CSSPixels trailing_size, CSSPixels leading_margin, CSSPixels trailing_margin, CSSPixels content_width, CSSPixels content_height, Vector<Gfx::DrawGlyphOrEmoji>);
// Returns whether a line break occurred.
bool break_if_needed(CSSPixels next_item_width)
|
350e5f9261e2183901dd27d1ddc172741f843c12
|
2023-04-05 15:07:27
|
Andreas Kling
|
kernel: Remove ancient InterruptDisabler in sys$setsid
| false
|
Remove ancient InterruptDisabler in sys$setsid
|
kernel
|
diff --git a/Kernel/Syscalls/setpgid.cpp b/Kernel/Syscalls/setpgid.cpp
index 8812f86c9261..11333df583ee 100644
--- a/Kernel/Syscalls/setpgid.cpp
+++ b/Kernel/Syscalls/setpgid.cpp
@@ -4,7 +4,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <Kernel/InterruptDisabler.h>
#include <Kernel/Process.h>
#include <Kernel/TTY/TTY.h>
@@ -29,7 +28,6 @@ ErrorOr<FlatPtr> Process::sys$setsid()
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
TRY(require_promise(Pledge::proc));
- InterruptDisabler disabler;
bool found_process_with_same_pgid_as_my_pid = false;
TRY(Process::for_each_in_pgrp_in_same_jail(pid().value(), [&](auto&) -> ErrorOr<void> {
found_process_with_same_pgid_as_my_pid = true;
|
bbcd8bd97ca5b3bbf93a6c5183b89bd887c67e54
|
2025-02-28 10:19:51
|
Tim Ledbetter
|
libweb: Implement `FileReaderSync` interface
| false
|
Implement `FileReaderSync` interface
|
libweb
|
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt
index d50d0fe08a1a..d740c8b06353 100644
--- a/Libraries/LibWeb/CMakeLists.txt
+++ b/Libraries/LibWeb/CMakeLists.txt
@@ -284,6 +284,7 @@ set(SOURCES
FileAPI/File.cpp
FileAPI/FileList.cpp
FileAPI/FileReader.cpp
+ FileAPI/FileReaderSync.cpp
Geometry/DOMMatrix.cpp
Geometry/DOMMatrixReadOnly.cpp
Geometry/DOMPoint.cpp
diff --git a/Libraries/LibWeb/FileAPI/FileReader.h b/Libraries/LibWeb/FileAPI/FileReader.h
index 39e7b742c807..b5813cca5458 100644
--- a/Libraries/LibWeb/FileAPI/FileReader.h
+++ b/Libraries/LibWeb/FileAPI/FileReader.h
@@ -81,6 +81,14 @@ class FileReader : public DOM::EventTarget {
void set_onloadend(WebIDL::CallbackType*);
WebIDL::CallbackType* onloadend();
+ enum class Type {
+ ArrayBuffer,
+ BinaryString,
+ Text,
+ DataURL,
+ };
+ static WebIDL::ExceptionOr<Result> blob_package_data(JS::Realm& realm, ByteBuffer, FileReader::Type type, Optional<String> const&, Optional<String> const& encoding_name = {});
+
protected:
FileReader(JS::Realm&, ByteBuffer);
@@ -91,17 +99,8 @@ class FileReader : public DOM::EventTarget {
private:
explicit FileReader(JS::Realm&);
- enum class Type {
- ArrayBuffer,
- BinaryString,
- Text,
- DataURL,
- };
-
WebIDL::ExceptionOr<void> read_operation(Blob&, Type, Optional<String> const& encoding_name = {});
- static WebIDL::ExceptionOr<Result> blob_package_data(JS::Realm& realm, ByteBuffer, FileReader::Type type, Optional<String> const&, Optional<String> const& encoding_name);
-
void queue_a_task(GC::Ref<GC::Function<void()>>);
// Internal state to handle aborting the FileReader.
diff --git a/Libraries/LibWeb/FileAPI/FileReaderSync.cpp b/Libraries/LibWeb/FileAPI/FileReaderSync.cpp
new file mode 100644
index 000000000000..dce69c81df65
--- /dev/null
+++ b/Libraries/LibWeb/FileAPI/FileReaderSync.cpp
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2025, Tim Ledbetter <[email protected]>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibJS/Runtime/ArrayBuffer.h>
+#include <LibJS/Runtime/Realm.h>
+#include <LibJS/Runtime/TypedArray.h>
+#include <LibWeb/Bindings/FileReaderSyncPrototype.h>
+#include <LibWeb/Bindings/Intrinsics.h>
+#include <LibWeb/FileAPI/Blob.h>
+#include <LibWeb/FileAPI/FileReaderSync.h>
+#include <LibWeb/HTML/EventLoop/EventLoop.h>
+#include <LibWeb/Streams/AbstractOperations.h>
+#include <LibWeb/Streams/ReadableStreamDefaultReader.h>
+#include <LibWeb/WebIDL/ExceptionOr.h>
+
+namespace Web::FileAPI {
+
+GC_DEFINE_ALLOCATOR(FileReaderSync);
+
+FileReaderSync::~FileReaderSync() = default;
+
+FileReaderSync::FileReaderSync(JS::Realm& realm)
+ : PlatformObject(realm)
+{
+}
+
+void FileReaderSync::initialize(JS::Realm& realm)
+{
+ Base::initialize(realm);
+ WEB_SET_PROTOTYPE_FOR_INTERFACE(FileReaderSync);
+}
+
+GC::Ref<FileReaderSync> FileReaderSync::create(JS::Realm& realm)
+{
+ return realm.create<FileReaderSync>(realm);
+}
+
+GC::Ref<FileReaderSync> FileReaderSync::construct_impl(JS::Realm& realm)
+{
+ return FileReaderSync::create(realm);
+}
+
+// https://w3c.github.io/FileAPI/#dfn-readAsArrayBufferSync
+WebIDL::ExceptionOr<GC::Root<JS::ArrayBuffer>> FileReaderSync::read_as_array_buffer(Blob& blob)
+{
+ return read_as<GC::Root<JS::ArrayBuffer>>(blob, FileReader::Type::ArrayBuffer);
+}
+
+// https://w3c.github.io/FileAPI/#dfn-readAsBinaryStringSync
+WebIDL::ExceptionOr<String> FileReaderSync::read_as_binary_string(Blob& blob)
+{
+ return read_as<String>(blob, FileReader::Type::BinaryString);
+}
+
+// https://w3c.github.io/FileAPI/#dfn-readAsTextSync
+WebIDL::ExceptionOr<String> FileReaderSync::read_as_text(Blob& blob, Optional<String> const& encoding)
+{
+ return read_as<String>(blob, FileReader::Type::Text, encoding);
+}
+
+// https://w3c.github.io/FileAPI/#dfn-readAsDataURLSync
+WebIDL::ExceptionOr<String> FileReaderSync::read_as_data_url(Blob& blob)
+{
+ return read_as<String>(blob, FileReader::Type::DataURL);
+}
+
+template<typename Result>
+WebIDL::ExceptionOr<Result> FileReaderSync::read_as(Blob& blob, FileReader::Type type, Optional<String> const& encoding)
+{
+ // 1. Let stream be the result of calling get stream on blob.
+ auto stream = blob.get_stream();
+
+ // 2. Let reader be the result of getting a reader from stream.
+ auto reader = TRY(stream->get_a_reader());
+
+ // 3. Let promise be the result of reading all bytes from stream with reader.
+ auto promise_capability = reader->read_all_bytes_deprecated();
+
+ // FIXME: Try harder to not reach into promise's [[Promise]] slot
+ auto promise = GC::Ref { as<JS::Promise>(*promise_capability->promise()) };
+
+ // 4. Wait for promise to be fulfilled or rejected.
+ // FIXME: Create spec issue to use WebIDL react to promise steps here instead of this custom logic
+ HTML::main_thread_event_loop().spin_until(GC::create_function(heap(), [promise]() {
+ return promise->state() == JS::Promise::State::Fulfilled || promise->state() == JS::Promise::State::Rejected;
+ }));
+
+ // 5. If promise fulfilled with a byte sequence bytes:
+ auto result = promise->result();
+ auto* array_buffer = result.extract_pointer<JS::ArrayBuffer>();
+ if (promise->state() == JS::Promise::State::Fulfilled && array_buffer) {
+ // AD-HOC: This diverges from the spec as wrritten, where the type argument is specified explicitly for each caller.
+ // 1. Return the result of package data given bytes, type, blob’s type, and encoding.
+ auto result = TRY(FileReader::blob_package_data(realm(), array_buffer->buffer(), type, blob.type(), encoding));
+ return result.get<Result>();
+ }
+
+ // 6. Throw promise’s rejection reason.
+ VERIFY(promise->state() == JS::Promise::State::Rejected);
+ return JS::throw_completion(result);
+}
+
+}
diff --git a/Libraries/LibWeb/FileAPI/FileReaderSync.h b/Libraries/LibWeb/FileAPI/FileReaderSync.h
new file mode 100644
index 000000000000..79bb77442829
--- /dev/null
+++ b/Libraries/LibWeb/FileAPI/FileReaderSync.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2025, Tim Ledbetter <[email protected]>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibJS/Forward.h>
+#include <LibWeb/Bindings/PlatformObject.h>
+#include <LibWeb/FileAPI/FileReader.h>
+#include <LibWeb/Forward.h>
+
+namespace Web::FileAPI {
+
+// https://w3c.github.io/FileAPI/#FileReaderSync
+class FileReaderSync : public Bindings::PlatformObject {
+ WEB_PLATFORM_OBJECT(FileReaderSync, Bindings::PlatformObject);
+ GC_DECLARE_ALLOCATOR(FileReaderSync);
+
+public:
+ virtual ~FileReaderSync() override;
+
+ [[nodiscard]] static GC::Ref<FileReaderSync> create(JS::Realm&);
+ static GC::Ref<FileReaderSync> construct_impl(JS::Realm&);
+
+ WebIDL::ExceptionOr<GC::Root<JS::ArrayBuffer>> read_as_array_buffer(Blob&);
+ WebIDL::ExceptionOr<String> read_as_binary_string(Blob&);
+ WebIDL::ExceptionOr<String> read_as_text(Blob&, Optional<String> const& encoding = {});
+ WebIDL::ExceptionOr<String> read_as_data_url(Blob&);
+
+private:
+ explicit FileReaderSync(JS::Realm&);
+
+ template<typename Result>
+ WebIDL::ExceptionOr<Result> read_as(Blob&, FileReader::Type, Optional<String> const& encoding = {});
+
+ virtual void initialize(JS::Realm&) override;
+};
+
+}
diff --git a/Libraries/LibWeb/FileAPI/FileReaderSync.idl b/Libraries/LibWeb/FileAPI/FileReaderSync.idl
new file mode 100644
index 000000000000..3308b9d436a1
--- /dev/null
+++ b/Libraries/LibWeb/FileAPI/FileReaderSync.idl
@@ -0,0 +1,13 @@
+#import <FileAPI/Blob.idl>
+
+// https://w3c.github.io/FileAPI/#FileReaderSync
+[Exposed=(DedicatedWorker,SharedWorker)]
+interface FileReaderSync {
+ constructor();
+ // Synchronously return strings
+
+ ArrayBuffer readAsArrayBuffer(Blob blob);
+ DOMString readAsText(Blob blob, optional DOMString encoding);
+ DOMString readAsBinaryString(Blob blob);
+ DOMString readAsDataURL(Blob blob);
+};
diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake
index 6cc31f28aa79..65c596f03ad3 100644
--- a/Libraries/LibWeb/idl_files.cmake
+++ b/Libraries/LibWeb/idl_files.cmake
@@ -98,6 +98,7 @@ libweb_js_bindings(FileAPI/Blob)
libweb_js_bindings(FileAPI/File)
libweb_js_bindings(FileAPI/FileList)
libweb_js_bindings(FileAPI/FileReader)
+libweb_js_bindings(FileAPI/FileReaderSync)
libweb_js_bindings(Geometry/DOMMatrix)
libweb_js_bindings(Geometry/DOMMatrixReadOnly)
libweb_js_bindings(Geometry/DOMPoint)
|
d4e97b17abc079f1bfcd689b4518a288b6a80bf8
|
2020-05-30 14:03:24
|
Jack Karamanian
|
libjs: Use a non-arrow function to check the |this| value in the
| false
|
Use a non-arrow function to check the |this| value in the
|
libjs
|
diff --git a/Libraries/LibJS/Tests/Array.prototype.reduce.js b/Libraries/LibJS/Tests/Array.prototype.reduce.js
index 5189f89aae17..eeaf5a423d36 100644
--- a/Libraries/LibJS/Tests/Array.prototype.reduce.js
+++ b/Libraries/LibJS/Tests/Array.prototype.reduce.js
@@ -31,7 +31,7 @@ try {
message: "Reduce of empty array with no initial value"
});
- [1, 2].reduce(() => { assert(this === undefined) });
+ [1, 2].reduce(function () { assert(this === undefined) });
var callbackCalled = 0;
var callback = () => { callbackCalled++; return true };
diff --git a/Libraries/LibJS/Tests/Array.prototype.reduceRight.js b/Libraries/LibJS/Tests/Array.prototype.reduceRight.js
index 98c288099066..6e20d9ea4803 100644
--- a/Libraries/LibJS/Tests/Array.prototype.reduceRight.js
+++ b/Libraries/LibJS/Tests/Array.prototype.reduceRight.js
@@ -43,7 +43,7 @@ try {
}
);
- [1, 2].reduceRight(() => {
+ [1, 2].reduceRight(function () {
assert(this === undefined);
});
|
f9af2832c80c9f0239c719c3a3882b1e4bc75bcb
|
2022-12-25 20:28:58
|
Jonas Kvinge
|
ladybird: Fix typo in README.md
| false
|
Fix typo in README.md
|
ladybird
|
diff --git a/Ladybird/README.md b/Ladybird/README.md
index e7f30c000c0d..c9af98513e4e 100644
--- a/Ladybird/README.md
+++ b/Ladybird/README.md
@@ -16,7 +16,7 @@ On Arch Linux/Manjaro:
sudo pacman -S --needed base-devel cmake libgl ninja qt6-base qt6-tools qt6-wayland
```
-On Fedora or derivates:
+On Fedora or derivatives:
```
sudo dnf install cmake libglvnd-devel ninja-build qt6-qtbase-devel qt6-qttools-devel qt6-qtwayland-devel
```
|
2309029cb4e5563c3715c84140569c6a196b51fe
|
2020-01-20 18:19:05
|
Andreas Kling
|
ak: Allow clamp() with min==max
| false
|
Allow clamp() with min==max
|
ak
|
diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h
index 69f19eb703bb..67ad6d3d23ac 100644
--- a/AK/StdLibExtras.h
+++ b/AK/StdLibExtras.h
@@ -87,7 +87,7 @@ inline constexpr T max(const T& a, const T& b)
template<typename T>
inline constexpr T clamp(const T& value, const T& min, const T& max)
{
- ASSERT(max > min);
+ ASSERT(max >= min);
if (value > max)
return max;
if (value < min)
|
b3c132ffb7d8d294310d3747321332074604e08d
|
2020-02-24 15:57:03
|
Liav A
|
kernel: Update PATAChannel implementation to use the PIT class
| false
|
Update PATAChannel implementation to use the PIT class
|
kernel
|
diff --git a/Kernel/Devices/PATAChannel.cpp b/Kernel/Devices/PATAChannel.cpp
index 6b4174a6d137..0bc54596f31e 100644
--- a/Kernel/Devices/PATAChannel.cpp
+++ b/Kernel/Devices/PATAChannel.cpp
@@ -27,6 +27,7 @@
#include "PATADiskDevice.h"
#include <AK/ByteBuffer.h>
#include <Kernel/Devices/PATAChannel.h>
+#include <Kernel/Devices/PIT.h>
#include <Kernel/FileSystem/ProcFS.h>
#include <Kernel/Process.h>
#include <Kernel/VM/MemoryManager.h>
@@ -116,11 +117,18 @@ static Lock& s_lock()
OwnPtr<PATAChannel> PATAChannel::create(ChannelType type, bool force_pio)
{
- return make<PATAChannel>(type, force_pio);
+ PCI::Address pci_address;
+ 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;
+ kprintf("PATAChannel: PATA Controller found! id=%w:%w\n", id.vendor_id, id.device_id);
+ }
+ });
+ return make<PATAChannel>(pci_address, type, force_pio);
}
-PATAChannel::PATAChannel(ChannelType type, bool force_pio)
- : IRQHandler((type == ChannelType::Primary ? PATA_PRIMARY_IRQ : PATA_SECONDARY_IRQ))
+PATAChannel::PATAChannel(PCI::Address address, ChannelType type, bool force_pio)
+ : PCI::Device(address, (type == ChannelType::Primary ? PATA_PRIMARY_IRQ : PATA_SECONDARY_IRQ))
, m_channel_number((type == ChannelType::Primary ? 0 : 1))
, m_io_base((type == ChannelType::Primary ? 0x1F0 : 0x170))
, m_control_base((type == ChannelType::Primary ? 0x3f6 : 0x376))
@@ -142,17 +150,6 @@ PATAChannel::~PATAChannel()
void PATAChannel::initialize(bool force_pio)
{
- PCI::enumerate_all([this](const PCI::Address& address, PCI::ID id) {
- if (PCI::get_class(address) == PCI_Mass_Storage_Class && PCI::get_subclass(address) == PCI_IDE_Controller_Subclass) {
- m_pci_address = address;
- kprintf("PATAChannel: PATA Controller found! id=%w:%w\n", id.vendor_id, id.device_id);
- }
- });
-
- if (m_pci_address.is_null()) {
- kprintf("PATAChannel: PCI address was null; can not set up DMA\n");
- return;
- }
if (force_pio) {
kprintf("PATAChannel: Requested to force PIO mode; not setting up DMA\n");
@@ -160,9 +157,9 @@ void PATAChannel::initialize(bool force_pio)
}
// Let's try to set up DMA transfers.
- PCI::enable_bus_mastering(m_pci_address);
+ PCI::enable_bus_mastering(get_pci_address());
prdt().end_of_table = 0x8000;
- m_bus_master_base = PCI::get_BAR4(m_pci_address) & 0xfffc;
+ m_bus_master_base = PCI::get_BAR4(get_pci_address()) & 0xfffc;
m_dma_buffer_page = MM.allocate_supervisor_physical_page();
kprintf("PATAChannel: Bus master IDE: I/O @ %x\n", m_bus_master_base);
}
@@ -188,7 +185,7 @@ void PATAChannel::wait_for_irq()
disable_irq();
}
-void PATAChannel::handle_irq()
+void PATAChannel::handle_irq(RegisterState&)
{
u8 status = IO::in8(m_io_base + ATA_REG_STATUS);
if (status & ATA_SR_ERR) {
|
3c2565da9427aa245d23c7e7a9ebfeec59f02cf7
|
2021-05-21 01:40:45
|
Max Wipfli
|
ak: Add UnicodeUtils with Unicode-related helper functions
| false
|
Add UnicodeUtils with Unicode-related helper functions
|
ak
|
diff --git a/AK/UnicodeUtils.cpp b/AK/UnicodeUtils.cpp
new file mode 100644
index 000000000000..2db467065cbe
--- /dev/null
+++ b/AK/UnicodeUtils.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2021, Max Wipfli <[email protected]>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <AK/Array.h>
+#include <AK/Optional.h>
+#include <AK/StringView.h>
+#include <AK/UnicodeUtils.h>
+
+namespace AK::UnicodeUtils {
+
+Optional<StringView> get_unicode_control_code_point_alias(u32 code_point)
+{
+ static constexpr Array<StringView, 32> ascii_controls_lookup_table = {
+ "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
+ "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI",
+ "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
+ "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US"
+ };
+
+ static constexpr Array<StringView, 32> c1_controls_lookup_table = {
+ "XXX", "XXX", "BPH", "NBH", "IND", "NEL", "SSA", "ESA",
+ "HTS", "HTJ", "VTS", "PLD", "PLU", "RI", "SS2", "SS3",
+ "DCS", "PU1", "PU2", "STS", "CCH", "MW", "SPA", "EPA",
+ "SOS", "XXX", "SCI", "CSI", "ST", "OSC", "PM", "APC"
+ };
+
+ if (code_point < 0x20)
+ return ascii_controls_lookup_table[code_point];
+ if (code_point >= 0x80 && code_point < 0xa0)
+ return c1_controls_lookup_table[code_point - 0x80];
+ return {};
+}
+
+}
diff --git a/AK/UnicodeUtils.h b/AK/UnicodeUtils.h
new file mode 100644
index 000000000000..e7211deaeac9
--- /dev/null
+++ b/AK/UnicodeUtils.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2021, Max Wipfli <[email protected]>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Forward.h>
+
+namespace AK::UnicodeUtils {
+
+constexpr bool is_unicode_control_code_point(u32 code_point)
+{
+ return code_point < 0x20 || (code_point >= 0x80 && code_point < 0xa0);
+}
+
+Optional<StringView> get_unicode_control_code_point_alias(u32);
+
+}
|
0a05f04d1bc7fe6dd5ebaa8204c720b43bede626
|
2021-08-08 14:25:36
|
Daniel Bertalan
|
libjs: Fix UB in `Number.IsSafeInteger`
| false
|
Fix UB in `Number.IsSafeInteger`
|
libjs
|
diff --git a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp
index 82770468f4f3..d3e81d276864 100644
--- a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp
@@ -129,8 +129,10 @@ JS_DEFINE_NATIVE_FUNCTION(NumberConstructor::is_safe_integer)
{
if (!vm.argument(0).is_number())
return Value(false);
+ if (!vm.argument(0).is_integral_number())
+ return Value(false);
auto value = vm.argument(0).as_double();
- return Value((int64_t)value == value && value >= MIN_SAFE_INTEGER_VALUE && value <= MAX_SAFE_INTEGER_VALUE);
+ return Value(value >= MIN_SAFE_INTEGER_VALUE && value <= MAX_SAFE_INTEGER_VALUE);
}
}
|
830a57c6b23430c749395811761252d1999f3559
|
2020-03-07 15:02:51
|
Andreas Kling
|
libweb: Rename directory LibHTML => LibWeb
| false
|
Rename directory LibHTML => LibWeb
|
libweb
|
diff --git a/Applications/Browser/InspectorWidget.cpp b/Applications/Browser/InspectorWidget.cpp
index 024d192f4ff2..63e8abdab3b7 100644
--- a/Applications/Browser/InspectorWidget.cpp
+++ b/Applications/Browser/InspectorWidget.cpp
@@ -30,10 +30,10 @@
#include <LibGUI/TableView.h>
#include <LibGUI/TreeView.h>
#include <LibGUI/TabWidget.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/DOMTreeModel.h>
-#include <LibHTML/StylePropertiesModel.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/DOMTreeModel.h>
+#include <LibWeb/StylePropertiesModel.h>
InspectorWidget::InspectorWidget()
{
diff --git a/Applications/Browser/InspectorWidget.h b/Applications/Browser/InspectorWidget.h
index de03e007a652..f070b77cf748 100644
--- a/Applications/Browser/InspectorWidget.h
+++ b/Applications/Browser/InspectorWidget.h
@@ -25,7 +25,7 @@
*/
#include <LibGUI/Widget.h>
-#include <LibHTML/Forward.h>
+#include <LibWeb/Forward.h>
class InspectorWidget final : public GUI::Widget {
C_OBJECT(InspectorWidget)
diff --git a/Applications/Browser/Makefile b/Applications/Browser/Makefile
index 12f28553cbdb..4a57f47e68e8 100755
--- a/Applications/Browser/Makefile
+++ b/Applications/Browser/Makefile
@@ -4,11 +4,11 @@ OBJS = \
PROGRAM = Browser
-LIB_DEPS = GUI HTML Gfx IPC Protocol Core
+LIB_DEPS = GUI Web Gfx IPC Protocol Core
-main.cpp: ../../Libraries/LibHTML/CSS/PropertyID.h
-../../Libraries/LibHTML/CSS/PropertyID.h:
- @flock ../../Libraries/LibHTML $(MAKE) -C ../../Libraries/LibHTML
+main.cpp: ../../Libraries/LibWeb/CSS/PropertyID.h
+../../Libraries/LibWeb/CSS/PropertyID.h:
+ @flock ../../Libraries/LibWeb $(MAKE) -C ../../Libraries/LibWeb
main.cpp: ../../Servers/ProtocolServer/ProtocolClientEndpoint.h
../../Servers/ProtocolServer/ProtocolClientEndpoint.h:
diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp
index 92c3ceac7eae..65a1176bd8ef 100644
--- a/Applications/Browser/main.cpp
+++ b/Applications/Browser/main.cpp
@@ -37,18 +37,18 @@
#include <LibGUI/TextBox.h>
#include <LibGUI/ToolBar.h>
#include <LibGUI/Window.h>
-#include <LibHTML/CSS/StyleResolver.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/DOMTreeModel.h>
-#include <LibHTML/Dump.h>
-#include <LibHTML/HtmlView.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutDocument.h>
-#include <LibHTML/Layout/LayoutInline.h>
-#include <LibHTML/Layout/LayoutNode.h>
-#include <LibHTML/Parser/CSSParser.h>
-#include <LibHTML/Parser/HTMLParser.h>
-#include <LibHTML/ResourceLoader.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/DOMTreeModel.h>
+#include <LibWeb/Dump.h>
+#include <LibWeb/HtmlView.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutDocument.h>
+#include <LibWeb/Layout/LayoutInline.h>
+#include <LibWeb/Layout/LayoutNode.h>
+#include <LibWeb/Parser/CSSParser.h>
+#include <LibWeb/Parser/HTMLParser.h>
+#include <LibWeb/ResourceLoader.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/Applications/Help/Makefile b/Applications/Help/Makefile
index c6e492329650..8fac56daac00 100644
--- a/Applications/Help/Makefile
+++ b/Applications/Help/Makefile
@@ -7,6 +7,6 @@ OBJS = \
PROGRAM = Help
-LIB_DEPS = GUI HTML Gfx Markdown IPC Protocol Thread Pthread Core
+LIB_DEPS = GUI Web Gfx Markdown IPC Protocol Thread Pthread Core
include ../../Makefile.common
diff --git a/Applications/Help/main.cpp b/Applications/Help/main.cpp
index cb640633ff44..d9b9f3041753 100644
--- a/Applications/Help/main.cpp
+++ b/Applications/Help/main.cpp
@@ -40,10 +40,10 @@
#include <LibGUI/ToolBar.h>
#include <LibGUI/TreeView.h>
#include <LibGUI/Window.h>
-#include <LibHTML/HtmlView.h>
-#include <LibHTML/Layout/LayoutNode.h>
-#include <LibHTML/Parser/CSSParser.h>
-#include <LibHTML/Parser/HTMLParser.h>
+#include <LibWeb/HtmlView.h>
+#include <LibWeb/Layout/LayoutNode.h>
+#include <LibWeb/Parser/CSSParser.h>
+#include <LibWeb/Parser/HTMLParser.h>
#include <LibMarkdown/MDDocument.h>
#include <libgen.h>
#include <stdio.h>
diff --git a/Applications/IRCClient/IRCLogBuffer.cpp b/Applications/IRCClient/IRCLogBuffer.cpp
index aefc0db83607..0dd2d8fc1586 100644
--- a/Applications/IRCClient/IRCLogBuffer.cpp
+++ b/Applications/IRCClient/IRCLogBuffer.cpp
@@ -26,13 +26,13 @@
#include "IRCLogBuffer.h"
#include <AK/StringBuilder.h>
-#include <LibHTML/DOM/DocumentFragment.h>
-#include <LibHTML/DOM/DocumentType.h>
-#include <LibHTML/DOM/ElementFactory.h>
-#include <LibHTML/DOM/HTMLBodyElement.h>
-#include <LibHTML/DOM/Text.h>
-#include <LibHTML/Dump.h>
-#include <LibHTML/Parser/HTMLParser.h>
+#include <LibWeb/DOM/DocumentFragment.h>
+#include <LibWeb/DOM/DocumentType.h>
+#include <LibWeb/DOM/ElementFactory.h>
+#include <LibWeb/DOM/HTMLBodyElement.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/Dump.h>
+#include <LibWeb/Parser/HTMLParser.h>
#include <stdio.h>
#include <time.h>
diff --git a/Applications/IRCClient/IRCLogBuffer.h b/Applications/IRCClient/IRCLogBuffer.h
index 4cef97a77dc9..183ee21b0181 100644
--- a/Applications/IRCClient/IRCLogBuffer.h
+++ b/Applications/IRCClient/IRCLogBuffer.h
@@ -30,7 +30,7 @@
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <LibGfx/Color.h>
-#include <LibHTML/DOM/Document.h>
+#include <LibWeb/DOM/Document.h>
class IRCLogBuffer : public RefCounted<IRCLogBuffer> {
public:
diff --git a/Applications/IRCClient/IRCWindow.cpp b/Applications/IRCClient/IRCWindow.cpp
index 1994f1e05942..e68bc3957728 100644
--- a/Applications/IRCClient/IRCWindow.cpp
+++ b/Applications/IRCClient/IRCWindow.cpp
@@ -33,7 +33,7 @@
#include <LibGUI/TableView.h>
#include <LibGUI/TextBox.h>
#include <LibGUI/TextEditor.h>
-#include <LibHTML/HtmlView.h>
+#include <LibWeb/HtmlView.h>
IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name)
: m_client(client)
diff --git a/Applications/IRCClient/IRCWindow.h b/Applications/IRCClient/IRCWindow.h
index c8189fee6315..f652d35145e7 100644
--- a/Applications/IRCClient/IRCWindow.h
+++ b/Applications/IRCClient/IRCWindow.h
@@ -27,7 +27,7 @@
#pragma once
#include <LibGUI/Widget.h>
-#include <LibHTML/Forward.h>
+#include <LibWeb/Forward.h>
class IRCChannel;
class IRCClient;
diff --git a/Applications/IRCClient/Makefile b/Applications/IRCClient/Makefile
index afe6db9b86b8..1bc0b646fe87 100644
--- a/Applications/IRCClient/Makefile
+++ b/Applications/IRCClient/Makefile
@@ -11,6 +11,6 @@ OBJS = \
PROGRAM = IRCClient
-LIB_DEPS = GUI HTML Gfx Protocol IPC Thread Pthread Core
+LIB_DEPS = GUI Web Gfx Protocol IPC Thread Pthread Core
include ../../Makefile.common
diff --git a/Base/home/anon/www/welcome.html b/Base/home/anon/www/welcome.html
index 16563d09fcd5..728e3ba17bfe 100644
--- a/Base/home/anon/www/welcome.html
+++ b/Base/home/anon/www/welcome.html
@@ -20,7 +20,7 @@
</head>
<body link="#44f" vlink="#c4c" background="90s-bg.png">
<h1>Welcome to the Serenity Browser!</h1>
- <p>This is a very simple browser built on the LibHTML engine.</p>
+ <p>This is a very simple browser built on the LibWeb engine.</p>
<p>Some small test pages:</p>
<ul>
<li><a href="small.html">small</a></li>
diff --git a/DevTools/HackStudio/Editor.cpp b/DevTools/HackStudio/Editor.cpp
index b2a725c5ec56..9cecd1b330ba 100644
--- a/DevTools/HackStudio/Editor.cpp
+++ b/DevTools/HackStudio/Editor.cpp
@@ -34,11 +34,11 @@
#include <LibGUI/Painter.h>
#include <LibGUI/ScrollBar.h>
#include <LibGUI/Window.h>
-#include <LibHTML/DOM/ElementFactory.h>
-#include <LibHTML/DOM/HTMLHeadElement.h>
-#include <LibHTML/DOM/Text.h>
-#include <LibHTML/HtmlView.h>
-#include <LibHTML/Parser/HTMLParser.h>
+#include <LibWeb/DOM/ElementFactory.h>
+#include <LibWeb/DOM/HTMLHeadElement.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/HtmlView.h>
+#include <LibWeb/Parser/HTMLParser.h>
#include <LibMarkdown/MDDocument.h>
//#define EDITOR_DEBUG
@@ -151,7 +151,7 @@ void Editor::show_documentation_tooltip_if_available(const String& hovered_token
return;
}
- // FIXME: LibHTML needs a friendlier DOM manipulation API. Something like innerHTML :^)
+ // FIXME: LibWeb needs a friendlier DOM manipulation API. Something like innerHTML :^)
auto style_element = create_element(*html_document, "style");
style_element->append_child(adopt(*new Web::Text(*html_document, "body { background-color: #dac7b5; }")));
diff --git a/DevTools/HackStudio/Editor.h b/DevTools/HackStudio/Editor.h
index 3df2f8816fa3..f4096cd126b5 100644
--- a/DevTools/HackStudio/Editor.h
+++ b/DevTools/HackStudio/Editor.h
@@ -27,7 +27,7 @@
#pragma once
#include <LibGUI/TextEditor.h>
-#include <LibHTML/Forward.h>
+#include <LibWeb/Forward.h>
class EditorWrapper;
diff --git a/DevTools/HackStudio/Makefile b/DevTools/HackStudio/Makefile
index 6598b57e350c..d1f17a065184 100644
--- a/DevTools/HackStudio/Makefile
+++ b/DevTools/HackStudio/Makefile
@@ -17,6 +17,6 @@ OBJS = \
PROGRAM = HackStudio
-LIB_DEPS = GUI HTML VT Protocol Markdown Gfx IPC Thread Pthread Core
+LIB_DEPS = GUI Web VT Protocol Markdown Gfx IPC Thread Pthread Core
include ../../Makefile.common
diff --git a/Libraries/LibHTML/CSS/.gitignore b/Libraries/LibWeb/CSS/.gitignore
similarity index 100%
rename from Libraries/LibHTML/CSS/.gitignore
rename to Libraries/LibWeb/CSS/.gitignore
diff --git a/Libraries/LibHTML/CSS/Default.css b/Libraries/LibWeb/CSS/Default.css
similarity index 100%
rename from Libraries/LibHTML/CSS/Default.css
rename to Libraries/LibWeb/CSS/Default.css
diff --git a/Libraries/LibHTML/CSS/Length.h b/Libraries/LibWeb/CSS/Length.h
similarity index 100%
rename from Libraries/LibHTML/CSS/Length.h
rename to Libraries/LibWeb/CSS/Length.h
diff --git a/Libraries/LibHTML/CSS/LengthBox.h b/Libraries/LibWeb/CSS/LengthBox.h
similarity index 97%
rename from Libraries/LibHTML/CSS/LengthBox.h
rename to Libraries/LibWeb/CSS/LengthBox.h
index 1ab356ff50c3..230babd4834f 100644
--- a/Libraries/LibHTML/CSS/LengthBox.h
+++ b/Libraries/LibWeb/CSS/LengthBox.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/CSS/Length.h>
+#include <LibWeb/CSS/Length.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/Properties.json b/Libraries/LibWeb/CSS/Properties.json
similarity index 100%
rename from Libraries/LibHTML/CSS/Properties.json
rename to Libraries/LibWeb/CSS/Properties.json
diff --git a/Libraries/LibHTML/CSS/Selector.cpp b/Libraries/LibWeb/CSS/Selector.cpp
similarity index 98%
rename from Libraries/LibHTML/CSS/Selector.cpp
rename to Libraries/LibWeb/CSS/Selector.cpp
index 064fe15984ea..8bc2aafb5ea8 100644
--- a/Libraries/LibHTML/CSS/Selector.cpp
+++ b/Libraries/LibWeb/CSS/Selector.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/CSS/Selector.h>
+#include <LibWeb/CSS/Selector.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/Selector.h b/Libraries/LibWeb/CSS/Selector.h
similarity index 98%
rename from Libraries/LibHTML/CSS/Selector.h
rename to Libraries/LibWeb/CSS/Selector.h
index 979080a18754..4abac988ff08 100644
--- a/Libraries/LibHTML/CSS/Selector.h
+++ b/Libraries/LibWeb/CSS/Selector.h
@@ -28,7 +28,7 @@
#include <AK/String.h>
#include <AK/Vector.h>
-#include <LibHTML/CSS/Specificity.h>
+#include <LibWeb/CSS/Specificity.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/SelectorEngine.cpp b/Libraries/LibWeb/CSS/SelectorEngine.cpp
similarity index 97%
rename from Libraries/LibHTML/CSS/SelectorEngine.cpp
rename to Libraries/LibWeb/CSS/SelectorEngine.cpp
index e9f46a3feeb6..3d21f418c24f 100644
--- a/Libraries/LibHTML/CSS/SelectorEngine.cpp
+++ b/Libraries/LibWeb/CSS/SelectorEngine.cpp
@@ -24,10 +24,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/CSS/SelectorEngine.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/DOM/Text.h>
+#include <LibWeb/CSS/SelectorEngine.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/DOM/Text.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/SelectorEngine.h b/Libraries/LibWeb/CSS/SelectorEngine.h
similarity index 97%
rename from Libraries/LibHTML/CSS/SelectorEngine.h
rename to Libraries/LibWeb/CSS/SelectorEngine.h
index 8017697ad142..e5be692ce751 100644
--- a/Libraries/LibHTML/CSS/SelectorEngine.h
+++ b/Libraries/LibWeb/CSS/SelectorEngine.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/CSS/Selector.h>
+#include <LibWeb/CSS/Selector.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/Specificity.h b/Libraries/LibWeb/CSS/Specificity.h
similarity index 100%
rename from Libraries/LibHTML/CSS/Specificity.h
rename to Libraries/LibWeb/CSS/Specificity.h
diff --git a/Libraries/LibHTML/CSS/StyleDeclaration.cpp b/Libraries/LibWeb/CSS/StyleDeclaration.cpp
similarity index 97%
rename from Libraries/LibHTML/CSS/StyleDeclaration.cpp
rename to Libraries/LibWeb/CSS/StyleDeclaration.cpp
index 0ffd87beeece..4a56a33a6543 100644
--- a/Libraries/LibHTML/CSS/StyleDeclaration.cpp
+++ b/Libraries/LibWeb/CSS/StyleDeclaration.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/CSS/StyleDeclaration.h>
+#include <LibWeb/CSS/StyleDeclaration.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/StyleDeclaration.h b/Libraries/LibWeb/CSS/StyleDeclaration.h
similarity index 98%
rename from Libraries/LibHTML/CSS/StyleDeclaration.h
rename to Libraries/LibWeb/CSS/StyleDeclaration.h
index 9ef3db33723e..966bb4c0a59a 100644
--- a/Libraries/LibHTML/CSS/StyleDeclaration.h
+++ b/Libraries/LibWeb/CSS/StyleDeclaration.h
@@ -28,7 +28,7 @@
#include <AK/String.h>
#include <AK/Vector.h>
-#include <LibHTML/CSS/StyleValue.h>
+#include <LibWeb/CSS/StyleValue.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/StyleProperties.cpp b/Libraries/LibWeb/CSS/StyleProperties.cpp
similarity index 98%
rename from Libraries/LibHTML/CSS/StyleProperties.cpp
rename to Libraries/LibWeb/CSS/StyleProperties.cpp
index 645f180d2228..42469062d092 100644
--- a/Libraries/LibHTML/CSS/StyleProperties.cpp
+++ b/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -25,8 +25,8 @@
*/
#include <LibCore/DirIterator.h>
-#include <LibHTML/CSS/StyleProperties.h>
-#include <LibHTML/FontCache.h>
+#include <LibWeb/CSS/StyleProperties.h>
+#include <LibWeb/FontCache.h>
#include <ctype.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/StyleProperties.h b/Libraries/LibWeb/CSS/StyleProperties.h
similarity index 98%
rename from Libraries/LibHTML/CSS/StyleProperties.h
rename to Libraries/LibWeb/CSS/StyleProperties.h
index 9540eba3da6c..8835ff0380b1 100644
--- a/Libraries/LibHTML/CSS/StyleProperties.h
+++ b/Libraries/LibWeb/CSS/StyleProperties.h
@@ -30,7 +30,7 @@
#include <AK/NonnullRefPtr.h>
#include <LibGfx/Font.h>
#include <LibGfx/Forward.h>
-#include <LibHTML/CSS/StyleValue.h>
+#include <LibWeb/CSS/StyleValue.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/StyleResolver.cpp b/Libraries/LibWeb/CSS/StyleResolver.cpp
similarity index 97%
rename from Libraries/LibHTML/CSS/StyleResolver.cpp
rename to Libraries/LibWeb/CSS/StyleResolver.cpp
index 347cd6cefc8b..7b5a890fa016 100644
--- a/Libraries/LibHTML/CSS/StyleResolver.cpp
+++ b/Libraries/LibWeb/CSS/StyleResolver.cpp
@@ -24,13 +24,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/CSS/SelectorEngine.h>
-#include <LibHTML/CSS/StyleResolver.h>
-#include <LibHTML/CSS/StyleSheet.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Dump.h>
-#include <LibHTML/Parser/CSSParser.h>
+#include <LibWeb/CSS/SelectorEngine.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/CSS/StyleSheet.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Dump.h>
+#include <LibWeb/Parser/CSSParser.h>
#include <ctype.h>
#include <stdio.h>
diff --git a/Libraries/LibHTML/CSS/StyleResolver.h b/Libraries/LibWeb/CSS/StyleResolver.h
similarity index 98%
rename from Libraries/LibHTML/CSS/StyleResolver.h
rename to Libraries/LibWeb/CSS/StyleResolver.h
index 325fef496d79..95e691ed7fa5 100644
--- a/Libraries/LibHTML/CSS/StyleResolver.h
+++ b/Libraries/LibWeb/CSS/StyleResolver.h
@@ -28,7 +28,7 @@
#include <AK/NonnullRefPtrVector.h>
#include <AK/OwnPtr.h>
-#include <LibHTML/CSS/StyleProperties.h>
+#include <LibWeb/CSS/StyleProperties.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/StyleRule.cpp b/Libraries/LibWeb/CSS/StyleRule.cpp
similarity index 97%
rename from Libraries/LibHTML/CSS/StyleRule.cpp
rename to Libraries/LibWeb/CSS/StyleRule.cpp
index 5fddcb5d2c20..bed671fd4772 100644
--- a/Libraries/LibHTML/CSS/StyleRule.cpp
+++ b/Libraries/LibWeb/CSS/StyleRule.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/CSS/StyleRule.h>
+#include <LibWeb/CSS/StyleRule.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/StyleRule.h b/Libraries/LibWeb/CSS/StyleRule.h
similarity index 96%
rename from Libraries/LibHTML/CSS/StyleRule.h
rename to Libraries/LibWeb/CSS/StyleRule.h
index 4bce75e293ba..2b857080570a 100644
--- a/Libraries/LibHTML/CSS/StyleRule.h
+++ b/Libraries/LibWeb/CSS/StyleRule.h
@@ -27,8 +27,8 @@
#pragma once
#include <AK/NonnullRefPtrVector.h>
-#include <LibHTML/CSS/Selector.h>
-#include <LibHTML/CSS/StyleDeclaration.h>
+#include <LibWeb/CSS/Selector.h>
+#include <LibWeb/CSS/StyleDeclaration.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/StyleSheet.cpp b/Libraries/LibWeb/CSS/StyleSheet.cpp
similarity index 97%
rename from Libraries/LibHTML/CSS/StyleSheet.cpp
rename to Libraries/LibWeb/CSS/StyleSheet.cpp
index 092abf7e1084..e153a3b7ef33 100644
--- a/Libraries/LibHTML/CSS/StyleSheet.cpp
+++ b/Libraries/LibWeb/CSS/StyleSheet.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/CSS/StyleSheet.h>
+#include <LibWeb/CSS/StyleSheet.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/StyleSheet.h b/Libraries/LibWeb/CSS/StyleSheet.h
similarity index 98%
rename from Libraries/LibHTML/CSS/StyleSheet.h
rename to Libraries/LibWeb/CSS/StyleSheet.h
index 0646c25e24fb..4acd44603881 100644
--- a/Libraries/LibHTML/CSS/StyleSheet.h
+++ b/Libraries/LibWeb/CSS/StyleSheet.h
@@ -27,7 +27,7 @@
#pragma once
#include <AK/NonnullRefPtrVector.h>
-#include <LibHTML/CSS/StyleRule.h>
+#include <LibWeb/CSS/StyleRule.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/StyleValue.cpp b/Libraries/LibWeb/CSS/StyleValue.cpp
similarity index 95%
rename from Libraries/LibHTML/CSS/StyleValue.cpp
rename to Libraries/LibWeb/CSS/StyleValue.cpp
index 6cc4f087d0ee..36b5e23644b7 100644
--- a/Libraries/LibHTML/CSS/StyleValue.cpp
+++ b/Libraries/LibWeb/CSS/StyleValue.cpp
@@ -27,10 +27,10 @@
#include <AK/ByteBuffer.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/PNGLoader.h>
-#include <LibHTML/CSS/StyleValue.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/Frame.h>
-#include <LibHTML/ResourceLoader.h>
+#include <LibWeb/CSS/StyleValue.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/Frame.h>
+#include <LibWeb/ResourceLoader.h>
namespace Web {
diff --git a/Libraries/LibHTML/CSS/StyleValue.h b/Libraries/LibWeb/CSS/StyleValue.h
similarity index 98%
rename from Libraries/LibHTML/CSS/StyleValue.h
rename to Libraries/LibWeb/CSS/StyleValue.h
index 6dd1a3463d77..c1214a0bca51 100644
--- a/Libraries/LibHTML/CSS/StyleValue.h
+++ b/Libraries/LibWeb/CSS/StyleValue.h
@@ -34,8 +34,8 @@
#include <AK/WeakPtr.h>
#include <LibGfx/Color.h>
#include <LibGfx/Bitmap.h>
-#include <LibHTML/CSS/Length.h>
-#include <LibHTML/CSS/PropertyID.h>
+#include <LibWeb/CSS/Length.h>
+#include <LibWeb/CSS/PropertyID.h>
namespace Web {
diff --git a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp b/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
similarity index 98%
rename from Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
rename to Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
index c3491bbd329e..f31fe62310bd 100644
--- a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
+++ b/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp/Generate_CSS_PropertyID_cpp.cpp
@@ -59,7 +59,7 @@ int main(int argc, char** argv)
ASSERT(json.is_object());
dbg() << "#include <AK/Assertions.h>";
- dbg() << "#include <LibHTML/CSS/PropertyID.h>";
+ dbg() << "#include <LibWeb/CSS/PropertyID.h>";
dbg() << "namespace Web {";
dbg() << "namespace CSS {";
diff --git a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Makefile b/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp/Makefile
similarity index 100%
rename from Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_cpp/Makefile
rename to Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_cpp/Makefile
diff --git a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp b/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp
similarity index 100%
rename from Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp
rename to Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h/Generate_CSS_PropertyID_h.cpp
diff --git a/Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Makefile b/Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h/Makefile
similarity index 100%
rename from Libraries/LibHTML/CodeGenerators/Generate_CSS_PropertyID_h/Makefile
rename to Libraries/LibWeb/CodeGenerators/Generate_CSS_PropertyID_h/Makefile
diff --git a/Libraries/LibHTML/CodeGenerators/Makefile b/Libraries/LibWeb/CodeGenerators/Makefile
similarity index 100%
rename from Libraries/LibHTML/CodeGenerators/Makefile
rename to Libraries/LibWeb/CodeGenerators/Makefile
diff --git a/Libraries/LibHTML/DOM/CharacterData.cpp b/Libraries/LibWeb/DOM/CharacterData.cpp
similarity index 97%
rename from Libraries/LibHTML/DOM/CharacterData.cpp
rename to Libraries/LibWeb/DOM/CharacterData.cpp
index 83b14fb54a39..a7fa15eb1da6 100644
--- a/Libraries/LibHTML/DOM/CharacterData.cpp
+++ b/Libraries/LibWeb/DOM/CharacterData.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/CharacterData.h>
+#include <LibWeb/DOM/CharacterData.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/CharacterData.h b/Libraries/LibWeb/DOM/CharacterData.h
similarity index 98%
rename from Libraries/LibHTML/DOM/CharacterData.h
rename to Libraries/LibWeb/DOM/CharacterData.h
index 81533bfaad10..dece5fe3388e 100644
--- a/Libraries/LibHTML/DOM/CharacterData.h
+++ b/Libraries/LibWeb/DOM/CharacterData.h
@@ -27,7 +27,7 @@
#pragma once
#include <AK/String.h>
-#include <LibHTML/DOM/Node.h>
+#include <LibWeb/DOM/Node.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/Comment.cpp b/Libraries/LibWeb/DOM/Comment.cpp
similarity index 95%
rename from Libraries/LibHTML/DOM/Comment.cpp
rename to Libraries/LibWeb/DOM/Comment.cpp
index 18c581a42745..0bd30e008efb 100644
--- a/Libraries/LibHTML/DOM/Comment.cpp
+++ b/Libraries/LibWeb/DOM/Comment.cpp
@@ -24,8 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/Comment.h>
-#include <LibHTML/Layout/LayoutText.h>
+#include <LibWeb/DOM/Comment.h>
+#include <LibWeb/Layout/LayoutText.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/Comment.h b/Libraries/LibWeb/DOM/Comment.h
similarity index 97%
rename from Libraries/LibHTML/DOM/Comment.h
rename to Libraries/LibWeb/DOM/Comment.h
index 75bfd215c096..8530ad9191a6 100644
--- a/Libraries/LibHTML/DOM/Comment.h
+++ b/Libraries/LibWeb/DOM/Comment.h
@@ -27,7 +27,7 @@
#pragma once
#include <AK/String.h>
-#include <LibHTML/DOM/CharacterData.h>
+#include <LibWeb/DOM/CharacterData.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
similarity index 94%
rename from Libraries/LibHTML/DOM/Document.cpp
rename to Libraries/LibWeb/DOM/Document.cpp
index ae24ec4ddec5..6b2f11e81a1b 100644
--- a/Libraries/LibHTML/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -28,19 +28,19 @@
#include <AK/StringBuilder.h>
#include <LibCore/Timer.h>
#include <LibGUI/Application.h>
-#include <LibHTML/CSS/StyleResolver.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/DocumentType.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/DOM/ElementFactory.h>
-#include <LibHTML/DOM/HTMLBodyElement.h>
-#include <LibHTML/DOM/HTMLHeadElement.h>
-#include <LibHTML/DOM/HTMLHtmlElement.h>
-#include <LibHTML/DOM/HTMLTitleElement.h>
-#include <LibHTML/Frame.h>
-#include <LibHTML/HtmlView.h>
-#include <LibHTML/Layout/LayoutDocument.h>
-#include <LibHTML/Layout/LayoutTreeBuilder.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/DocumentType.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/DOM/ElementFactory.h>
+#include <LibWeb/DOM/HTMLBodyElement.h>
+#include <LibWeb/DOM/HTMLHeadElement.h>
+#include <LibWeb/DOM/HTMLHtmlElement.h>
+#include <LibWeb/DOM/HTMLTitleElement.h>
+#include <LibWeb/Frame.h>
+#include <LibWeb/HtmlView.h>
+#include <LibWeb/Layout/LayoutDocument.h>
+#include <LibWeb/Layout/LayoutTreeBuilder.h>
#include <stdio.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h
similarity index 97%
rename from Libraries/LibHTML/DOM/Document.h
rename to Libraries/LibWeb/DOM/Document.h
index 6f7ab80cc012..aa7d3e2014ed 100644
--- a/Libraries/LibHTML/DOM/Document.h
+++ b/Libraries/LibWeb/DOM/Document.h
@@ -33,9 +33,9 @@
#include <AK/URL.h>
#include <AK/WeakPtr.h>
#include <LibCore/Forward.h>
-#include <LibHTML/CSS/StyleResolver.h>
-#include <LibHTML/CSS/StyleSheet.h>
-#include <LibHTML/DOM/ParentNode.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/CSS/StyleSheet.h>
+#include <LibWeb/DOM/ParentNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/DocumentFragment.h b/Libraries/LibWeb/DOM/DocumentFragment.h
similarity index 98%
rename from Libraries/LibHTML/DOM/DocumentFragment.h
rename to Libraries/LibWeb/DOM/DocumentFragment.h
index 6034819d5544..55e51feec4cd 100644
--- a/Libraries/LibHTML/DOM/DocumentFragment.h
+++ b/Libraries/LibWeb/DOM/DocumentFragment.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/ParentNode.h>
+#include <LibWeb/DOM/ParentNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/DocumentType.cpp b/Libraries/LibWeb/DOM/DocumentType.cpp
similarity index 97%
rename from Libraries/LibHTML/DOM/DocumentType.cpp
rename to Libraries/LibWeb/DOM/DocumentType.cpp
index 43e95e153aa9..c6481f782474 100644
--- a/Libraries/LibHTML/DOM/DocumentType.cpp
+++ b/Libraries/LibWeb/DOM/DocumentType.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/DocumentType.h>
+#include <LibWeb/DOM/DocumentType.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/DocumentType.h b/Libraries/LibWeb/DOM/DocumentType.h
similarity index 98%
rename from Libraries/LibHTML/DOM/DocumentType.h
rename to Libraries/LibWeb/DOM/DocumentType.h
index 60b987176801..b863ecb98cc9 100644
--- a/Libraries/LibHTML/DOM/DocumentType.h
+++ b/Libraries/LibWeb/DOM/DocumentType.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/Node.h>
+#include <LibWeb/DOM/Node.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp
similarity index 93%
rename from Libraries/LibHTML/DOM/Element.cpp
rename to Libraries/LibWeb/DOM/Element.cpp
index ea35b90d600a..fc3674a32b48 100644
--- a/Libraries/LibHTML/DOM/Element.cpp
+++ b/Libraries/LibWeb/DOM/Element.cpp
@@ -24,18 +24,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/CSS/StyleResolver.h>
-#include <LibHTML/CSS/PropertyID.h>
-#include <LibHTML/CSS/Length.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutInline.h>
-#include <LibHTML/Layout/LayoutListItem.h>
-#include <LibHTML/Layout/LayoutTable.h>
-#include <LibHTML/Layout/LayoutTableCell.h>
-#include <LibHTML/Layout/LayoutTableRow.h>
-#include <LibHTML/Layout/LayoutTreeBuilder.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/CSS/PropertyID.h>
+#include <LibWeb/CSS/Length.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutInline.h>
+#include <LibWeb/Layout/LayoutListItem.h>
+#include <LibWeb/Layout/LayoutTable.h>
+#include <LibWeb/Layout/LayoutTableCell.h>
+#include <LibWeb/Layout/LayoutTableRow.h>
+#include <LibWeb/Layout/LayoutTreeBuilder.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/Element.h b/Libraries/LibWeb/DOM/Element.h
similarity index 97%
rename from Libraries/LibHTML/DOM/Element.h
rename to Libraries/LibWeb/DOM/Element.h
index 6039807e065b..0e7af34ba8fe 100644
--- a/Libraries/LibHTML/DOM/Element.h
+++ b/Libraries/LibWeb/DOM/Element.h
@@ -27,8 +27,8 @@
#pragma once
#include <AK/String.h>
-#include <LibHTML/DOM/ParentNode.h>
-#include <LibHTML/Layout/LayoutNode.h>
+#include <LibWeb/DOM/ParentNode.h>
+#include <LibWeb/Layout/LayoutNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/ElementFactory.cpp b/Libraries/LibWeb/DOM/ElementFactory.cpp
similarity index 84%
rename from Libraries/LibHTML/DOM/ElementFactory.cpp
rename to Libraries/LibWeb/DOM/ElementFactory.cpp
index 5055fcc65858..b2c362fa8840 100644
--- a/Libraries/LibHTML/DOM/ElementFactory.cpp
+++ b/Libraries/LibWeb/DOM/ElementFactory.cpp
@@ -24,22 +24,22 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/ElementFactory.h>
-#include <LibHTML/DOM/HTMLAnchorElement.h>
-#include <LibHTML/DOM/HTMLBRElement.h>
-#include <LibHTML/DOM/HTMLBlinkElement.h>
-#include <LibHTML/DOM/HTMLBodyElement.h>
-#include <LibHTML/DOM/HTMLFontElement.h>
-#include <LibHTML/DOM/HTMLFormElement.h>
-#include <LibHTML/DOM/HTMLHRElement.h>
-#include <LibHTML/DOM/HTMLHeadElement.h>
-#include <LibHTML/DOM/HTMLHeadingElement.h>
-#include <LibHTML/DOM/HTMLHtmlElement.h>
-#include <LibHTML/DOM/HTMLImageElement.h>
-#include <LibHTML/DOM/HTMLInputElement.h>
-#include <LibHTML/DOM/HTMLLinkElement.h>
-#include <LibHTML/DOM/HTMLStyleElement.h>
-#include <LibHTML/DOM/HTMLTitleElement.h>
+#include <LibWeb/DOM/ElementFactory.h>
+#include <LibWeb/DOM/HTMLAnchorElement.h>
+#include <LibWeb/DOM/HTMLBRElement.h>
+#include <LibWeb/DOM/HTMLBlinkElement.h>
+#include <LibWeb/DOM/HTMLBodyElement.h>
+#include <LibWeb/DOM/HTMLFontElement.h>
+#include <LibWeb/DOM/HTMLFormElement.h>
+#include <LibWeb/DOM/HTMLHRElement.h>
+#include <LibWeb/DOM/HTMLHeadElement.h>
+#include <LibWeb/DOM/HTMLHeadingElement.h>
+#include <LibWeb/DOM/HTMLHtmlElement.h>
+#include <LibWeb/DOM/HTMLImageElement.h>
+#include <LibWeb/DOM/HTMLInputElement.h>
+#include <LibWeb/DOM/HTMLLinkElement.h>
+#include <LibWeb/DOM/HTMLStyleElement.h>
+#include <LibWeb/DOM/HTMLTitleElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/ElementFactory.h b/Libraries/LibWeb/DOM/ElementFactory.h
similarity index 97%
rename from Libraries/LibHTML/DOM/ElementFactory.h
rename to Libraries/LibWeb/DOM/ElementFactory.h
index 0a87c672d111..3c494e78cd68 100644
--- a/Libraries/LibHTML/DOM/ElementFactory.h
+++ b/Libraries/LibWeb/DOM/ElementFactory.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/Element.h>
+#include <LibWeb/DOM/Element.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLAnchorElement.cpp b/Libraries/LibWeb/DOM/HTMLAnchorElement.cpp
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLAnchorElement.cpp
rename to Libraries/LibWeb/DOM/HTMLAnchorElement.cpp
index b763512d8b9e..5fffa52fdf07 100644
--- a/Libraries/LibHTML/DOM/HTMLAnchorElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLAnchorElement.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/HTMLAnchorElement.h>
+#include <LibWeb/DOM/HTMLAnchorElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLAnchorElement.h b/Libraries/LibWeb/DOM/HTMLAnchorElement.h
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLAnchorElement.h
rename to Libraries/LibWeb/DOM/HTMLAnchorElement.h
index 8f91354f9160..89d20c7be41a 100644
--- a/Libraries/LibHTML/DOM/HTMLAnchorElement.h
+++ b/Libraries/LibWeb/DOM/HTMLAnchorElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLBRElement.cpp b/Libraries/LibWeb/DOM/HTMLBRElement.cpp
similarity index 95%
rename from Libraries/LibHTML/DOM/HTMLBRElement.cpp
rename to Libraries/LibWeb/DOM/HTMLBRElement.cpp
index 7eb7eb1e90c0..f7667c44d6fb 100644
--- a/Libraries/LibHTML/DOM/HTMLBRElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLBRElement.cpp
@@ -24,8 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/HTMLBRElement.h>
-#include <LibHTML/Layout/LayoutBreak.h>
+#include <LibWeb/DOM/HTMLBRElement.h>
+#include <LibWeb/Layout/LayoutBreak.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLBRElement.h b/Libraries/LibWeb/DOM/HTMLBRElement.h
similarity index 98%
rename from Libraries/LibHTML/DOM/HTMLBRElement.h
rename to Libraries/LibWeb/DOM/HTMLBRElement.h
index 21181b9c8922..4dcf6ff18559 100644
--- a/Libraries/LibHTML/DOM/HTMLBRElement.h
+++ b/Libraries/LibWeb/DOM/HTMLBRElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLBlinkElement.cpp b/Libraries/LibWeb/DOM/HTMLBlinkElement.cpp
similarity index 92%
rename from Libraries/LibHTML/DOM/HTMLBlinkElement.cpp
rename to Libraries/LibWeb/DOM/HTMLBlinkElement.cpp
index 940989c45944..51f8d9664234 100644
--- a/Libraries/LibHTML/DOM/HTMLBlinkElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLBlinkElement.cpp
@@ -25,10 +25,10 @@
*/
#include <LibCore/Timer.h>
-#include <LibHTML/CSS/StyleProperties.h>
-#include <LibHTML/CSS/StyleValue.h>
-#include <LibHTML/DOM/HTMLBlinkElement.h>
-#include <LibHTML/Layout/LayoutNode.h>
+#include <LibWeb/CSS/StyleProperties.h>
+#include <LibWeb/CSS/StyleValue.h>
+#include <LibWeb/DOM/HTMLBlinkElement.h>
+#include <LibWeb/Layout/LayoutNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLBlinkElement.h b/Libraries/LibWeb/DOM/HTMLBlinkElement.h
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLBlinkElement.h
rename to Libraries/LibWeb/DOM/HTMLBlinkElement.h
index cb093ce5d556..63d85b509323 100644
--- a/Libraries/LibHTML/DOM/HTMLBlinkElement.h
+++ b/Libraries/LibWeb/DOM/HTMLBlinkElement.h
@@ -27,7 +27,7 @@
#pragma once
#include <LibCore/Forward.h>
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLBodyElement.cpp b/Libraries/LibWeb/DOM/HTMLBodyElement.cpp
similarity index 95%
rename from Libraries/LibHTML/DOM/HTMLBodyElement.cpp
rename to Libraries/LibWeb/DOM/HTMLBodyElement.cpp
index 62abfd188d5c..a5fbd9dc9029 100644
--- a/Libraries/LibHTML/DOM/HTMLBodyElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLBodyElement.cpp
@@ -24,10 +24,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/CSS/StyleProperties.h>
-#include <LibHTML/CSS/StyleValue.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/HTMLBodyElement.h>
+#include <LibWeb/CSS/StyleProperties.h>
+#include <LibWeb/CSS/StyleValue.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/HTMLBodyElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLBodyElement.h b/Libraries/LibWeb/DOM/HTMLBodyElement.h
similarity index 98%
rename from Libraries/LibHTML/DOM/HTMLBodyElement.h
rename to Libraries/LibWeb/DOM/HTMLBodyElement.h
index 1f757cb3243b..22296fa46ce3 100644
--- a/Libraries/LibHTML/DOM/HTMLBodyElement.h
+++ b/Libraries/LibWeb/DOM/HTMLBodyElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLElement.cpp b/Libraries/LibWeb/DOM/HTMLElement.cpp
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLElement.cpp
rename to Libraries/LibWeb/DOM/HTMLElement.cpp
index 0f1214278ca1..030a442854b4 100644
--- a/Libraries/LibHTML/DOM/HTMLElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLElement.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLElement.h b/Libraries/LibWeb/DOM/HTMLElement.h
similarity index 98%
rename from Libraries/LibHTML/DOM/HTMLElement.h
rename to Libraries/LibWeb/DOM/HTMLElement.h
index 912ac898d90a..56d8329b4207 100644
--- a/Libraries/LibHTML/DOM/HTMLElement.h
+++ b/Libraries/LibWeb/DOM/HTMLElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/Element.h>
+#include <LibWeb/DOM/Element.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLFontElement.cpp b/Libraries/LibWeb/DOM/HTMLFontElement.cpp
similarity index 94%
rename from Libraries/LibHTML/DOM/HTMLFontElement.cpp
rename to Libraries/LibWeb/DOM/HTMLFontElement.cpp
index 9e5ac545587b..276daece4c58 100644
--- a/Libraries/LibHTML/DOM/HTMLFontElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLFontElement.cpp
@@ -24,9 +24,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/CSS/StyleProperties.h>
-#include <LibHTML/CSS/StyleValue.h>
-#include <LibHTML/DOM/HTMLFontElement.h>
+#include <LibWeb/CSS/StyleProperties.h>
+#include <LibWeb/CSS/StyleValue.h>
+#include <LibWeb/DOM/HTMLFontElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLFontElement.h b/Libraries/LibWeb/DOM/HTMLFontElement.h
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLFontElement.h
rename to Libraries/LibWeb/DOM/HTMLFontElement.h
index 96503115e7f6..57d0088426b4 100644
--- a/Libraries/LibHTML/DOM/HTMLFontElement.h
+++ b/Libraries/LibWeb/DOM/HTMLFontElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLFormElement.cpp b/Libraries/LibWeb/DOM/HTMLFormElement.cpp
similarity index 95%
rename from Libraries/LibHTML/DOM/HTMLFormElement.cpp
rename to Libraries/LibWeb/DOM/HTMLFormElement.cpp
index a0f2df04e030..f7092a73d00d 100644
--- a/Libraries/LibHTML/DOM/HTMLFormElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLFormElement.cpp
@@ -25,10 +25,10 @@
*/
#include <AK/StringBuilder.h>
-#include <LibHTML/DOM/HTMLFormElement.h>
-#include <LibHTML/DOM/HTMLInputElement.h>
-#include <LibHTML/Frame.h>
-#include <LibHTML/HtmlView.h>
+#include <LibWeb/DOM/HTMLFormElement.h>
+#include <LibWeb/DOM/HTMLInputElement.h>
+#include <LibWeb/Frame.h>
+#include <LibWeb/HtmlView.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLFormElement.h b/Libraries/LibWeb/DOM/HTMLFormElement.h
similarity index 98%
rename from Libraries/LibHTML/DOM/HTMLFormElement.h
rename to Libraries/LibWeb/DOM/HTMLFormElement.h
index 51cbf13bbd2e..bd99ce5c07f5 100644
--- a/Libraries/LibHTML/DOM/HTMLFormElement.h
+++ b/Libraries/LibWeb/DOM/HTMLFormElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLHRElement.cpp b/Libraries/LibWeb/DOM/HTMLHRElement.cpp
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLHRElement.cpp
rename to Libraries/LibWeb/DOM/HTMLHRElement.cpp
index b4436e6966b4..7d4dbb4a3b1e 100644
--- a/Libraries/LibHTML/DOM/HTMLHRElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLHRElement.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/HTMLHRElement.h>
+#include <LibWeb/DOM/HTMLHRElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLHRElement.h b/Libraries/LibWeb/DOM/HTMLHRElement.h
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLHRElement.h
rename to Libraries/LibWeb/DOM/HTMLHRElement.h
index 0b141d32a0c6..48a57026f9f2 100644
--- a/Libraries/LibHTML/DOM/HTMLHRElement.h
+++ b/Libraries/LibWeb/DOM/HTMLHRElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLHeadElement.cpp b/Libraries/LibWeb/DOM/HTMLHeadElement.cpp
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLHeadElement.cpp
rename to Libraries/LibWeb/DOM/HTMLHeadElement.cpp
index 7191d3b3c9fc..6d828b269e39 100644
--- a/Libraries/LibHTML/DOM/HTMLHeadElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLHeadElement.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/HTMLHeadElement.h>
+#include <LibWeb/DOM/HTMLHeadElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLHeadElement.h b/Libraries/LibWeb/DOM/HTMLHeadElement.h
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLHeadElement.h
rename to Libraries/LibWeb/DOM/HTMLHeadElement.h
index e769346987df..5acb84ea916c 100644
--- a/Libraries/LibHTML/DOM/HTMLHeadElement.h
+++ b/Libraries/LibWeb/DOM/HTMLHeadElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLHeadingElement.cpp b/Libraries/LibWeb/DOM/HTMLHeadingElement.cpp
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLHeadingElement.cpp
rename to Libraries/LibWeb/DOM/HTMLHeadingElement.cpp
index aad30884f313..fab61fda5196 100644
--- a/Libraries/LibHTML/DOM/HTMLHeadingElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLHeadingElement.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/HTMLHeadingElement.h>
+#include <LibWeb/DOM/HTMLHeadingElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLHeadingElement.h b/Libraries/LibWeb/DOM/HTMLHeadingElement.h
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLHeadingElement.h
rename to Libraries/LibWeb/DOM/HTMLHeadingElement.h
index 54089ebc2ee9..0a8ad9ec4f21 100644
--- a/Libraries/LibHTML/DOM/HTMLHeadingElement.h
+++ b/Libraries/LibWeb/DOM/HTMLHeadingElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLHtmlElement.cpp b/Libraries/LibWeb/DOM/HTMLHtmlElement.cpp
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLHtmlElement.cpp
rename to Libraries/LibWeb/DOM/HTMLHtmlElement.cpp
index 576a50c76503..af1355cbde83 100644
--- a/Libraries/LibHTML/DOM/HTMLHtmlElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLHtmlElement.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/HTMLHtmlElement.h>
+#include <LibWeb/DOM/HTMLHtmlElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLHtmlElement.h b/Libraries/LibWeb/DOM/HTMLHtmlElement.h
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLHtmlElement.h
rename to Libraries/LibWeb/DOM/HTMLHtmlElement.h
index 673c80bc9402..d926c3459d00 100644
--- a/Libraries/LibHTML/DOM/HTMLHtmlElement.h
+++ b/Libraries/LibWeb/DOM/HTMLHtmlElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLImageElement.cpp b/Libraries/LibWeb/DOM/HTMLImageElement.cpp
similarity index 95%
rename from Libraries/LibHTML/DOM/HTMLImageElement.cpp
rename to Libraries/LibWeb/DOM/HTMLImageElement.cpp
index 316b6c0ce2e5..f1db4428f9be 100644
--- a/Libraries/LibHTML/DOM/HTMLImageElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLImageElement.cpp
@@ -26,11 +26,11 @@
#include <LibGfx/Bitmap.h>
#include <LibGfx/ImageDecoder.h>
-#include <LibHTML/CSS/StyleResolver.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/HTMLImageElement.h>
-#include <LibHTML/Layout/LayoutImage.h>
-#include <LibHTML/ResourceLoader.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/HTMLImageElement.h>
+#include <LibWeb/Layout/LayoutImage.h>
+#include <LibWeb/ResourceLoader.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLImageElement.h b/Libraries/LibWeb/DOM/HTMLImageElement.h
similarity index 98%
rename from Libraries/LibHTML/DOM/HTMLImageElement.h
rename to Libraries/LibWeb/DOM/HTMLImageElement.h
index d4b412c12ffa..f30f37d3a1e7 100644
--- a/Libraries/LibHTML/DOM/HTMLImageElement.h
+++ b/Libraries/LibWeb/DOM/HTMLImageElement.h
@@ -28,7 +28,7 @@
#include <AK/ByteBuffer.h>
#include <LibGfx/Forward.h>
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLInputElement.cpp b/Libraries/LibWeb/DOM/HTMLInputElement.cpp
similarity index 93%
rename from Libraries/LibHTML/DOM/HTMLInputElement.cpp
rename to Libraries/LibWeb/DOM/HTMLInputElement.cpp
index 0924c123c939..bd7194f251fd 100644
--- a/Libraries/LibHTML/DOM/HTMLInputElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLInputElement.cpp
@@ -27,12 +27,12 @@
#include <LibCore/ElapsedTimer.h>
#include <LibGUI/Button.h>
#include <LibGUI/TextBox.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/HTMLFormElement.h>
-#include <LibHTML/DOM/HTMLInputElement.h>
-#include <LibHTML/Frame.h>
-#include <LibHTML/HtmlView.h>
-#include <LibHTML/Layout/LayoutWidget.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/HTMLFormElement.h>
+#include <LibWeb/DOM/HTMLInputElement.h>
+#include <LibWeb/Frame.h>
+#include <LibWeb/HtmlView.h>
+#include <LibWeb/Layout/LayoutWidget.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLInputElement.h b/Libraries/LibWeb/DOM/HTMLInputElement.h
similarity index 98%
rename from Libraries/LibHTML/DOM/HTMLInputElement.h
rename to Libraries/LibWeb/DOM/HTMLInputElement.h
index c4100d452693..f54d6efa6b48 100644
--- a/Libraries/LibHTML/DOM/HTMLInputElement.h
+++ b/Libraries/LibWeb/DOM/HTMLInputElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLLinkElement.cpp b/Libraries/LibWeb/DOM/HTMLLinkElement.cpp
similarity index 93%
rename from Libraries/LibHTML/DOM/HTMLLinkElement.cpp
rename to Libraries/LibWeb/DOM/HTMLLinkElement.cpp
index 71083c88ddf6..f2bd9e8aed4c 100644
--- a/Libraries/LibHTML/DOM/HTMLLinkElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLLinkElement.cpp
@@ -27,10 +27,10 @@
#include <AK/ByteBuffer.h>
#include <AK/URL.h>
#include <LibCore/File.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/HTMLLinkElement.h>
-#include <LibHTML/Parser/CSSParser.h>
-#include <LibHTML/ResourceLoader.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/HTMLLinkElement.h>
+#include <LibWeb/Parser/CSSParser.h>
+#include <LibWeb/ResourceLoader.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLLinkElement.h b/Libraries/LibWeb/DOM/HTMLLinkElement.h
similarity index 98%
rename from Libraries/LibHTML/DOM/HTMLLinkElement.h
rename to Libraries/LibWeb/DOM/HTMLLinkElement.h
index 1e9176e14876..ad005b4e9346 100644
--- a/Libraries/LibHTML/DOM/HTMLLinkElement.h
+++ b/Libraries/LibWeb/DOM/HTMLLinkElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLStyleElement.cpp b/Libraries/LibWeb/DOM/HTMLStyleElement.cpp
similarity index 93%
rename from Libraries/LibHTML/DOM/HTMLStyleElement.cpp
rename to Libraries/LibWeb/DOM/HTMLStyleElement.cpp
index 865d0b264ad1..4a48fb3fa115 100644
--- a/Libraries/LibHTML/DOM/HTMLStyleElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLStyleElement.cpp
@@ -25,10 +25,10 @@
*/
#include <AK/StringBuilder.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/HTMLStyleElement.h>
-#include <LibHTML/DOM/Text.h>
-#include <LibHTML/Parser/CSSParser.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/HTMLStyleElement.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/Parser/CSSParser.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLStyleElement.h b/Libraries/LibWeb/DOM/HTMLStyleElement.h
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLStyleElement.h
rename to Libraries/LibWeb/DOM/HTMLStyleElement.h
index deb54387c306..f4534c9dab38 100644
--- a/Libraries/LibHTML/DOM/HTMLStyleElement.h
+++ b/Libraries/LibWeb/DOM/HTMLStyleElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLTitleElement.cpp b/Libraries/LibWeb/DOM/HTMLTitleElement.cpp
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLTitleElement.cpp
rename to Libraries/LibWeb/DOM/HTMLTitleElement.cpp
index 6aa5b699dbe8..c523c8812e9d 100644
--- a/Libraries/LibHTML/DOM/HTMLTitleElement.cpp
+++ b/Libraries/LibWeb/DOM/HTMLTitleElement.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/HTMLTitleElement.h>
+#include <LibWeb/DOM/HTMLTitleElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/HTMLTitleElement.h b/Libraries/LibWeb/DOM/HTMLTitleElement.h
similarity index 97%
rename from Libraries/LibHTML/DOM/HTMLTitleElement.h
rename to Libraries/LibWeb/DOM/HTMLTitleElement.h
index c5731d5f4609..6485a3d428cc 100644
--- a/Libraries/LibHTML/DOM/HTMLTitleElement.h
+++ b/Libraries/LibWeb/DOM/HTMLTitleElement.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/HTMLElement.h>
+#include <LibWeb/DOM/HTMLElement.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp
similarity index 90%
rename from Libraries/LibHTML/DOM/Node.cpp
rename to Libraries/LibWeb/DOM/Node.cpp
index 7f46574414fb..7c2341b0cb61 100644
--- a/Libraries/LibHTML/DOM/Node.cpp
+++ b/Libraries/LibWeb/DOM/Node.cpp
@@ -25,15 +25,15 @@
*/
#include <AK/StringBuilder.h>
-#include <LibHTML/CSS/StyleResolver.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/DOM/HTMLAnchorElement.h>
-#include <LibHTML/DOM/Node.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutDocument.h>
-#include <LibHTML/Layout/LayoutInline.h>
-#include <LibHTML/Layout/LayoutNode.h>
-#include <LibHTML/Layout/LayoutText.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/DOM/HTMLAnchorElement.h>
+#include <LibWeb/DOM/Node.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutDocument.h>
+#include <LibWeb/Layout/LayoutInline.h>
+#include <LibWeb/Layout/LayoutNode.h>
+#include <LibWeb/Layout/LayoutText.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h
similarity index 99%
rename from Libraries/LibHTML/DOM/Node.h
rename to Libraries/LibWeb/DOM/Node.h
index 5d839114795f..51a48bdffdba 100644
--- a/Libraries/LibHTML/DOM/Node.h
+++ b/Libraries/LibWeb/DOM/Node.h
@@ -30,7 +30,7 @@
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <AK/Vector.h>
-#include <LibHTML/TreeNode.h>
+#include <LibWeb/TreeNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/ParentNode.cpp b/Libraries/LibWeb/DOM/ParentNode.cpp
similarity index 97%
rename from Libraries/LibHTML/DOM/ParentNode.cpp
rename to Libraries/LibWeb/DOM/ParentNode.cpp
index 9b4e8f3f7b14..3bc86e480da8 100644
--- a/Libraries/LibHTML/DOM/ParentNode.cpp
+++ b/Libraries/LibWeb/DOM/ParentNode.cpp
@@ -24,5 +24,5 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/ParentNode.h>
+#include <LibWeb/DOM/ParentNode.h>
diff --git a/Libraries/LibHTML/DOM/ParentNode.h b/Libraries/LibWeb/DOM/ParentNode.h
similarity index 98%
rename from Libraries/LibHTML/DOM/ParentNode.h
rename to Libraries/LibWeb/DOM/ParentNode.h
index 48c6bd5e2a3f..e8e826c95990 100644
--- a/Libraries/LibHTML/DOM/ParentNode.h
+++ b/Libraries/LibWeb/DOM/ParentNode.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/DOM/Node.h>
+#include <LibWeb/DOM/Node.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/Text.cpp b/Libraries/LibWeb/DOM/Text.cpp
similarity index 96%
rename from Libraries/LibHTML/DOM/Text.cpp
rename to Libraries/LibWeb/DOM/Text.cpp
index c107b22bb964..65c2e365503e 100644
--- a/Libraries/LibHTML/DOM/Text.cpp
+++ b/Libraries/LibWeb/DOM/Text.cpp
@@ -24,8 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/Text.h>
-#include <LibHTML/Layout/LayoutText.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/Layout/LayoutText.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOM/Text.h b/Libraries/LibWeb/DOM/Text.h
similarity index 97%
rename from Libraries/LibHTML/DOM/Text.h
rename to Libraries/LibWeb/DOM/Text.h
index e886b6d12f9f..5a482ed6a080 100644
--- a/Libraries/LibHTML/DOM/Text.h
+++ b/Libraries/LibWeb/DOM/Text.h
@@ -27,7 +27,7 @@
#pragma once
#include <AK/String.h>
-#include <LibHTML/DOM/CharacterData.h>
+#include <LibWeb/DOM/CharacterData.h>
namespace Web {
diff --git a/Libraries/LibHTML/DOMTreeModel.cpp b/Libraries/LibWeb/DOMTreeModel.cpp
similarity index 98%
rename from Libraries/LibHTML/DOMTreeModel.cpp
rename to Libraries/LibWeb/DOMTreeModel.cpp
index 8535e3bd6ff6..8a4902b1e7d5 100644
--- a/Libraries/LibHTML/DOMTreeModel.cpp
+++ b/Libraries/LibWeb/DOMTreeModel.cpp
@@ -26,9 +26,9 @@
#include "DOMTreeModel.h"
#include <AK/StringBuilder.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/DOM/Text.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/DOM/Text.h>
#include <ctype.h>
#include <stdio.h>
diff --git a/Libraries/LibHTML/DOMTreeModel.h b/Libraries/LibWeb/DOMTreeModel.h
similarity index 100%
rename from Libraries/LibHTML/DOMTreeModel.h
rename to Libraries/LibWeb/DOMTreeModel.h
diff --git a/Libraries/LibHTML/Dump.cpp b/Libraries/LibWeb/Dump.cpp
similarity index 96%
rename from Libraries/LibHTML/Dump.cpp
rename to Libraries/LibWeb/Dump.cpp
index b85105eb062a..9da4607d1983 100644
--- a/Libraries/LibHTML/Dump.cpp
+++ b/Libraries/LibWeb/Dump.cpp
@@ -25,17 +25,17 @@
*/
#include <AK/Utf8View.h>
-#include <LibHTML/CSS/PropertyID.h>
-#include <LibHTML/CSS/StyleSheet.h>
-#include <LibHTML/DOM/Comment.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/DocumentType.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/DOM/Text.h>
-#include <LibHTML/Dump.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutNode.h>
-#include <LibHTML/Layout/LayoutText.h>
+#include <LibWeb/CSS/PropertyID.h>
+#include <LibWeb/CSS/StyleSheet.h>
+#include <LibWeb/DOM/Comment.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/DocumentType.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/Dump.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutNode.h>
+#include <LibWeb/Layout/LayoutText.h>
#include <stdio.h>
namespace Web {
diff --git a/Libraries/LibHTML/Dump.h b/Libraries/LibWeb/Dump.h
similarity index 100%
rename from Libraries/LibHTML/Dump.h
rename to Libraries/LibWeb/Dump.h
diff --git a/Libraries/LibHTML/FontCache.cpp b/Libraries/LibWeb/FontCache.cpp
similarity index 98%
rename from Libraries/LibHTML/FontCache.cpp
rename to Libraries/LibWeb/FontCache.cpp
index 2942d0e1e59f..c2ba8e70501b 100644
--- a/Libraries/LibHTML/FontCache.cpp
+++ b/Libraries/LibWeb/FontCache.cpp
@@ -25,7 +25,7 @@
*/
#include <LibGfx/Font.h>
-#include <LibHTML/FontCache.h>
+#include <LibWeb/FontCache.h>
FontCache& FontCache::the()
{
diff --git a/Libraries/LibHTML/FontCache.h b/Libraries/LibWeb/FontCache.h
similarity index 100%
rename from Libraries/LibHTML/FontCache.h
rename to Libraries/LibWeb/FontCache.h
diff --git a/Libraries/LibHTML/Forward.h b/Libraries/LibWeb/Forward.h
similarity index 100%
rename from Libraries/LibHTML/Forward.h
rename to Libraries/LibWeb/Forward.h
diff --git a/Libraries/LibHTML/Frame.cpp b/Libraries/LibWeb/Frame.cpp
similarity index 94%
rename from Libraries/LibHTML/Frame.cpp
rename to Libraries/LibWeb/Frame.cpp
index 5559ce769b6d..ca1645d1de07 100644
--- a/Libraries/LibHTML/Frame.cpp
+++ b/Libraries/LibWeb/Frame.cpp
@@ -24,10 +24,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/Frame.h>
-#include <LibHTML/HtmlView.h>
-#include <LibHTML/Layout/LayoutDocument.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/Frame.h>
+#include <LibWeb/HtmlView.h>
+#include <LibWeb/Layout/LayoutDocument.h>
namespace Web {
diff --git a/Libraries/LibHTML/Frame.h b/Libraries/LibWeb/Frame.h
similarity index 98%
rename from Libraries/LibHTML/Frame.h
rename to Libraries/LibWeb/Frame.h
index 97a72b9d4f2d..9f91a928a103 100644
--- a/Libraries/LibHTML/Frame.h
+++ b/Libraries/LibWeb/Frame.h
@@ -32,7 +32,7 @@
#include <AK/WeakPtr.h>
#include <LibGfx/Rect.h>
#include <LibGfx/Size.h>
-#include <LibHTML/TreeNode.h>
+#include <LibWeb/TreeNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/HtmlView.cpp b/Libraries/LibWeb/HtmlView.cpp
similarity index 96%
rename from Libraries/LibHTML/HtmlView.cpp
rename to Libraries/LibWeb/HtmlView.cpp
index 85c23c470071..9b1ca65ee4f2 100644
--- a/Libraries/LibHTML/HtmlView.cpp
+++ b/Libraries/LibWeb/HtmlView.cpp
@@ -32,19 +32,19 @@
#include <LibGUI/ScrollBar.h>
#include <LibGUI/Window.h>
#include <LibGfx/PNGLoader.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/DOM/ElementFactory.h>
-#include <LibHTML/DOM/HTMLAnchorElement.h>
-#include <LibHTML/DOM/HTMLImageElement.h>
-#include <LibHTML/DOM/Text.h>
-#include <LibHTML/Dump.h>
-#include <LibHTML/Frame.h>
-#include <LibHTML/HtmlView.h>
-#include <LibHTML/Layout/LayoutDocument.h>
-#include <LibHTML/Layout/LayoutNode.h>
-#include <LibHTML/Parser/HTMLParser.h>
-#include <LibHTML/RenderingContext.h>
-#include <LibHTML/ResourceLoader.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/DOM/ElementFactory.h>
+#include <LibWeb/DOM/HTMLAnchorElement.h>
+#include <LibWeb/DOM/HTMLImageElement.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/Dump.h>
+#include <LibWeb/Frame.h>
+#include <LibWeb/HtmlView.h>
+#include <LibWeb/Layout/LayoutDocument.h>
+#include <LibWeb/Layout/LayoutNode.h>
+#include <LibWeb/Parser/HTMLParser.h>
+#include <LibWeb/RenderingContext.h>
+#include <LibWeb/ResourceLoader.h>
#include <stdio.h>
namespace Web {
diff --git a/Libraries/LibHTML/HtmlView.h b/Libraries/LibWeb/HtmlView.h
similarity index 98%
rename from Libraries/LibHTML/HtmlView.h
rename to Libraries/LibWeb/HtmlView.h
index f5efd9aaefa6..7eed509711c3 100644
--- a/Libraries/LibHTML/HtmlView.h
+++ b/Libraries/LibWeb/HtmlView.h
@@ -27,7 +27,7 @@
#include <AK/URL.h>
#include <LibGUI/ScrollableWidget.h>
-#include <LibHTML/DOM/Document.h>
+#include <LibWeb/DOM/Document.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/BoxModelMetrics.cpp b/Libraries/LibWeb/Layout/BoxModelMetrics.cpp
similarity index 97%
rename from Libraries/LibHTML/Layout/BoxModelMetrics.cpp
rename to Libraries/LibWeb/Layout/BoxModelMetrics.cpp
index e10576e9e49d..b218ce3c7cfe 100644
--- a/Libraries/LibHTML/Layout/BoxModelMetrics.cpp
+++ b/Libraries/LibWeb/Layout/BoxModelMetrics.cpp
@@ -24,7 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/Layout/BoxModelMetrics.h>
+#include <LibWeb/Layout/BoxModelMetrics.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/BoxModelMetrics.h b/Libraries/LibWeb/Layout/BoxModelMetrics.h
similarity index 98%
rename from Libraries/LibHTML/Layout/BoxModelMetrics.h
rename to Libraries/LibWeb/Layout/BoxModelMetrics.h
index 0e27edc07cfb..18bdb4c5740d 100644
--- a/Libraries/LibHTML/Layout/BoxModelMetrics.h
+++ b/Libraries/LibWeb/Layout/BoxModelMetrics.h
@@ -27,7 +27,7 @@
#pragma once
#include <LibGfx/Size.h>
-#include <LibHTML/CSS/LengthBox.h>
+#include <LibWeb/CSS/LengthBox.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutBlock.cpp b/Libraries/LibWeb/Layout/LayoutBlock.cpp
similarity index 98%
rename from Libraries/LibHTML/Layout/LayoutBlock.cpp
rename to Libraries/LibWeb/Layout/LayoutBlock.cpp
index 360fa8592441..38d1e818ad15 100644
--- a/Libraries/LibHTML/Layout/LayoutBlock.cpp
+++ b/Libraries/LibWeb/Layout/LayoutBlock.cpp
@@ -25,12 +25,12 @@
*/
#include <LibGUI/Painter.h>
-#include <LibHTML/CSS/StyleResolver.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutInline.h>
-#include <LibHTML/Layout/LayoutReplaced.h>
-#include <LibHTML/Layout/LayoutText.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutInline.h>
+#include <LibWeb/Layout/LayoutReplaced.h>
+#include <LibWeb/Layout/LayoutText.h>
#include <math.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutBlock.h b/Libraries/LibWeb/Layout/LayoutBlock.h
similarity index 98%
rename from Libraries/LibHTML/Layout/LayoutBlock.h
rename to Libraries/LibWeb/Layout/LayoutBlock.h
index b1f0d57c0591..0eaab2520cbc 100644
--- a/Libraries/LibHTML/Layout/LayoutBlock.h
+++ b/Libraries/LibWeb/Layout/LayoutBlock.h
@@ -26,8 +26,8 @@
#pragma once
-#include <LibHTML/Layout/LayoutBox.h>
-#include <LibHTML/Layout/LineBox.h>
+#include <LibWeb/Layout/LayoutBox.h>
+#include <LibWeb/Layout/LineBox.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutBox.cpp b/Libraries/LibWeb/Layout/LayoutBox.cpp
similarity index 98%
rename from Libraries/LibHTML/Layout/LayoutBox.cpp
rename to Libraries/LibWeb/Layout/LayoutBox.cpp
index 0bc90c8f4165..415592f65925 100644
--- a/Libraries/LibHTML/Layout/LayoutBox.cpp
+++ b/Libraries/LibWeb/Layout/LayoutBox.cpp
@@ -25,11 +25,11 @@
*/
#include <LibGUI/Painter.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/HTMLBodyElement.h>
-#include <LibHTML/Frame.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutBox.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/HTMLBodyElement.h>
+#include <LibWeb/Frame.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutBox.h>
//#define DRAW_BOXES_AROUND_LAYOUT_NODES
//#define DRAW_BOXES_AROUND_HOVERED_NODES
diff --git a/Libraries/LibHTML/Layout/LayoutBox.h b/Libraries/LibWeb/Layout/LayoutBox.h
similarity index 98%
rename from Libraries/LibHTML/Layout/LayoutBox.h
rename to Libraries/LibWeb/Layout/LayoutBox.h
index d79b5a6e4e9a..ced083e3dcea 100644
--- a/Libraries/LibHTML/Layout/LayoutBox.h
+++ b/Libraries/LibWeb/Layout/LayoutBox.h
@@ -27,7 +27,7 @@
#pragma once
#include <LibGfx/FloatRect.h>
-#include <LibHTML/Layout/LayoutNode.h>
+#include <LibWeb/Layout/LayoutNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutBreak.cpp b/Libraries/LibWeb/Layout/LayoutBreak.cpp
similarity index 95%
rename from Libraries/LibHTML/Layout/LayoutBreak.cpp
rename to Libraries/LibWeb/Layout/LayoutBreak.cpp
index d85e8c32e76a..9d0d2b768ea9 100644
--- a/Libraries/LibHTML/Layout/LayoutBreak.cpp
+++ b/Libraries/LibWeb/Layout/LayoutBreak.cpp
@@ -24,8 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutBreak.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutBreak.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutBreak.h b/Libraries/LibWeb/Layout/LayoutBreak.h
similarity index 95%
rename from Libraries/LibHTML/Layout/LayoutBreak.h
rename to Libraries/LibWeb/Layout/LayoutBreak.h
index ef3f0f243985..1fb28540d1d8 100644
--- a/Libraries/LibHTML/Layout/LayoutBreak.h
+++ b/Libraries/LibWeb/Layout/LayoutBreak.h
@@ -26,8 +26,8 @@
#pragma once
-#include <LibHTML/DOM/HTMLBRElement.h>
-#include <LibHTML/Layout/LayoutNode.h>
+#include <LibWeb/DOM/HTMLBRElement.h>
+#include <LibWeb/Layout/LayoutNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutDocument.cpp b/Libraries/LibWeb/Layout/LayoutDocument.cpp
similarity index 94%
rename from Libraries/LibHTML/Layout/LayoutDocument.cpp
rename to Libraries/LibWeb/Layout/LayoutDocument.cpp
index f711a31071a1..d01a9787ddb8 100644
--- a/Libraries/LibHTML/Layout/LayoutDocument.cpp
+++ b/Libraries/LibWeb/Layout/LayoutDocument.cpp
@@ -24,10 +24,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/Dump.h>
-#include <LibHTML/Frame.h>
-#include <LibHTML/Layout/LayoutDocument.h>
-#include <LibHTML/Layout/LayoutImage.h>
+#include <LibWeb/Dump.h>
+#include <LibWeb/Frame.h>
+#include <LibWeb/Layout/LayoutDocument.h>
+#include <LibWeb/Layout/LayoutImage.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutDocument.h b/Libraries/LibWeb/Layout/LayoutDocument.h
similarity index 96%
rename from Libraries/LibHTML/Layout/LayoutDocument.h
rename to Libraries/LibWeb/Layout/LayoutDocument.h
index 39f68c459a2a..89dd0f372640 100644
--- a/Libraries/LibHTML/Layout/LayoutDocument.h
+++ b/Libraries/LibWeb/Layout/LayoutDocument.h
@@ -26,8 +26,8 @@
#pragma once
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/Layout/LayoutBlock.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/Layout/LayoutBlock.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutImage.cpp b/Libraries/LibWeb/Layout/LayoutImage.cpp
similarity index 98%
rename from Libraries/LibHTML/Layout/LayoutImage.cpp
rename to Libraries/LibWeb/Layout/LayoutImage.cpp
index 45e865a93175..20a9538effd1 100644
--- a/Libraries/LibHTML/Layout/LayoutImage.cpp
+++ b/Libraries/LibWeb/Layout/LayoutImage.cpp
@@ -27,7 +27,7 @@
#include <LibGfx/Font.h>
#include <LibGfx/StylePainter.h>
#include <LibGUI/Painter.h>
-#include <LibHTML/Layout/LayoutImage.h>
+#include <LibWeb/Layout/LayoutImage.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutImage.h b/Libraries/LibWeb/Layout/LayoutImage.h
similarity index 96%
rename from Libraries/LibHTML/Layout/LayoutImage.h
rename to Libraries/LibWeb/Layout/LayoutImage.h
index 54246466d967..526d4832fce8 100644
--- a/Libraries/LibHTML/Layout/LayoutImage.h
+++ b/Libraries/LibWeb/Layout/LayoutImage.h
@@ -26,8 +26,8 @@
#pragma once
-#include <LibHTML/DOM/HTMLImageElement.h>
-#include <LibHTML/Layout/LayoutReplaced.h>
+#include <LibWeb/DOM/HTMLImageElement.h>
+#include <LibWeb/Layout/LayoutReplaced.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutInline.cpp b/Libraries/LibWeb/Layout/LayoutInline.cpp
similarity index 93%
rename from Libraries/LibHTML/Layout/LayoutInline.cpp
rename to Libraries/LibWeb/Layout/LayoutInline.cpp
index 2ba96ff60e7b..80faba75f1ad 100644
--- a/Libraries/LibHTML/Layout/LayoutInline.cpp
+++ b/Libraries/LibWeb/Layout/LayoutInline.cpp
@@ -24,9 +24,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutInline.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutInline.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutInline.h b/Libraries/LibWeb/Layout/LayoutInline.h
similarity index 97%
rename from Libraries/LibHTML/Layout/LayoutInline.h
rename to Libraries/LibWeb/Layout/LayoutInline.h
index cd962a41cb61..430e1bddd449 100644
--- a/Libraries/LibHTML/Layout/LayoutInline.h
+++ b/Libraries/LibWeb/Layout/LayoutInline.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/Layout/LayoutBox.h>
+#include <LibWeb/Layout/LayoutBox.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutListItem.cpp b/Libraries/LibWeb/Layout/LayoutListItem.cpp
similarity index 95%
rename from Libraries/LibHTML/Layout/LayoutListItem.cpp
rename to Libraries/LibWeb/Layout/LayoutListItem.cpp
index 322bf7b6e364..0be7366b7436 100644
--- a/Libraries/LibHTML/Layout/LayoutListItem.cpp
+++ b/Libraries/LibWeb/Layout/LayoutListItem.cpp
@@ -24,8 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/Layout/LayoutListItem.h>
-#include <LibHTML/Layout/LayoutListItemMarker.h>
+#include <LibWeb/Layout/LayoutListItem.h>
+#include <LibWeb/Layout/LayoutListItemMarker.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutListItem.h b/Libraries/LibWeb/Layout/LayoutListItem.h
similarity index 96%
rename from Libraries/LibHTML/Layout/LayoutListItem.h
rename to Libraries/LibWeb/Layout/LayoutListItem.h
index 0b4414b496c1..7c3987570c83 100644
--- a/Libraries/LibHTML/Layout/LayoutListItem.h
+++ b/Libraries/LibWeb/Layout/LayoutListItem.h
@@ -26,8 +26,8 @@
#pragma once
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Layout/LayoutBlock.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Layout/LayoutBlock.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutListItemMarker.cpp b/Libraries/LibWeb/Layout/LayoutListItemMarker.cpp
similarity index 97%
rename from Libraries/LibHTML/Layout/LayoutListItemMarker.cpp
rename to Libraries/LibWeb/Layout/LayoutListItemMarker.cpp
index d30f43bf6faa..2188ce44aa43 100644
--- a/Libraries/LibHTML/Layout/LayoutListItemMarker.cpp
+++ b/Libraries/LibWeb/Layout/LayoutListItemMarker.cpp
@@ -25,7 +25,7 @@
*/
#include <LibGUI/Painter.h>
-#include <LibHTML/Layout/LayoutListItemMarker.h>
+#include <LibWeb/Layout/LayoutListItemMarker.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutListItemMarker.h b/Libraries/LibWeb/Layout/LayoutListItemMarker.h
similarity index 97%
rename from Libraries/LibHTML/Layout/LayoutListItemMarker.h
rename to Libraries/LibWeb/Layout/LayoutListItemMarker.h
index c36baaf1f494..d2fefaa4c045 100644
--- a/Libraries/LibHTML/Layout/LayoutListItemMarker.h
+++ b/Libraries/LibWeb/Layout/LayoutListItemMarker.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/Layout/LayoutBox.h>
+#include <LibWeb/Layout/LayoutBox.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutNode.cpp b/Libraries/LibWeb/Layout/LayoutNode.cpp
similarity index 96%
rename from Libraries/LibHTML/Layout/LayoutNode.cpp
rename to Libraries/LibWeb/Layout/LayoutNode.cpp
index fd0c78864269..5fd339c29179 100644
--- a/Libraries/LibHTML/Layout/LayoutNode.cpp
+++ b/Libraries/LibWeb/Layout/LayoutNode.cpp
@@ -25,11 +25,11 @@
*/
#include <LibGUI/Painter.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Frame.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutNode.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Frame.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutNode.h b/Libraries/LibWeb/Layout/LayoutNode.h
similarity index 97%
rename from Libraries/LibHTML/Layout/LayoutNode.h
rename to Libraries/LibWeb/Layout/LayoutNode.h
index ebb74e6deaa5..9d4f0a05c7a1 100644
--- a/Libraries/LibHTML/Layout/LayoutNode.h
+++ b/Libraries/LibWeb/Layout/LayoutNode.h
@@ -30,11 +30,11 @@
#include <AK/Vector.h>
#include <LibGfx/FloatRect.h>
#include <LibGfx/Rect.h>
-#include <LibHTML/CSS/StyleProperties.h>
-#include <LibHTML/Layout/BoxModelMetrics.h>
-#include <LibHTML/Layout/LayoutPosition.h>
-#include <LibHTML/RenderingContext.h>
-#include <LibHTML/TreeNode.h>
+#include <LibWeb/CSS/StyleProperties.h>
+#include <LibWeb/Layout/BoxModelMetrics.h>
+#include <LibWeb/Layout/LayoutPosition.h>
+#include <LibWeb/RenderingContext.h>
+#include <LibWeb/TreeNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutPosition.h b/Libraries/LibWeb/Layout/LayoutPosition.h
similarity index 100%
rename from Libraries/LibHTML/Layout/LayoutPosition.h
rename to Libraries/LibWeb/Layout/LayoutPosition.h
diff --git a/Libraries/LibHTML/Layout/LayoutReplaced.cpp b/Libraries/LibWeb/Layout/LayoutReplaced.cpp
similarity index 94%
rename from Libraries/LibHTML/Layout/LayoutReplaced.cpp
rename to Libraries/LibWeb/Layout/LayoutReplaced.cpp
index b60d2a28883d..e98316ea7376 100644
--- a/Libraries/LibHTML/Layout/LayoutReplaced.cpp
+++ b/Libraries/LibWeb/Layout/LayoutReplaced.cpp
@@ -24,9 +24,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutReplaced.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutReplaced.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutReplaced.h b/Libraries/LibWeb/Layout/LayoutReplaced.h
similarity index 96%
rename from Libraries/LibHTML/Layout/LayoutReplaced.h
rename to Libraries/LibWeb/Layout/LayoutReplaced.h
index c48dfbaec187..d19c4e891a6d 100644
--- a/Libraries/LibHTML/Layout/LayoutReplaced.h
+++ b/Libraries/LibWeb/Layout/LayoutReplaced.h
@@ -24,8 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Layout/LayoutBox.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Layout/LayoutBox.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutTable.cpp b/Libraries/LibWeb/Layout/LayoutTable.cpp
similarity index 94%
rename from Libraries/LibHTML/Layout/LayoutTable.cpp
rename to Libraries/LibWeb/Layout/LayoutTable.cpp
index 17f00bb21fa4..782e27e76dd5 100644
--- a/Libraries/LibHTML/Layout/LayoutTable.cpp
+++ b/Libraries/LibWeb/Layout/LayoutTable.cpp
@@ -24,9 +24,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Layout/LayoutTable.h>
-#include <LibHTML/Layout/LayoutTableRow.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Layout/LayoutTable.h>
+#include <LibWeb/Layout/LayoutTableRow.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutTable.h b/Libraries/LibWeb/Layout/LayoutTable.h
similarity index 98%
rename from Libraries/LibHTML/Layout/LayoutTable.h
rename to Libraries/LibWeb/Layout/LayoutTable.h
index 738343449cf5..5166fc2a9408 100644
--- a/Libraries/LibHTML/Layout/LayoutTable.h
+++ b/Libraries/LibWeb/Layout/LayoutTable.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutBlock.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutTableCell.cpp b/Libraries/LibWeb/Layout/LayoutTableCell.cpp
similarity index 95%
rename from Libraries/LibHTML/Layout/LayoutTableCell.cpp
rename to Libraries/LibWeb/Layout/LayoutTableCell.cpp
index cf7f18078a8a..7ff80f38b5cd 100644
--- a/Libraries/LibHTML/Layout/LayoutTableCell.cpp
+++ b/Libraries/LibWeb/Layout/LayoutTableCell.cpp
@@ -24,8 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Layout/LayoutTableCell.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Layout/LayoutTableCell.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutTableCell.h b/Libraries/LibWeb/Layout/LayoutTableCell.h
similarity index 98%
rename from Libraries/LibHTML/Layout/LayoutTableCell.h
rename to Libraries/LibWeb/Layout/LayoutTableCell.h
index 329d68874d26..456ec8a08d9e 100644
--- a/Libraries/LibHTML/Layout/LayoutTableCell.h
+++ b/Libraries/LibWeb/Layout/LayoutTableCell.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutBlock.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutTableRow.cpp b/Libraries/LibWeb/Layout/LayoutTableRow.cpp
similarity index 94%
rename from Libraries/LibHTML/Layout/LayoutTableRow.cpp
rename to Libraries/LibWeb/Layout/LayoutTableRow.cpp
index effd6eebb66c..d8dc1f441c1a 100644
--- a/Libraries/LibHTML/Layout/LayoutTableRow.cpp
+++ b/Libraries/LibWeb/Layout/LayoutTableRow.cpp
@@ -24,9 +24,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Layout/LayoutTableCell.h>
-#include <LibHTML/Layout/LayoutTableRow.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Layout/LayoutTableCell.h>
+#include <LibWeb/Layout/LayoutTableRow.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutTableRow.h b/Libraries/LibWeb/Layout/LayoutTableRow.h
similarity index 98%
rename from Libraries/LibHTML/Layout/LayoutTableRow.h
rename to Libraries/LibWeb/Layout/LayoutTableRow.h
index fc6c7ad93c51..c77265fce847 100644
--- a/Libraries/LibHTML/Layout/LayoutTableRow.h
+++ b/Libraries/LibWeb/Layout/LayoutTableRow.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/Layout/LayoutBox.h>
+#include <LibWeb/Layout/LayoutBox.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutText.cpp b/Libraries/LibWeb/Layout/LayoutText.cpp
similarity index 98%
rename from Libraries/LibHTML/Layout/LayoutText.cpp
rename to Libraries/LibWeb/Layout/LayoutText.cpp
index 6b2acd7373a8..9103230cc593 100644
--- a/Libraries/LibHTML/Layout/LayoutText.cpp
+++ b/Libraries/LibWeb/Layout/LayoutText.cpp
@@ -29,9 +29,9 @@
#include <LibCore/DirIterator.h>
#include <LibGfx/Font.h>
#include <LibGUI/Painter.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutText.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutText.h>
#include <ctype.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutText.h b/Libraries/LibWeb/Layout/LayoutText.h
similarity index 97%
rename from Libraries/LibHTML/Layout/LayoutText.h
rename to Libraries/LibWeb/Layout/LayoutText.h
index a8e4e47776bf..324421ef40e5 100644
--- a/Libraries/LibHTML/Layout/LayoutText.h
+++ b/Libraries/LibWeb/Layout/LayoutText.h
@@ -26,8 +26,8 @@
#pragma once
-#include <LibHTML/DOM/Text.h>
-#include <LibHTML/Layout/LayoutNode.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/Layout/LayoutNode.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutTreeBuilder.cpp b/Libraries/LibWeb/Layout/LayoutTreeBuilder.cpp
similarity index 93%
rename from Libraries/LibHTML/Layout/LayoutTreeBuilder.cpp
rename to Libraries/LibWeb/Layout/LayoutTreeBuilder.cpp
index 436399f5102d..5474f95ddd9f 100644
--- a/Libraries/LibHTML/Layout/LayoutTreeBuilder.cpp
+++ b/Libraries/LibWeb/Layout/LayoutTreeBuilder.cpp
@@ -24,12 +24,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/DOM/ParentNode.h>
-#include <LibHTML/Layout/LayoutNode.h>
-#include <LibHTML/Layout/LayoutTable.h>
-#include <LibHTML/Layout/LayoutText.h>
-#include <LibHTML/Layout/LayoutTreeBuilder.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/ParentNode.h>
+#include <LibWeb/Layout/LayoutNode.h>
+#include <LibWeb/Layout/LayoutTable.h>
+#include <LibWeb/Layout/LayoutText.h>
+#include <LibWeb/Layout/LayoutTreeBuilder.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutTreeBuilder.h b/Libraries/LibWeb/Layout/LayoutTreeBuilder.h
similarity index 100%
rename from Libraries/LibHTML/Layout/LayoutTreeBuilder.h
rename to Libraries/LibWeb/Layout/LayoutTreeBuilder.h
diff --git a/Libraries/LibHTML/Layout/LayoutWidget.cpp b/Libraries/LibWeb/Layout/LayoutWidget.cpp
similarity index 98%
rename from Libraries/LibHTML/Layout/LayoutWidget.cpp
rename to Libraries/LibWeb/Layout/LayoutWidget.cpp
index f748fdfda7ec..b4f80290eac5 100644
--- a/Libraries/LibHTML/Layout/LayoutWidget.cpp
+++ b/Libraries/LibWeb/Layout/LayoutWidget.cpp
@@ -28,7 +28,7 @@
#include <LibGfx/StylePainter.h>
#include <LibGUI/Painter.h>
#include <LibGUI/Widget.h>
-#include <LibHTML/Layout/LayoutWidget.h>
+#include <LibWeb/Layout/LayoutWidget.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LayoutWidget.h b/Libraries/LibWeb/Layout/LayoutWidget.h
similarity index 97%
rename from Libraries/LibHTML/Layout/LayoutWidget.h
rename to Libraries/LibWeb/Layout/LayoutWidget.h
index 7a8c9efe1827..ab24c8dafcd4 100644
--- a/Libraries/LibHTML/Layout/LayoutWidget.h
+++ b/Libraries/LibWeb/Layout/LayoutWidget.h
@@ -26,7 +26,7 @@
#pragma once
-#include <LibHTML/Layout/LayoutReplaced.h>
+#include <LibWeb/Layout/LayoutReplaced.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LineBox.cpp b/Libraries/LibWeb/Layout/LineBox.cpp
similarity index 96%
rename from Libraries/LibHTML/Layout/LineBox.cpp
rename to Libraries/LibWeb/Layout/LineBox.cpp
index c71ced5b2e57..be73e3c5c5c0 100644
--- a/Libraries/LibHTML/Layout/LineBox.cpp
+++ b/Libraries/LibWeb/Layout/LineBox.cpp
@@ -25,9 +25,9 @@
*/
#include <AK/Utf8View.h>
-#include <LibHTML/Layout/LayoutNode.h>
-#include <LibHTML/Layout/LayoutText.h>
-#include <LibHTML/Layout/LineBox.h>
+#include <LibWeb/Layout/LayoutNode.h>
+#include <LibWeb/Layout/LayoutText.h>
+#include <LibWeb/Layout/LineBox.h>
#include <ctype.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LineBox.h b/Libraries/LibWeb/Layout/LineBox.h
similarity index 97%
rename from Libraries/LibHTML/Layout/LineBox.h
rename to Libraries/LibWeb/Layout/LineBox.h
index b7ea2ac33183..e5322c0e153c 100644
--- a/Libraries/LibHTML/Layout/LineBox.h
+++ b/Libraries/LibWeb/Layout/LineBox.h
@@ -27,7 +27,7 @@
#pragma once
#include <AK/Vector.h>
-#include <LibHTML/Layout/LineBoxFragment.h>
+#include <LibWeb/Layout/LineBoxFragment.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LineBoxFragment.cpp b/Libraries/LibWeb/Layout/LineBoxFragment.cpp
similarity index 94%
rename from Libraries/LibHTML/Layout/LineBoxFragment.cpp
rename to Libraries/LibWeb/Layout/LineBoxFragment.cpp
index 1491e1db7545..2d7a60c91798 100644
--- a/Libraries/LibHTML/Layout/LineBoxFragment.cpp
+++ b/Libraries/LibWeb/Layout/LineBoxFragment.cpp
@@ -26,10 +26,10 @@
#include <AK/Utf8View.h>
#include <LibGUI/Painter.h>
-#include <LibHTML/Layout/LayoutDocument.h>
-#include <LibHTML/Layout/LayoutText.h>
-#include <LibHTML/Layout/LineBoxFragment.h>
-#include <LibHTML/RenderingContext.h>
+#include <LibWeb/Layout/LayoutDocument.h>
+#include <LibWeb/Layout/LayoutText.h>
+#include <LibWeb/Layout/LineBoxFragment.h>
+#include <LibWeb/RenderingContext.h>
namespace Web {
diff --git a/Libraries/LibHTML/Layout/LineBoxFragment.h b/Libraries/LibWeb/Layout/LineBoxFragment.h
similarity index 100%
rename from Libraries/LibHTML/Layout/LineBoxFragment.h
rename to Libraries/LibWeb/Layout/LineBoxFragment.h
diff --git a/Libraries/LibHTML/Makefile b/Libraries/LibWeb/Makefile
similarity index 93%
rename from Libraries/LibHTML/Makefile
rename to Libraries/LibWeb/Makefile
index 5c421edf70e3..40d6899fbd32 100644
--- a/Libraries/LibHTML/Makefile
+++ b/Libraries/LibWeb/Makefile
@@ -1,4 +1,4 @@
-LIBHTML_OBJS = \
+LIBWEB_OBJS = \
CSS/DefaultStyleSheetSource.o \
CSS/PropertyID.o \
CSS/Selector.o \
@@ -95,14 +95,14 @@ ResourceLoader.cpp: ../../Servers/ProtocolServer/ProtocolClientEndpoint.h ../../
EXTRA_CLEAN = CSS/DefaultStyleSheetSource.cpp CSS/PropertyID.h CSS/PropertyID.cpp
-OBJS = $(EXTRA_OBJS) $(LIBHTML_OBJS)
+OBJS = $(EXTRA_OBJS) $(LIBWEB_OBJS)
-LIBRARY = libhtml.a
+LIBRARY = libweb.a
install:
for dir in . Parser DOM CSS Layout; do \
- mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibHTML/$$dir; \
- cp $$dir/*.h $(SERENITY_BASE_DIR)/Root/usr/include/LibHTML/$$dir/; \
+ mkdir -p $(SERENITY_BASE_DIR)/Root/usr/include/LibWeb/$$dir; \
+ cp $$dir/*.h $(SERENITY_BASE_DIR)/Root/usr/include/LibWeb/$$dir/; \
done
cp $(LIBRARY) $(SERENITY_BASE_DIR)/Root/usr/lib/
diff --git a/Libraries/LibHTML/Parser/CSSParser.cpp b/Libraries/LibWeb/Parser/CSSParser.cpp
similarity index 99%
rename from Libraries/LibHTML/Parser/CSSParser.cpp
rename to Libraries/LibWeb/Parser/CSSParser.cpp
index d670cf3c1d03..e40618f11647 100644
--- a/Libraries/LibHTML/Parser/CSSParser.cpp
+++ b/Libraries/LibWeb/Parser/CSSParser.cpp
@@ -25,9 +25,9 @@
*/
#include <AK/HashMap.h>
-#include <LibHTML/CSS/PropertyID.h>
-#include <LibHTML/CSS/StyleSheet.h>
-#include <LibHTML/Parser/CSSParser.h>
+#include <LibWeb/CSS/PropertyID.h>
+#include <LibWeb/CSS/StyleSheet.h>
+#include <LibWeb/Parser/CSSParser.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/Libraries/LibHTML/Parser/CSSParser.h b/Libraries/LibWeb/Parser/CSSParser.h
similarity index 97%
rename from Libraries/LibHTML/Parser/CSSParser.h
rename to Libraries/LibWeb/Parser/CSSParser.h
index 260a9c372f8f..287c2931e069 100644
--- a/Libraries/LibHTML/Parser/CSSParser.h
+++ b/Libraries/LibWeb/Parser/CSSParser.h
@@ -27,7 +27,7 @@
#pragma once
#include <AK/NonnullRefPtr.h>
-#include <LibHTML/CSS/StyleSheet.h>
+#include <LibWeb/CSS/StyleSheet.h>
namespace Web {
diff --git a/Libraries/LibHTML/Parser/HTMLParser.cpp b/Libraries/LibWeb/Parser/HTMLParser.cpp
similarity index 97%
rename from Libraries/LibHTML/Parser/HTMLParser.cpp
rename to Libraries/LibWeb/Parser/HTMLParser.cpp
index 6f24a5277a91..f94edd833f29 100644
--- a/Libraries/LibHTML/Parser/HTMLParser.cpp
+++ b/Libraries/LibWeb/Parser/HTMLParser.cpp
@@ -27,13 +27,13 @@
#include <AK/Function.h>
#include <AK/NonnullRefPtrVector.h>
#include <AK/StringBuilder.h>
-#include <LibHTML/DOM/Comment.h>
-#include <LibHTML/DOM/DocumentFragment.h>
-#include <LibHTML/DOM/DocumentType.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/DOM/ElementFactory.h>
-#include <LibHTML/DOM/Text.h>
-#include <LibHTML/Parser/HTMLParser.h>
+#include <LibWeb/DOM/Comment.h>
+#include <LibWeb/DOM/DocumentFragment.h>
+#include <LibWeb/DOM/DocumentType.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/DOM/ElementFactory.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/Parser/HTMLParser.h>
#include <ctype.h>
#include <stdio.h>
diff --git a/Libraries/LibHTML/Parser/HTMLParser.h b/Libraries/LibWeb/Parser/HTMLParser.h
similarity index 97%
rename from Libraries/LibHTML/Parser/HTMLParser.h
rename to Libraries/LibWeb/Parser/HTMLParser.h
index a3077f14cf97..60d234f87c1f 100644
--- a/Libraries/LibHTML/Parser/HTMLParser.h
+++ b/Libraries/LibWeb/Parser/HTMLParser.h
@@ -27,7 +27,7 @@
#pragma once
#include <AK/NonnullRefPtr.h>
-#include <LibHTML/DOM/Document.h>
+#include <LibWeb/DOM/Document.h>
namespace Web {
diff --git a/Libraries/LibHTML/RenderingContext.h b/Libraries/LibWeb/RenderingContext.h
similarity index 100%
rename from Libraries/LibHTML/RenderingContext.h
rename to Libraries/LibWeb/RenderingContext.h
diff --git a/Libraries/LibHTML/ResourceLoader.cpp b/Libraries/LibWeb/ResourceLoader.cpp
similarity index 98%
rename from Libraries/LibHTML/ResourceLoader.cpp
rename to Libraries/LibWeb/ResourceLoader.cpp
index 9e23aa6a32fb..ac11e40da019 100644
--- a/Libraries/LibHTML/ResourceLoader.cpp
+++ b/Libraries/LibWeb/ResourceLoader.cpp
@@ -26,7 +26,7 @@
#include <AK/SharedBuffer.h>
#include <LibCore/File.h>
-#include <LibHTML/ResourceLoader.h>
+#include <LibWeb/ResourceLoader.h>
#include <LibProtocol/Client.h>
#include <LibProtocol/Download.h>
diff --git a/Libraries/LibHTML/ResourceLoader.h b/Libraries/LibWeb/ResourceLoader.h
similarity index 100%
rename from Libraries/LibHTML/ResourceLoader.h
rename to Libraries/LibWeb/ResourceLoader.h
diff --git a/Libraries/LibHTML/Scripts/GenerateStyleSheetSource.sh b/Libraries/LibWeb/Scripts/GenerateStyleSheetSource.sh
similarity index 100%
rename from Libraries/LibHTML/Scripts/GenerateStyleSheetSource.sh
rename to Libraries/LibWeb/Scripts/GenerateStyleSheetSource.sh
diff --git a/Libraries/LibHTML/StylePropertiesModel.cpp b/Libraries/LibWeb/StylePropertiesModel.cpp
similarity index 95%
rename from Libraries/LibHTML/StylePropertiesModel.cpp
rename to Libraries/LibWeb/StylePropertiesModel.cpp
index 0bf7152be97c..5df5df30c4f7 100644
--- a/Libraries/LibHTML/StylePropertiesModel.cpp
+++ b/Libraries/LibWeb/StylePropertiesModel.cpp
@@ -25,9 +25,9 @@
*/
#include "StylePropertiesModel.h"
-#include <LibHTML/CSS/PropertyID.h>
-#include <LibHTML/DOM/Document.h>
-#include <LibHTML/CSS/StyleProperties.h>
+#include <LibWeb/CSS/PropertyID.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/CSS/StyleProperties.h>
namespace Web {
diff --git a/Libraries/LibHTML/StylePropertiesModel.h b/Libraries/LibWeb/StylePropertiesModel.h
similarity index 100%
rename from Libraries/LibHTML/StylePropertiesModel.h
rename to Libraries/LibWeb/StylePropertiesModel.h
diff --git a/Libraries/LibHTML/TreeNode.h b/Libraries/LibWeb/TreeNode.h
similarity index 100%
rename from Libraries/LibHTML/TreeNode.h
rename to Libraries/LibWeb/TreeNode.h
diff --git a/ReadMe.md b/ReadMe.md
index fa42afca65f7..b7d914ad2375 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -49,7 +49,7 @@ I'm also on [Patreon](https://www.patreon.com/serenityos) and [GitHub Sponsors](
* 2D graphics library (LibGfx)
* GUI toolkit (LibGUI)
* Cross-process communication library (LibIPC)
-* HTML/CSS engine (LibHTML)
+* HTML/CSS engine (LibWeb)
* Markdown (LibMarkdown)
* Audio (LibAudio)
* PCI database (LibPCIDB)
diff --git a/Userland/Makefile b/Userland/Makefile
index 717c41425b45..8b60b9693ade 100644
--- a/Userland/Makefile
+++ b/Userland/Makefile
@@ -4,7 +4,7 @@ APPS = ${SRCS:.cpp=}
EXTRA_CLEAN = $(APPS)
-LIB_DEPS = HTML GUI Gfx Audio Protocol IPC Thread Pthread Core PCIDB Markdown
+LIB_DEPS = Web GUI Gfx Audio Protocol IPC Thread Pthread Core PCIDB Markdown
include ../Makefile.common
diff --git a/Userland/html.cpp b/Userland/html.cpp
index 71f1c7fc997a..9af204fbaa31 100644
--- a/Userland/html.cpp
+++ b/Userland/html.cpp
@@ -32,15 +32,15 @@
#include <LibGUI/Menu.h>
#include <LibGUI/MenuBar.h>
#include <LibGUI/Window.h>
-#include <LibHTML/CSS/StyleResolver.h>
-#include <LibHTML/DOM/Element.h>
-#include <LibHTML/Dump.h>
-#include <LibHTML/HtmlView.h>
-#include <LibHTML/Layout/LayoutBlock.h>
-#include <LibHTML/Layout/LayoutInline.h>
-#include <LibHTML/Layout/LayoutNode.h>
-#include <LibHTML/Parser/CSSParser.h>
-#include <LibHTML/Parser/HTMLParser.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Dump.h>
+#include <LibWeb/HtmlView.h>
+#include <LibWeb/Layout/LayoutBlock.h>
+#include <LibWeb/Layout/LayoutInline.h>
+#include <LibWeb/Layout/LayoutNode.h>
+#include <LibWeb/Parser/CSSParser.h>
+#include <LibWeb/Parser/HTMLParser.h>
#include <stdio.h>
int main(int argc, char** argv)
|
185255efc3942b4d49de2faa59691bd9c10c144d
|
2024-11-05 23:28:34
|
Timothy Flynn
|
webcontent: Close top-level traversables asynchronously
| false
|
Close top-level traversables asynchronously
|
webcontent
|
diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp
index 6f1672e10c7f..13dfb9103b67 100644
--- a/Userland/Services/WebContent/WebDriverConnection.cpp
+++ b/Userland/Services/WebContent/WebDriverConnection.cpp
@@ -460,7 +460,13 @@ Messages::WebDriverClient::CloseWindowResponse WebDriverConnection::close_window
// 2. Handle any user prompts and return its value if it is an error.
handle_any_user_prompts([this]() {
// 3. Close the current top-level browsing context.
- current_top_level_browsing_context()->top_level_traversable()->close_top_level_traversable();
+ // FIXME: Spec issue: Closing browsing contexts is no longer a spec concept, we must instead close the top-level
+ // traversable. We must also do so asynchronously, as the implementation will spin the event loop in some
+ // steps. If a user dialog is open in another window within this agent, the event loop will be paused, and
+ // those spins will hang. So we must return control to the client, who can deal with the dialog.
+ Web::HTML::queue_a_task(Web::HTML::Task::Source::Unspecified, nullptr, nullptr, JS::create_heap_function(current_top_level_browsing_context()->heap(), [this]() {
+ current_top_level_browsing_context()->top_level_traversable()->close_top_level_traversable();
+ }));
async_driver_execution_complete(JsonValue {});
});
|
cbdb5f926c596efb013f6fa320f97be14fed6213
|
2023-05-06 12:31:26
|
Annie Song
|
documentation: Correct some typos found in kernel markdown files
| false
|
Correct some typos found in kernel markdown files
|
documentation
|
diff --git a/Documentation/Kernel/DevelopmentGuidelines.md b/Documentation/Kernel/DevelopmentGuidelines.md
index a330552cf837..b0af1e1102ce 100644
--- a/Documentation/Kernel/DevelopmentGuidelines.md
+++ b/Documentation/Kernel/DevelopmentGuidelines.md
@@ -32,7 +32,7 @@ so the userland program could know about the situation and act accordingly.
An exception to this is when there's simply no way to propagate the error code to the userland program.
Maybe it's a `ATAPort` (in the IDE ATA code) that asynchronously tries to handle reading data from the harddrive,
-but because of the async operation, we can't send the `errno` code back to userland, so we what we do is
+but because of the async operation, we can't send the `errno` code back to userland, so what we do is
to ensure that internal functions still use the `ErrorOr<>` return type, and in main calling function, we use
other meaningful infrastructure utilities in the Kernel to indicate that the operation failed.
diff --git a/Documentation/Kernel/GraphicsSubsystem.md b/Documentation/Kernel/GraphicsSubsystem.md
index e747e6bbde3f..60b5eec038d0 100644
--- a/Documentation/Kernel/GraphicsSubsystem.md
+++ b/Documentation/Kernel/GraphicsSubsystem.md
@@ -19,7 +19,7 @@ from the framebuffer.
# DisplayConnector Devices
The Display Connector devices are an abstraction layer to what is essentially the
-management layer of hardware display (commonly known as scanouts too) output connectors.
+management layer of hardware display (commonly known as scanouts) output connectors.
The idea of using such type of device was inspired by Linux, which has a struct called
`drm_connector` as a base structure for other derived structures in the various Linux DRM drivers.
diff --git a/Documentation/Kernel/ProcFSIndexing.md b/Documentation/Kernel/ProcFSIndexing.md
index 482de3ed79d4..9723a70910b3 100644
--- a/Documentation/Kernel/ProcFSIndexing.md
+++ b/Documentation/Kernel/ProcFSIndexing.md
@@ -7,7 +7,7 @@ each `InodeIndex` actually represent a known object, so it is guaranteed to be
the same always for global ProcFS objects. For process ID directories, once that
process has been killed, its primary segment value is no longer valid and hence
all sub-segments of it are not relevant anymore, but if the process is still alive,
-it is guaranteed that accessing the same `InodeIndex` in regard to a object tied to
+it is guaranteed that accessing the same `InodeIndex` in regard to an object tied to
a process directory will provide the expected object.
## The goal - zero allocations when creating new process
diff --git a/Documentation/Kernel/RAMFS.md b/Documentation/Kernel/RAMFS.md
index 2eaf6d932dfb..fe96b157cbb2 100644
--- a/Documentation/Kernel/RAMFS.md
+++ b/Documentation/Kernel/RAMFS.md
@@ -20,7 +20,7 @@ with very small overhead until actual IO is performed.
Currently, the `/tmp` directory is the **place** for facilitating the inter-process
communication layer, with many Unix sockets nodes being present in the directory.
-Many test suites in the project leverage the `/tmp` for placing their test files
+Many test suites in the project leverage `/tmp` for placing their test files
when trying to check the correctness of many system-related functionality.
Other programs rely on `/tmp` for placing their temporary files to properly function.
|
c8da8808067d6020a8d43143d421dbfe240fe344
|
2023-07-25 16:13:50
|
Shannon Booth
|
ak: Add spec comments to URL::serialize
| false
|
Add spec comments to URL::serialize
|
ak
|
diff --git a/AK/URL.cpp b/AK/URL.cpp
index da5b5eee3308..0e591aff8830 100644
--- a/AK/URL.cpp
+++ b/AK/URL.cpp
@@ -299,49 +299,68 @@ DeprecatedString URL::serialize(ExcludeFragment exclude_fragment) const
{
if (m_scheme == "data")
return serialize_data_url();
- StringBuilder builder;
- builder.append(m_scheme);
- builder.append(':');
+ // 1. Let output be url’s scheme and U+003A (:) concatenated.
+ StringBuilder output;
+ output.append(m_scheme);
+ output.append(':');
+
+ // 2. If url’s host is non-null:
if (!m_host.is_null()) {
- builder.append("//"sv);
+ // 1. Append "//" to output.
+ output.append("//"sv);
+ // 2. If url includes credentials, then:
if (includes_credentials()) {
- builder.append(m_username);
+ // 1. Append url’s username to output.
+ output.append(m_username);
+
+ // 2. If url’s password is not the empty string, then append U+003A (:), followed by url’s password, to output.
if (!m_password.is_empty()) {
- builder.append(':');
- builder.append(m_password);
+ output.append(':');
+ output.append(m_password);
}
- builder.append('@');
+
+ // 3. Append U+0040 (@) to output.
+ output.append('@');
}
- builder.append(m_host);
+ // 3. Append url’s host, serialized, to output.
+ output.append(m_host);
+
+ // 4. If url’s port is non-null, append U+003A (:) followed by url’s port, serialized, to output.
if (m_port.has_value())
- builder.appendff(":{}", *m_port);
+ output.appendff(":{}", *m_port);
}
+ // 3. If url’s host is null, url does not have an opaque path, url’s path’s size is greater than 1, and url’s path[0] is the empty string, then append U+002F (/) followed by U+002E (.) to output.
+ // 4. Append the result of URL path serializing url to output.
+ // FIXME: Implement this closer to spec steps.
if (cannot_be_a_base_url()) {
- builder.append(m_paths[0]);
+ output.append(m_paths[0]);
} else {
if (m_host.is_null() && m_paths.size() > 1 && m_paths[0].is_empty())
- builder.append("/."sv);
+ output.append("/."sv);
for (auto& segment : m_paths) {
- builder.append('/');
- builder.append(segment);
+ output.append('/');
+ output.append(segment);
}
}
+ // 5. If url’s query is non-null, append U+003F (?), followed by url’s query, to output.
if (!m_query.is_null()) {
- builder.append('?');
- builder.append(m_query);
+ output.append('?');
+ output.append(m_query);
}
+ // 6. If exclude fragment is false and url’s fragment is non-null, then append U+0023 (#), followed by url’s fragment, to output.
if (exclude_fragment == ExcludeFragment::No && !m_fragment.is_null()) {
- builder.append('#');
- builder.append(m_fragment);
+ output.append('#');
+ output.append(m_fragment);
}
- return builder.to_deprecated_string();
+ // 7. Return output.
+ return output.to_deprecated_string();
}
// https://url.spec.whatwg.org/#url-rendering
|
518b8fb29255a3ebdeb361ce3df6519b24c44103
|
2021-10-25 16:31:40
|
Brendan Coles
|
ports: Bump bc from version 2.5.1 to 5.1.1
| false
|
Bump bc from version 2.5.1 to 5.1.1
|
ports
|
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md
index 3ed6887c57fc..539f897a608b 100644
--- a/Ports/AvailablePorts.md
+++ b/Ports/AvailablePorts.md
@@ -8,7 +8,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`angband`](angband/) | Angband | 4.2.3 | https://rephial.org |
| [`bash`](bash/) | GNU Bash | 5.1.8 | https://www.gnu.org/software/bash/ |
| [`bass`](bass/) | Beneath a Steel Sky | cd-1.2 | https://www.scummvm.org/games |
-| [`bc`](bc/) | bc | 2.5.1 | https://github.com/gavinhoward/bc |
+| [`bc`](bc/) | bc | 5.1.1 | https://github.com/gavinhoward/bc |
| [`binutils`](binutils/) | GNU Binutils | 2.37 | https://www.gnu.org/software/binutils/ |
| [`bison`](bison/) | GNU Bison | 1.25 | https://www.gnu.org/software/bison/ |
| [`brogue`](brogue/) | BrogueCE | 1.9.3 | https://github.com/tmewett/BrogueCE |
diff --git a/Ports/bc/package.sh b/Ports/bc/package.sh
index b1809718a53e..4c7f5c8fe2c8 100755
--- a/Ports/bc/package.sh
+++ b/Ports/bc/package.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=bc
-version=2.5.1
+version=5.1.1
files="https://github.com/gavinhoward/bc/releases/download/${version}/bc-${version}.tar.xz bc-${version}.tar.xz
https://github.com/gavinhoward/bc/releases/download/${version}/bc-${version}.tar.xz.sig bc-${version}.tar.xz.sig"
useconfigure=true
@@ -8,9 +8,8 @@ configscript=configure.sh
auth_type="sig"
auth_import_key="E2A30324A4465A4D5882692EC08038BDF280D33E"
auth_opts=("bc-${version}.tar.xz.sig")
+configopts=("--prefix=/usr/local" "--disable-nls" "--disable-history")
configure() {
- # NLS needs many things, none of which we support.
- # History needs FIONREAD ioctl, which we don't support yet.
- run env HOSTCC=gcc ./"$configscript" --disable-nls --disable-history
+ run env HOSTCC=gcc ./"$configscript" "${configopts[@]}"
}
diff --git a/Ports/bc/patches/fix-args.patch b/Ports/bc/patches/fix-args.patch
deleted file mode 100644
index f951d462ff9f..000000000000
--- a/Ports/bc/patches/fix-args.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- bc-2.5.1/include/args.h.orig Fri Jan 24 19:27:06 2020
-+++ bc-2.5.1/include/args.h Fri Jan 24 19:27:14 2020
-@@ -36,6 +36,8 @@
- #ifndef BC_ARGS_H
- #define BC_ARGS_H
-
-+#include <getopt.h>
-+
- #include <status.h>
- #include <vm.h>
-
|
7eeecbc0f3c7f27f559cfc968a7973f42316c3b9
|
2020-08-21 22:28:21
|
Andreas Kling
|
libweb: InProcessWebView::selected_text() should use the focused frame
| false
|
InProcessWebView::selected_text() should use the focused frame
|
libweb
|
diff --git a/Libraries/LibWeb/InProcessWebView.cpp b/Libraries/LibWeb/InProcessWebView.cpp
index 175abb5b6a01..8b9c149b5d8c 100644
--- a/Libraries/LibWeb/InProcessWebView.cpp
+++ b/Libraries/LibWeb/InProcessWebView.cpp
@@ -115,8 +115,7 @@ void InProcessWebView::select_all()
String InProcessWebView::selected_text() const
{
- // FIXME: Use focused frame
- return page().main_frame().selected_text();
+ return page().focused_frame().selected_text();
}
void InProcessWebView::page_did_layout()
|
767d632ab7ef601298dba98f89c3a56bf92017e8
|
2022-11-03 03:12:48
|
Andreas Kling
|
libweb: Don't panic on unsupported text-decoration-line values
| false
|
Don't panic on unsupported text-decoration-line values
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index 58bb482f931e..0af11f79e567 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -608,7 +608,8 @@ Vector<CSS::TextDecorationLine> StyleProperties::text_decoration_line() const
if (value->is_identifier() && value->to_identifier() == ValueID::None)
return {};
- VERIFY_NOT_REACHED();
+ dbgln("FIXME: Unsupported value for text-decoration-line: {}", value->to_string());
+ return {};
}
Optional<CSS::TextDecorationStyle> StyleProperties::text_decoration_style() const
|
da7b21dc06d733c30eb9912b9b64e82b02f31671
|
2021-01-31 19:50:18
|
Andreas Kling
|
kernel: Don't clone kernel mappings for bottom 2 MiB VM into processes
| false
|
Don't clone kernel mappings for bottom 2 MiB VM into processes
|
kernel
|
diff --git a/Kernel/VM/PageDirectory.cpp b/Kernel/VM/PageDirectory.cpp
index 939853810f0b..0a02e7232b37 100644
--- a/Kernel/VM/PageDirectory.cpp
+++ b/Kernel/VM/PageDirectory.cpp
@@ -135,13 +135,6 @@ PageDirectory::PageDirectory(Process& process, const RangeAllocator* parent_rang
MM.unquickmap_page();
}
- // Clone bottom 2 MiB of mappings from kernel_page_directory
- PageDirectoryEntry buffer;
- auto* kernel_pd = MM.quickmap_pd(MM.kernel_page_directory(), 0);
- memcpy(&buffer, kernel_pd, sizeof(PageDirectoryEntry));
- auto* new_pd = MM.quickmap_pd(*this, 0);
- memcpy(new_pd, &buffer, sizeof(PageDirectoryEntry));
-
// If we got here, we successfully created it. Set m_process now
m_process = &process;
|
e9dfa615888d2623435449c009c07f1525962b14
|
2024-01-04 14:40:44
|
Shannon Booth
|
libweb: Use UTF-16 code unit offsets in Range::to_string
| false
|
Use UTF-16 code unit offsets in Range::to_string
|
libweb
|
diff --git a/Tests/LibWeb/Text/expected/DOM/Range-to-string.txt b/Tests/LibWeb/Text/expected/DOM/Range-to-string.txt
new file mode 100644
index 000000000000..eb90804337dc
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/DOM/Range-to-string.txt
@@ -0,0 +1,2 @@
+Hello💨😮 World
+llo💨😮 Wo
diff --git a/Tests/LibWeb/Text/input/DOM/Range-to-string.html b/Tests/LibWeb/Text/input/DOM/Range-to-string.html
new file mode 100644
index 000000000000..5583df7c1006
--- /dev/null
+++ b/Tests/LibWeb/Text/input/DOM/Range-to-string.html
@@ -0,0 +1,14 @@
+<body><p id="p1"><b>Hello💨</b>😮 World</p>
+<script src="../include.js"></script>
+<script>
+ test(() => {
+ const p1 = document.getElementById("p1");
+ const hello = p1.firstChild.firstChild;
+ const world = p1.lastChild;
+ const range = document.createRange();
+ range.setStart(hello, 2);
+ range.setEnd(world, 5);
+ println('');
+ println(range.toString());
+ });
+</script>
diff --git a/Userland/Libraries/LibWeb/DOM/Range.cpp b/Userland/Libraries/LibWeb/DOM/Range.cpp
index ff1778e36f62..191cfa6f03cf 100644
--- a/Userland/Libraries/LibWeb/DOM/Range.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Range.cpp
@@ -560,12 +560,16 @@ String Range::to_string() const
// 2. If this’s start node is this’s end node and it is a Text node,
// then return the substring of that Text node’s data beginning at this’s start offset and ending at this’s end offset.
- if (start_container() == end_container() && is<Text>(*start_container()))
- return MUST(static_cast<Text const&>(*start_container()).data().substring_from_byte_offset(start_offset(), end_offset() - start_offset()));
+ if (start_container() == end_container() && is<Text>(*start_container())) {
+ auto const& text = static_cast<Text const&>(*start_container());
+ return MUST(text.substring_data(start_offset(), end_offset() - start_offset()));
+ }
// 3. If this’s start node is a Text node, then append the substring of that node’s data from this’s start offset until the end to s.
- if (is<Text>(*start_container()))
- builder.append(static_cast<Text const&>(*start_container()).data().bytes_as_string_view().substring_view(start_offset()));
+ if (is<Text>(*start_container())) {
+ auto const& text = static_cast<Text const&>(*start_container());
+ builder.append(MUST(text.substring_data(start_offset(), text.length_in_utf16_code_units() - start_offset())));
+ }
// 4. Append the concatenation of the data of all Text nodes that are contained in this, in tree order, to s.
for (Node const* node = start_container(); node != end_container()->next_sibling(); node = node->next_in_pre_order()) {
@@ -574,8 +578,10 @@ String Range::to_string() const
}
// 5. If this’s end node is a Text node, then append the substring of that node’s data from its start until this’s end offset to s.
- if (is<Text>(*end_container()))
- builder.append(static_cast<Text const&>(*end_container()).data().bytes_as_string_view().substring_view(0, end_offset()));
+ if (is<Text>(*end_container())) {
+ auto const& text = static_cast<Text const&>(*end_container());
+ builder.append(MUST(text.substring_data(0, end_offset())));
+ }
// 6. Return s.
return MUST(builder.to_string());
|
718b78dd43639d2e6709ea60b77b35a7ff5f0f69
|
2024-12-16 16:05:00
|
devgianlu
|
libweb: Import WPT `RSA.importKey` tests
| false
|
Import WPT `RSA.importKey` tests
|
libweb
|
diff --git a/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/import_export/rsa_importKey.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/import_export/rsa_importKey.https.any.txt
new file mode 100644
index 000000000000..2f73f5c85095
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/import_export/rsa_importKey.https.any.txt
@@ -0,0 +1,1062 @@
+Harness status: OK
+
+Found 1056 tests
+
+480 Pass
+576 Fail
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [wrapKey])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, true, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [unwrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, true, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, true, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey, encrypt])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [wrapKey])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-OAEP}, false, [encrypt, wrapKey, encrypt, wrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey, decrypt])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [unwrapKey])
+Pass Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-OAEP}, false, [decrypt, unwrapKey, decrypt, unwrapKey])
+Pass Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-OAEP}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, true, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, true, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, true, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, false, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSA-PSS}, false, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, false, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSA-PSS}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSA-PSS}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (spki, buffer(162), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 1024 bits (pkcs8, buffer(636), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 1024 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 1024 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (spki, buffer(294), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 2048 bits (pkcs8, buffer(1218), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 2048 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 2048 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-1, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-256, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-384, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, true, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (spki, buffer(550), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [verify, verify])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 4096 bits (pkcs8, buffer(2376), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (pkcs8, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign])
+Fail Good parameters: 4096 bits (jwk, object(kty, n, e, d, p, q, dp, dq, qi), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [sign, sign])
+Fail Empty Usages: 4096 bits (jwk, object(spki, pkcs8, jwk), {hash: SHA-512, name: RSASSA-PKCS1-v1_5}, false, [])
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/rsa_importKey.https.any.html b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/rsa_importKey.https.any.html
new file mode 100644
index 000000000000..d5b2ff3eb070
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/rsa_importKey.https.any.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>WebCryptoAPI: importKey() for RSA keys</title>
+<meta name="timeout" content="long">
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../util/helpers.js"></script>
+<div id=log></div>
+<script src="../../WebCryptoAPI/import_export/rsa_importKey.https.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/rsa_importKey.https.any.js b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/rsa_importKey.https.any.js
new file mode 100644
index 000000000000..c0917cab683c
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/rsa_importKey.https.any.js
@@ -0,0 +1,271 @@
+// META: title=WebCryptoAPI: importKey() for RSA keys
+// META: timeout=long
+// META: script=../util/helpers.js
+
+// Test importKey and exportKey for RSA algorithms. Only "happy paths" are
+// currently tested - those where the operation should succeed.
+
+ var subtle = crypto.subtle;
+
+ var sizes = [1024, 2048, 4096];
+
+ var hashes = ["SHA-1", "SHA-256", "SHA-384", "SHA-512"];
+
+ var keyData = {
+ 1024: {
+ spki: new Uint8Array([48, 129, 159, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 129, 141, 0, 48, 129, 137, 2, 129, 129, 0, 205, 153, 248, 177, 17, 159, 141, 10, 44, 231, 172, 139, 253, 12, 181, 71, 211, 72, 249, 49, 204, 156, 92, 167, 159, 222, 32, 229, 28, 64, 235, 1, 171, 38, 30, 1, 37, 61, 241, 232, 143, 113, 208, 134, 233, 75, 122, 190, 119, 131, 145, 3, 164, 118, 190, 224, 204, 135, 199, 67, 21, 26, 253, 68, 49, 250, 93, 143, 160, 81, 39, 28, 245, 78, 73, 207, 117, 0, 216, 169, 149, 126, 192, 155, 157, 67, 239, 112, 9, 140, 87, 241, 13, 3, 191, 211, 23, 72, 175, 86, 59, 136, 22, 135, 114, 13, 60, 123, 16, 161, 205, 85, 58, 199, 29, 41, 107, 110, 222, 236, 165, 185, 156, 138, 251, 54, 221, 151, 2, 3, 1, 0, 1]),
+ pkcs8: new Uint8Array([48, 130, 2, 120, 2, 1, 0, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 4, 130, 2, 98, 48, 130, 2, 94, 2, 1, 0, 2, 129, 129, 0, 205, 153, 248, 177, 17, 159, 141, 10, 44, 231, 172, 139, 253, 12, 181, 71, 211, 72, 249, 49, 204, 156, 92, 167, 159, 222, 32, 229, 28, 64, 235, 1, 171, 38, 30, 1, 37, 61, 241, 232, 143, 113, 208, 134, 233, 75, 122, 190, 119, 131, 145, 3, 164, 118, 190, 224, 204, 135, 199, 67, 21, 26, 253, 68, 49, 250, 93, 143, 160, 81, 39, 28, 245, 78, 73, 207, 117, 0, 216, 169, 149, 126, 192, 155, 157, 67, 239, 112, 9, 140, 87, 241, 13, 3, 191, 211, 23, 72, 175, 86, 59, 136, 22, 135, 114, 13, 60, 123, 16, 161, 205, 85, 58, 199, 29, 41, 107, 110, 222, 236, 165, 185, 156, 138, 251, 54, 221, 151, 2, 3, 1, 0, 1, 2, 129, 128, 98, 162, 10, 252, 103, 71, 243, 145, 126, 25, 102, 93, 129, 248, 38, 191, 94, 77, 19, 191, 32, 57, 162, 249, 135, 104, 56, 191, 176, 222, 51, 223, 137, 11, 176, 57, 60, 116, 139, 40, 214, 39, 243, 177, 197, 25, 192, 184, 190, 253, 15, 4, 128, 81, 183, 32, 128, 254, 98, 73, 124, 70, 134, 88, 228, 85, 8, 229, 210, 6, 149, 141, 122, 147, 24, 166, 42, 57, 218, 125, 240, 230, 232, 249, 81, 145, 44, 6, 118, 237, 101, 205, 4, 181, 104, 85, 23, 96, 46, 169, 174, 213, 110, 34, 171, 89, 196, 20, 18, 1, 8, 241, 93, 32, 19, 144, 248, 183, 32, 96, 240, 101, 239, 247, 222, 249, 117, 1, 2, 65, 0, 244, 26, 192, 131, 146, 245, 205, 250, 134, 62, 229, 137, 14, 224, 194, 5, 127, 147, 154, 214, 93, 172, 226, 55, 98, 206, 25, 104, 223, 178, 48, 249, 83, 143, 5, 146, 16, 243, 180, 170, 119, 227, 17, 151, 48, 217, 88, 23, 30, 2, 73, 153, 181, 92, 163, 164, 241, 114, 66, 66, 152, 70, 42, 121, 2, 65, 0, 215, 158, 227, 12, 157, 88, 107, 153, 230, 66, 244, 207, 110, 18, 128, 60, 7, 140, 90, 136, 49, 11, 38, 144, 78, 64, 107, 167, 125, 41, 16, 167, 122, 152, 100, 129, 223, 206, 97, 170, 190, 1, 34, 79, 44, 221, 254, 204, 117, 122, 76, 249, 68, 169, 105, 152, 20, 161, 62, 40, 255, 101, 68, 143, 2, 65, 0, 169, 215, 127, 65, 76, 220, 104, 31, 186, 142, 66, 168, 213, 72, 62, 215, 18, 136, 2, 0, 203, 22, 194, 35, 37, 69, 31, 90, 223, 226, 28, 191, 45, 139, 98, 165, 217, 211, 167, 77, 192, 178, 166, 7, 155, 62, 110, 83, 79, 86, 234, 28, 223, 154, 128, 102, 0, 116, 174, 115, 165, 125, 148, 137, 2, 65, 0, 132, 212, 95, 192, 228, 169, 148, 215, 225, 46, 252, 75, 80, 222, 218, 218, 160, 55, 201, 137, 190, 212, 196, 179, 255, 80, 214, 64, 254, 236, 174, 82, 206, 70, 85, 28, 96, 248, 109, 216, 86, 102, 178, 113, 30, 13, 192, 42, 202, 112, 70, 61, 5, 28, 108, 109, 128, 191, 248, 96, 31, 61, 142, 103, 2, 65, 0, 205, 186, 73, 64, 8, 98, 158, 188, 82, 109, 82, 177, 5, 13, 132, 100, 97, 84, 15, 103, 183, 88, 37, 219, 0, 148, 88, 166, 79, 7, 85, 14, 64, 3, 157, 142, 132, 164, 226, 112, 236, 158, 218, 17, 7, 158, 184, 41, 20, 172, 194, 242, 44, 231, 78, 192, 134, 220, 83, 36, 191, 7, 35, 225]),
+ jwk: {
+ kty: "RSA",
+ n: "zZn4sRGfjQos56yL_Qy1R9NI-THMnFynn94g5RxA6wGrJh4BJT3x6I9x0IbpS3q-d4ORA6R2vuDMh8dDFRr9RDH6XY-gUScc9U5Jz3UA2KmVfsCbnUPvcAmMV_ENA7_TF0ivVjuIFodyDTx7EKHNVTrHHSlrbt7spbmcivs23Zc",
+ e: "AQAB",
+ d: "YqIK_GdH85F-GWZdgfgmv15NE78gOaL5h2g4v7DeM9-JC7A5PHSLKNYn87HFGcC4vv0PBIBRtyCA_mJJfEaGWORVCOXSBpWNepMYpio52n3w5uj5UZEsBnbtZc0EtWhVF2Auqa7VbiKrWcQUEgEI8V0gE5D4tyBg8GXv9975dQE",
+ p: "9BrAg5L1zfqGPuWJDuDCBX-TmtZdrOI3Ys4ZaN-yMPlTjwWSEPO0qnfjEZcw2VgXHgJJmbVco6TxckJCmEYqeQ",
+ q: "157jDJ1Ya5nmQvTPbhKAPAeMWogxCyaQTkBrp30pEKd6mGSB385hqr4BIk8s3f7MdXpM-USpaZgUoT4o_2VEjw",
+ dp: "qdd_QUzcaB-6jkKo1Ug-1xKIAgDLFsIjJUUfWt_iHL8ti2Kl2dOnTcCypgebPm5TT1bqHN-agGYAdK5zpX2UiQ",
+ dq: "hNRfwOSplNfhLvxLUN7a2qA3yYm-1MSz_1DWQP7srlLORlUcYPht2FZmsnEeDcAqynBGPQUcbG2Av_hgHz2OZw",
+ qi: "zbpJQAhinrxSbVKxBQ2EZGFUD2e3WCXbAJRYpk8HVQ5AA52OhKTicOye2hEHnrgpFKzC8iznTsCG3FMkvwcj4Q"
+ }
+ },
+
+ 2048: {
+ spki: new Uint8Array([48, 130, 1, 34, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 130, 1, 15, 0, 48, 130, 1, 10, 2, 130, 1, 1, 0, 217, 133, 128, 235, 45, 23, 114, 244, 164, 118, 188, 84, 4, 190, 230, 13, 154, 60, 42, 203, 188, 242, 74, 116, 117, 77, 159, 90, 104, 18, 56, 143, 158, 63, 38, 10, 216, 22, 135, 221, 179, 102, 248, 218, 85, 148, 98, 179, 151, 241, 192, 151, 137, 109, 13, 246, 230, 222, 49, 192, 79, 141, 71, 205, 21, 96, 13, 17, 190, 78, 196, 230, 48, 158, 32, 4, 22, 37, 127, 171, 186, 139, 190, 211, 58, 176, 193, 101, 218, 60, 155, 31, 206, 194, 196, 233, 229, 42, 202, 99, 89, 167, 207, 84, 213, 39, 91, 68, 134, 191, 1, 162, 180, 95, 4, 250, 226, 11, 113, 125, 1, 167, 148, 87, 7, 40, 129, 82, 151, 178, 183, 242, 43, 224, 14, 243, 2, 56, 19, 202, 135, 183, 224, 190, 131, 67, 51, 92, 250, 240, 118, 158, 54, 108, 249, 37, 108, 244, 66, 57, 69, 139, 180, 126, 189, 107, 50, 240, 22, 137, 128, 103, 0, 146, 115, 247, 157, 69, 184, 91, 159, 51, 245, 115, 24, 223, 197, 175, 152, 26, 162, 150, 72, 52, 231, 245, 179, 48, 18, 211, 105, 100, 106, 103, 56, 178, 43, 202, 85, 229, 144, 102, 241, 230, 159, 106, 105, 241, 238, 222, 204, 232, 129, 183, 66, 63, 212, 77, 252, 122, 124, 152, 156, 66, 103, 65, 216, 129, 60, 63, 205, 192, 36, 181, 61, 132, 41, 10, 59, 237, 163, 200, 56, 114, 202, 253, 2, 3, 1, 0, 1]),
+ pkcs8: new Uint8Array([48, 130, 4, 190, 2, 1, 0, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 4, 130, 4, 168, 48, 130, 4, 164, 2, 1, 0, 2, 130, 1, 1, 0, 217, 133, 128, 235, 45, 23, 114, 244, 164, 118, 188, 84, 4, 190, 230, 13, 154, 60, 42, 203, 188, 242, 74, 116, 117, 77, 159, 90, 104, 18, 56, 143, 158, 63, 38, 10, 216, 22, 135, 221, 179, 102, 248, 218, 85, 148, 98, 179, 151, 241, 192, 151, 137, 109, 13, 246, 230, 222, 49, 192, 79, 141, 71, 205, 21, 96, 13, 17, 190, 78, 196, 230, 48, 158, 32, 4, 22, 37, 127, 171, 186, 139, 190, 211, 58, 176, 193, 101, 218, 60, 155, 31, 206, 194, 196, 233, 229, 42, 202, 99, 89, 167, 207, 84, 213, 39, 91, 68, 134, 191, 1, 162, 180, 95, 4, 250, 226, 11, 113, 125, 1, 167, 148, 87, 7, 40, 129, 82, 151, 178, 183, 242, 43, 224, 14, 243, 2, 56, 19, 202, 135, 183, 224, 190, 131, 67, 51, 92, 250, 240, 118, 158, 54, 108, 249, 37, 108, 244, 66, 57, 69, 139, 180, 126, 189, 107, 50, 240, 22, 137, 128, 103, 0, 146, 115, 247, 157, 69, 184, 91, 159, 51, 245, 115, 24, 223, 197, 175, 152, 26, 162, 150, 72, 52, 231, 245, 179, 48, 18, 211, 105, 100, 106, 103, 56, 178, 43, 202, 85, 229, 144, 102, 241, 230, 159, 106, 105, 241, 238, 222, 204, 232, 129, 183, 66, 63, 212, 77, 252, 122, 124, 152, 156, 66, 103, 65, 216, 129, 60, 63, 205, 192, 36, 181, 61, 132, 41, 10, 59, 237, 163, 200, 56, 114, 202, 253, 2, 3, 1, 0, 1, 2, 130, 1, 0, 90, 210, 167, 117, 138, 170, 83, 209, 90, 42, 73, 144, 59, 59, 10, 11, 123, 238, 203, 95, 174, 80, 236, 77, 155, 253, 1, 32, 90, 123, 225, 41, 246, 69, 31, 185, 63, 104, 136, 234, 68, 210, 37, 237, 227, 245, 197, 16, 127, 204, 237, 65, 88, 156, 52, 76, 119, 49, 39, 76, 200, 234, 144, 164, 76, 220, 130, 24, 122, 129, 161, 45, 11, 247, 186, 30, 122, 176, 197, 146, 10, 157, 246, 219, 115, 146, 1, 238, 105, 37, 13, 16, 70, 224, 132, 31, 181, 20, 28, 213, 70, 198, 14, 135, 185, 72, 105, 143, 63, 67, 217, 134, 250, 17, 2, 159, 78, 106, 192, 196, 21, 64, 199, 107, 95, 13, 198, 144, 212, 69, 255, 226, 191, 121, 46, 30, 103, 153, 111, 171, 166, 137, 88, 229, 86, 142, 66, 238, 136, 24, 72, 248, 27, 43, 116, 101, 215, 99, 39, 246, 212, 111, 241, 132, 169, 7, 252, 19, 104, 172, 233, 8, 40, 227, 172, 42, 47, 36, 134, 34, 214, 97, 228, 179, 215, 193, 4, 222, 129, 165, 1, 59, 216, 171, 50, 17, 100, 68, 199, 226, 114, 175, 49, 6, 95, 129, 122, 189, 198, 152, 17, 113, 70, 121, 104, 51, 75, 18, 210, 27, 237, 93, 87, 104, 49, 64, 112, 122, 198, 34, 61, 209, 7, 6, 121, 22, 191, 95, 151, 248, 124, 7, 87, 143, 45, 123, 22, 128, 153, 197, 130, 196, 244, 164, 225, 241, 2, 129, 129, 0, 252, 223, 109, 18, 211, 223, 124, 146, 67, 138, 211, 142, 156, 153, 102, 192, 192, 236, 129, 21, 14, 158, 28, 228, 12, 184, 69, 239, 165, 195, 209, 9, 236, 240, 88, 59, 143, 104, 199, 197, 124, 83, 168, 201, 166, 249, 158, 156, 67, 158, 15, 116, 155, 224, 83, 172, 112, 187, 1, 225, 127, 254, 175, 175, 214, 214, 36, 111, 218, 85, 109, 33, 228, 157, 192, 61, 195, 207, 25, 136, 154, 244, 134, 69, 18, 103, 225, 172, 131, 16, 168, 70, 3, 30, 5, 98, 162, 47, 88, 191, 99, 241, 127, 93, 36, 4, 72, 97, 227, 7, 70, 60, 141, 25, 150, 77, 170, 201, 86, 129, 29, 96, 60, 41, 231, 190, 200, 107, 2, 129, 129, 0, 220, 54, 40, 140, 204, 79, 7, 149, 241, 40, 229, 237, 13, 3, 118, 172, 76, 61, 137, 8, 253, 72, 223, 119, 189, 19, 87, 199, 3, 61, 197, 45, 111, 18, 58, 224, 121, 190, 144, 46, 143, 225, 7, 129, 10, 154, 24, 140, 96, 246, 212, 224, 232, 144, 67, 98, 6, 188, 167, 17, 224, 215, 160, 182, 249, 132, 174, 249, 21, 78, 138, 59, 186, 184, 239, 10, 71, 146, 46, 189, 206, 165, 57, 50, 38, 241, 230, 57, 169, 77, 76, 229, 53, 45, 184, 87, 22, 194, 94, 48, 68, 246, 171, 255, 73, 197, 25, 64, 13, 132, 56, 120, 241, 100, 197, 243, 171, 84, 246, 32, 86, 55, 55, 216, 121, 64, 52, 55, 2, 129, 128, 109, 221, 189, 12, 35, 21, 196, 143, 223, 220, 159, 82, 36, 227, 217, 107, 1, 231, 63, 166, 32, 117, 189, 227, 175, 75, 24, 199, 168, 99, 205, 156, 220, 95, 8, 86, 200, 86, 36, 5, 191, 160, 177, 130, 251, 147, 20, 192, 155, 248, 62, 138, 209, 118, 195, 163, 246, 78, 169, 224, 137, 181, 228, 43, 39, 210, 94, 126, 98, 132, 31, 40, 76, 165, 229, 114, 112, 114, 184, 139, 75, 151, 214, 6, 136, 154, 173, 200, 64, 33, 170, 154, 208, 155, 232, 135, 20, 36, 50, 16, 229, 161, 117, 78, 200, 105, 59, 241, 155, 171, 251, 110, 47, 119, 224, 127, 218, 38, 35, 249, 113, 3, 240, 223, 220, 26, 94, 5, 2, 129, 129, 0, 149, 113, 187, 187, 49, 188, 64, 109, 165, 168, 23, 193, 244, 30, 241, 158, 164, 110, 238, 92, 199, 103, 121, 32, 141, 148, 94, 241, 148, 101, 139, 54, 246, 53, 236, 247, 2, 40, 45, 57, 44, 51, 143, 32, 39, 205, 195, 243, 32, 170, 226, 117, 111, 222, 215, 155, 226, 238, 140, 131, 57, 143, 156, 102, 16, 151, 215, 22, 251, 58, 189, 221, 35, 46, 246, 42, 135, 191, 209, 48, 198, 216, 162, 36, 67, 1, 207, 56, 58, 137, 87, 50, 6, 16, 237, 21, 77, 64, 195, 35, 6, 234, 80, 119, 131, 220, 218, 241, 249, 58, 78, 8, 229, 233, 121, 221, 143, 220, 172, 219, 237, 38, 180, 35, 152, 197, 213, 169, 2, 129, 129, 0, 157, 34, 27, 203, 101, 161, 91, 231, 149, 223, 255, 186, 178, 175, 168, 93, 194, 163, 171, 101, 186, 95, 110, 38, 250, 23, 38, 18, 213, 87, 33, 41, 187, 18, 0, 21, 202, 68, 70, 236, 63, 219, 158, 201, 128, 166, 97, 210, 170, 210, 56, 80, 81, 24, 152, 240, 124, 20, 135, 22, 9, 92, 209, 189, 96, 214, 49, 70, 74, 200, 155, 82, 70, 96, 189, 70, 89, 82, 210, 229, 125, 135, 64, 183, 195, 243, 219, 121, 73, 43, 22, 184, 122, 92, 209, 118, 126, 19, 82, 110, 246, 109, 121, 198, 145, 226, 199, 242, 82, 139, 105, 101, 44, 41, 186, 33, 10, 94, 103, 157, 35, 178, 26, 104, 12, 191, 13, 7]),
+ jwk: {
+ kty: "RSA",
+ n: "2YWA6y0XcvSkdrxUBL7mDZo8Ksu88kp0dU2fWmgSOI-ePyYK2BaH3bNm-NpVlGKzl_HAl4ltDfbm3jHAT41HzRVgDRG-TsTmMJ4gBBYlf6u6i77TOrDBZdo8mx_OwsTp5SrKY1mnz1TVJ1tEhr8BorRfBPriC3F9AaeUVwcogVKXsrfyK-AO8wI4E8qHt-C-g0MzXPrwdp42bPklbPRCOUWLtH69azLwFomAZwCSc_edRbhbnzP1cxjfxa-YGqKWSDTn9bMwEtNpZGpnOLIrylXlkGbx5p9qafHu3szogbdCP9RN_Hp8mJxCZ0HYgTw_zcAktT2EKQo77aPIOHLK_Q",
+ e: "AQAB",
+ d: "WtKndYqqU9FaKkmQOzsKC3vuy1-uUOxNm_0BIFp74Sn2RR-5P2iI6kTSJe3j9cUQf8ztQVicNEx3MSdMyOqQpEzcghh6gaEtC_e6HnqwxZIKnfbbc5IB7mklDRBG4IQftRQc1UbGDoe5SGmPP0PZhvoRAp9OasDEFUDHa18NxpDURf_iv3kuHmeZb6umiVjlVo5C7ogYSPgbK3Rl12Mn9tRv8YSpB_wTaKzpCCjjrCovJIYi1mHks9fBBN6BpQE72KsyEWREx-JyrzEGX4F6vcaYEXFGeWgzSxLSG-1dV2gxQHB6xiI90QcGeRa_X5f4fAdXjy17FoCZxYLE9KTh8Q",
+ p: "_N9tEtPffJJDitOOnJlmwMDsgRUOnhzkDLhF76XD0Qns8Fg7j2jHxXxTqMmm-Z6cQ54PdJvgU6xwuwHhf_6vr9bWJG_aVW0h5J3APcPPGYia9IZFEmfhrIMQqEYDHgVioi9Yv2Pxf10kBEhh4wdGPI0Zlk2qyVaBHWA8Kee-yGs",
+ q: "3DYojMxPB5XxKOXtDQN2rEw9iQj9SN93vRNXxwM9xS1vEjrgeb6QLo_hB4EKmhiMYPbU4OiQQ2IGvKcR4NegtvmErvkVToo7urjvCkeSLr3OpTkyJvHmOalNTOU1LbhXFsJeMET2q_9JxRlADYQ4ePFkxfOrVPYgVjc32HlANDc",
+ dp: "bd29DCMVxI_f3J9SJOPZawHnP6Ygdb3jr0sYx6hjzZzcXwhWyFYkBb-gsYL7kxTAm_g-itF2w6P2TqngibXkKyfSXn5ihB8oTKXlcnByuItLl9YGiJqtyEAhqprQm-iHFCQyEOWhdU7IaTvxm6v7bi934H_aJiP5cQPw39waXgU",
+ dq: "lXG7uzG8QG2lqBfB9B7xnqRu7lzHZ3kgjZRe8ZRlizb2Nez3AigtOSwzjyAnzcPzIKridW_e15vi7oyDOY-cZhCX1xb7Or3dIy72Koe_0TDG2KIkQwHPODqJVzIGEO0VTUDDIwbqUHeD3Nrx-TpOCOXped2P3Kzb7Sa0I5jF1ak",
+ qi: "nSIby2WhW-eV3_-6sq-oXcKjq2W6X24m-hcmEtVXISm7EgAVykRG7D_bnsmApmHSqtI4UFEYmPB8FIcWCVzRvWDWMUZKyJtSRmC9RllS0uV9h0C3w_PbeUkrFrh6XNF2fhNSbvZtecaR4sfyUotpZSwpuiEKXmedI7IaaAy_DQc"
+ }
+ },
+
+ 4096: {
+ spki: new Uint8Array([48, 130, 2, 34, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 130, 2, 15, 0, 48, 130, 2, 10, 2, 130, 2, 1, 0, 218, 170, 246, 76, 189, 156, 216, 153, 155, 176, 221, 14, 44, 132, 103, 104, 0, 127, 100, 166, 245, 248, 104, 125, 31, 74, 155, 226, 90, 193, 184, 54, 170, 145, 111, 222, 20, 252, 19, 248, 146, 44, 190, 115, 73, 188, 52, 251, 4, 178, 121, 238, 212, 204, 34, 62, 122, 100, 203, 111, 233, 231, 210, 73, 53, 146, 147, 211, 14, 161, 109, 137, 212, 175, 226, 18, 183, 173, 103, 103, 30, 128, 31, 218, 69, 126, 234, 65, 88, 231, 160, 91, 51, 245, 77, 54, 4, 167, 192, 33, 68, 244, 163, 242, 187, 111, 209, 180, 241, 221, 107, 172, 5, 40, 134, 47, 210, 85, 8, 112, 57, 186, 29, 131, 176, 93, 116, 198, 202, 82, 108, 251, 209, 3, 72, 75, 143, 59, 44, 222, 56, 89, 69, 103, 159, 211, 160, 19, 214, 173, 77, 133, 0, 68, 219, 164, 79, 64, 238, 65, 189, 201, 248, 173, 180, 146, 196, 238, 86, 232, 215, 109, 39, 165, 162, 16, 230, 46, 134, 234, 148, 106, 34, 230, 198, 63, 231, 143, 16, 179, 208, 109, 22, 100, 54, 156, 107, 132, 28, 208, 118, 205, 217, 89, 228, 75, 196, 169, 181, 5, 85, 157, 144, 110, 129, 186, 141, 119, 104, 162, 206, 170, 115, 7, 96, 82, 240, 33, 143, 81, 243, 215, 67, 96, 137, 207, 209, 22, 162, 251, 108, 208, 232, 32, 236, 205, 167, 174, 161, 116, 13, 249, 187, 22, 240, 185, 172, 160, 103, 94, 162, 147, 26, 15, 143, 183, 147, 98, 231, 117, 134, 185, 50, 64, 40, 30, 27, 13, 152, 132, 40, 138, 32, 78, 158, 162, 207, 212, 229, 210, 251, 88, 116, 67, 229, 164, 164, 147, 59, 32, 94, 217, 197, 242, 149, 102, 74, 219, 46, 127, 68, 28, 116, 10, 2, 249, 231, 130, 123, 29, 45, 73, 56, 17, 195, 208, 45, 25, 60, 252, 98, 189, 109, 25, 0, 253, 151, 254, 124, 211, 48, 23, 156, 78, 163, 154, 188, 17, 69, 14, 188, 16, 64, 59, 190, 136, 70, 162, 253, 237, 156, 111, 41, 27, 40, 63, 205, 204, 94, 0, 50, 237, 62, 87, 211, 115, 91, 68, 194, 104, 119, 72, 106, 226, 160, 48, 165, 138, 134, 2, 138, 153, 181, 38, 249, 48, 120, 72, 15, 245, 227, 15, 164, 64, 188, 74, 4, 84, 213, 83, 67, 73, 87, 181, 72, 94, 46, 54, 193, 252, 188, 14, 207, 28, 82, 159, 131, 168, 238, 168, 145, 28, 230, 27, 126, 151, 93, 5, 96, 68, 126, 66, 174, 155, 101, 123, 20, 218, 131, 92, 124, 78, 82, 44, 55, 139, 77, 105, 177, 136, 121, 177, 43, 77, 12, 240, 0, 76, 20, 133, 121, 129, 73, 15, 160, 200, 150, 114, 95, 59, 59, 165, 240, 204, 13, 156, 134, 194, 4, 70, 158, 213, 111, 229, 103, 216, 239, 132, 16, 184, 151, 206, 254, 229, 62, 23, 58, 125, 49, 144, 208, 215, 2, 3, 1, 0, 1]),
+ pkcs8: new Uint8Array([48, 130, 9, 68, 2, 1, 0, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 4, 130, 9, 46, 48, 130, 9, 42, 2, 1, 0, 2, 130, 2, 1, 0, 218, 170, 246, 76, 189, 156, 216, 153, 155, 176, 221, 14, 44, 132, 103, 104, 0, 127, 100, 166, 245, 248, 104, 125, 31, 74, 155, 226, 90, 193, 184, 54, 170, 145, 111, 222, 20, 252, 19, 248, 146, 44, 190, 115, 73, 188, 52, 251, 4, 178, 121, 238, 212, 204, 34, 62, 122, 100, 203, 111, 233, 231, 210, 73, 53, 146, 147, 211, 14, 161, 109, 137, 212, 175, 226, 18, 183, 173, 103, 103, 30, 128, 31, 218, 69, 126, 234, 65, 88, 231, 160, 91, 51, 245, 77, 54, 4, 167, 192, 33, 68, 244, 163, 242, 187, 111, 209, 180, 241, 221, 107, 172, 5, 40, 134, 47, 210, 85, 8, 112, 57, 186, 29, 131, 176, 93, 116, 198, 202, 82, 108, 251, 209, 3, 72, 75, 143, 59, 44, 222, 56, 89, 69, 103, 159, 211, 160, 19, 214, 173, 77, 133, 0, 68, 219, 164, 79, 64, 238, 65, 189, 201, 248, 173, 180, 146, 196, 238, 86, 232, 215, 109, 39, 165, 162, 16, 230, 46, 134, 234, 148, 106, 34, 230, 198, 63, 231, 143, 16, 179, 208, 109, 22, 100, 54, 156, 107, 132, 28, 208, 118, 205, 217, 89, 228, 75, 196, 169, 181, 5, 85, 157, 144, 110, 129, 186, 141, 119, 104, 162, 206, 170, 115, 7, 96, 82, 240, 33, 143, 81, 243, 215, 67, 96, 137, 207, 209, 22, 162, 251, 108, 208, 232, 32, 236, 205, 167, 174, 161, 116, 13, 249, 187, 22, 240, 185, 172, 160, 103, 94, 162, 147, 26, 15, 143, 183, 147, 98, 231, 117, 134, 185, 50, 64, 40, 30, 27, 13, 152, 132, 40, 138, 32, 78, 158, 162, 207, 212, 229, 210, 251, 88, 116, 67, 229, 164, 164, 147, 59, 32, 94, 217, 197, 242, 149, 102, 74, 219, 46, 127, 68, 28, 116, 10, 2, 249, 231, 130, 123, 29, 45, 73, 56, 17, 195, 208, 45, 25, 60, 252, 98, 189, 109, 25, 0, 253, 151, 254, 124, 211, 48, 23, 156, 78, 163, 154, 188, 17, 69, 14, 188, 16, 64, 59, 190, 136, 70, 162, 253, 237, 156, 111, 41, 27, 40, 63, 205, 204, 94, 0, 50, 237, 62, 87, 211, 115, 91, 68, 194, 104, 119, 72, 106, 226, 160, 48, 165, 138, 134, 2, 138, 153, 181, 38, 249, 48, 120, 72, 15, 245, 227, 15, 164, 64, 188, 74, 4, 84, 213, 83, 67, 73, 87, 181, 72, 94, 46, 54, 193, 252, 188, 14, 207, 28, 82, 159, 131, 168, 238, 168, 145, 28, 230, 27, 126, 151, 93, 5, 96, 68, 126, 66, 174, 155, 101, 123, 20, 218, 131, 92, 124, 78, 82, 44, 55, 139, 77, 105, 177, 136, 121, 177, 43, 77, 12, 240, 0, 76, 20, 133, 121, 129, 73, 15, 160, 200, 150, 114, 95, 59, 59, 165, 240, 204, 13, 156, 134, 194, 4, 70, 158, 213, 111, 229, 103, 216, 239, 132, 16, 184, 151, 206, 254, 229, 62, 23, 58, 125, 49, 144, 208, 215, 2, 3, 1, 0, 1, 2, 130, 2, 1, 0, 185, 115, 209, 92, 24, 92, 19, 159, 131, 89, 166, 193, 68, 164, 46, 135, 24, 20, 243, 42, 94, 230, 4, 200, 73, 103, 159, 121, 131, 251, 83, 222, 153, 30, 171, 191, 176, 16, 114, 103, 152, 161, 118, 12, 148, 246, 152, 0, 100, 101, 113, 224, 74, 125, 174, 117, 74, 156, 125, 165, 54, 189, 179, 172, 255, 80, 135, 42, 178, 247, 217, 204, 209, 163, 49, 155, 42, 72, 88, 176, 46, 63, 255, 195, 192, 184, 248, 183, 223, 76, 226, 197, 54, 245, 206, 60, 8, 10, 181, 122, 1, 223, 113, 196, 133, 143, 58, 77, 185, 235, 78, 76, 32, 59, 212, 66, 110, 162, 75, 123, 210, 153, 180, 58, 97, 179, 129, 60, 175, 142, 228, 123, 85, 50, 241, 119, 147, 204, 94, 43, 65, 163, 4, 167, 243, 247, 41, 134, 105, 197, 165, 63, 45, 145, 56, 174, 203, 192, 135, 209, 29, 195, 83, 179, 14, 184, 131, 104, 152, 48, 245, 179, 207, 178, 60, 23, 21, 1, 84, 207, 82, 124, 9, 137, 171, 141, 187, 55, 172, 180, 180, 10, 48, 185, 97, 79, 156, 39, 249, 192, 27, 98, 77, 250, 93, 18, 157, 130, 72, 210, 115, 96, 36, 132, 116, 101, 225, 96, 234, 79, 89, 243, 89, 135, 97, 252, 53, 72, 97, 34, 226, 41, 41, 45, 144, 243, 189, 162, 243, 43, 69, 136, 143, 182, 140, 223, 134, 93, 38, 245, 36, 125, 46, 93, 48, 94, 215, 39, 156, 57, 86, 93, 207, 204, 72, 106, 112, 215, 203, 230, 80, 20, 137, 224, 242, 33, 146, 33, 108, 188, 185, 254, 117, 189, 240, 82, 64, 60, 186, 247, 190, 138, 170, 159, 147, 75, 49, 148, 101, 174, 130, 21, 177, 211, 121, 6, 153, 144, 230, 166, 181, 155, 94, 232, 2, 4, 119, 236, 35, 133, 253, 223, 14, 30, 199, 57, 215, 31, 251, 90, 167, 19, 231, 154, 54, 225, 85, 68, 17, 234, 158, 53, 50, 243, 182, 149, 193, 214, 60, 188, 6, 38, 2, 200, 161, 232, 193, 30, 153, 231, 221, 57, 140, 55, 69, 35, 21, 153, 34, 238, 175, 65, 253, 210, 119, 125, 120, 116, 153, 127, 67, 204, 9, 66, 210, 200, 165, 212, 216, 2, 62, 19, 15, 171, 77, 183, 247, 127, 224, 138, 41, 208, 170, 227, 36, 158, 176, 111, 128, 172, 70, 73, 241, 148, 172, 50, 174, 126, 80, 177, 235, 93, 89, 102, 84, 76, 221, 30, 216, 49, 125, 142, 35, 45, 96, 224, 60, 161, 63, 48, 85, 143, 20, 76, 182, 111, 15, 156, 139, 55, 155, 113, 226, 248, 239, 130, 252, 241, 197, 247, 124, 61, 39, 197, 170, 119, 76, 136, 195, 180, 169, 106, 240, 234, 101, 114, 207, 11, 160, 170, 139, 194, 187, 48, 22, 114, 84, 64, 151, 30, 212, 99, 213, 176, 106, 79, 232, 127, 197, 153, 133, 8, 56, 210, 83, 67, 106, 124, 231, 96, 2, 145, 2, 130, 1, 1, 0, 244, 218, 215, 194, 174, 36, 99, 217, 1, 4, 236, 11, 160, 86, 85, 65, 206, 36, 36, 143, 205, 108, 166, 191, 91, 209, 75, 117, 7, 81, 33, 179, 44, 101, 145, 215, 39, 117, 195, 81, 31, 111, 36, 7, 26, 105, 30, 249, 91, 2, 2, 237, 126, 141, 231, 153, 213, 181, 100, 234, 219, 192, 114, 179, 215, 229, 39, 212, 107, 9, 55, 220, 136, 233, 237, 28, 74, 97, 6, 22, 26, 47, 150, 83, 82, 95, 186, 146, 22, 38, 176, 231, 255, 166, 199, 223, 217, 86, 142, 56, 43, 199, 25, 247, 249, 122, 59, 142, 152, 20, 49, 147, 13, 132, 249, 203, 251, 146, 116, 96, 88, 81, 232, 45, 106, 100, 187, 99, 73, 32, 203, 134, 30, 223, 100, 179, 179, 128, 81, 242, 25, 85, 137, 125, 96, 153, 240, 224, 86, 20, 206, 24, 26, 197, 233, 164, 158, 50, 222, 103, 197, 211, 144, 101, 182, 205, 201, 51, 23, 231, 125, 229, 130, 61, 139, 204, 195, 243, 69, 38, 185, 187, 48, 249, 140, 107, 137, 39, 234, 21, 13, 43, 24, 112, 108, 109, 15, 25, 57, 55, 127, 40, 152, 238, 227, 96, 86, 157, 114, 35, 52, 54, 38, 140, 85, 42, 119, 53, 99, 35, 133, 208, 240, 65, 171, 8, 71, 255, 243, 248, 176, 166, 17, 178, 92, 62, 203, 56, 158, 31, 169, 223, 123, 7, 118, 216, 166, 132, 83, 62, 112, 160, 99, 244, 132, 29, 2, 130, 1, 1, 0, 228, 158, 249, 243, 243, 94, 42, 189, 87, 61, 152, 139, 197, 122, 33, 97, 4, 39, 135, 66, 219, 225, 11, 70, 103, 92, 115, 10, 8, 225, 5, 2, 220, 32, 23, 147, 56, 111, 237, 98, 48, 174, 122, 207, 109, 152, 187, 125, 220, 186, 73, 127, 42, 82, 39, 228, 163, 12, 188, 36, 71, 107, 52, 235, 223, 200, 7, 38, 6, 167, 28, 158, 26, 213, 126, 186, 90, 152, 133, 44, 53, 156, 61, 130, 92, 163, 3, 27, 35, 185, 141, 112, 236, 246, 210, 107, 75, 245, 33, 126, 134, 215, 41, 1, 244, 220, 36, 93, 22, 232, 50, 62, 68, 141, 153, 118, 62, 1, 167, 197, 202, 113, 187, 196, 186, 251, 161, 128, 66, 211, 145, 103, 133, 69, 207, 155, 117, 65, 76, 251, 125, 43, 224, 105, 171, 6, 29, 254, 31, 111, 144, 5, 158, 166, 180, 143, 163, 205, 212, 151, 7, 11, 50, 234, 82, 37, 143, 75, 104, 124, 97, 69, 220, 246, 202, 45, 25, 40, 220, 23, 92, 116, 112, 114, 204, 198, 140, 48, 111, 191, 53, 28, 9, 134, 234, 90, 168, 243, 108, 75, 197, 99, 162, 173, 31, 194, 97, 224, 184, 76, 227, 170, 199, 106, 129, 14, 77, 234, 231, 38, 192, 197, 233, 174, 150, 240, 55, 252, 241, 27, 97, 169, 49, 49, 115, 9, 218, 65, 253, 14, 253, 217, 91, 141, 44, 68, 32, 247, 219, 199, 31, 45, 212, 68, 46, 131, 2, 130, 1, 1, 0, 225, 142, 199, 187, 155, 88, 2, 114, 225, 49, 123, 144, 170, 63, 93, 130, 165, 55, 62, 71, 10, 97, 208, 169, 239, 23, 58, 127, 176, 33, 216, 253, 137, 36, 119, 216, 207, 140, 248, 68, 62, 196, 207, 87, 139, 200, 210, 179, 186, 86, 124, 3, 243, 213, 29, 72, 229, 73, 152, 145, 145, 166, 19, 4, 1, 26, 36, 58, 213, 239, 67, 250, 112, 85, 174, 11, 165, 169, 3, 70, 81, 17, 13, 85, 236, 72, 43, 66, 112, 13, 108, 98, 11, 107, 196, 44, 61, 182, 50, 133, 36, 46, 225, 137, 65, 212, 140, 16, 171, 159, 206, 155, 60, 149, 6, 216, 22, 3, 176, 25, 32, 195, 51, 50, 195, 19, 208, 91, 129, 254, 39, 254, 129, 106, 33, 6, 57, 145, 55, 235, 225, 210, 158, 57, 85, 71, 250, 81, 110, 122, 243, 239, 216, 154, 0, 197, 152, 198, 27, 131, 85, 5, 179, 187, 63, 79, 10, 205, 122, 115, 209, 210, 30, 204, 59, 128, 129, 242, 19, 253, 188, 146, 232, 102, 186, 40, 69, 204, 243, 34, 57, 99, 61, 188, 50, 229, 180, 70, 244, 34, 95, 141, 50, 116, 190, 24, 253, 49, 68, 247, 145, 29, 97, 29, 93, 71, 37, 81, 148, 230, 32, 91, 125, 55, 193, 42, 123, 201, 25, 34, 58, 248, 128, 204, 225, 149, 38, 248, 29, 17, 230, 22, 236, 234, 207, 92, 124, 232, 225, 22, 96, 2, 32, 146, 27, 49, 2, 130, 1, 1, 0, 129, 62, 34, 61, 183, 242, 31, 37, 68, 193, 108, 144, 111, 133, 248, 130, 184, 239, 131, 182, 215, 72, 164, 176, 27, 84, 151, 48, 48, 14, 205, 95, 109, 131, 178, 240, 38, 50, 152, 55, 47, 32, 36, 11, 73, 128, 211, 85, 118, 199, 213, 46, 207, 132, 252, 74, 115, 166, 138, 97, 212, 2, 22, 59, 214, 25, 101, 121, 40, 191, 166, 28, 247, 60, 132, 84, 227, 76, 95, 212, 187, 69, 229, 59, 226, 20, 193, 119, 193, 61, 111, 105, 76, 124, 200, 61, 162, 6, 36, 246, 59, 82, 61, 59, 126, 234, 72, 160, 91, 135, 206, 135, 135, 7, 169, 158, 191, 180, 253, 220, 129, 242, 195, 220, 150, 124, 20, 51, 199, 19, 133, 154, 201, 43, 203, 14, 174, 61, 201, 64, 78, 229, 212, 10, 200, 133, 63, 197, 94, 142, 26, 20, 35, 57, 72, 207, 255, 33, 40, 50, 108, 231, 246, 211, 162, 182, 219, 8, 29, 60, 91, 93, 60, 106, 67, 167, 53, 22, 245, 61, 59, 166, 19, 191, 194, 101, 231, 240, 165, 235, 169, 33, 125, 125, 72, 213, 17, 183, 243, 27, 238, 173, 193, 212, 47, 37, 27, 98, 7, 174, 103, 242, 46, 163, 213, 235, 121, 62, 247, 135, 223, 232, 194, 143, 81, 130, 225, 147, 219, 213, 199, 226, 247, 13, 102, 100, 70, 127, 145, 136, 189, 22, 248, 123, 153, 111, 182, 87, 136, 102, 76, 9, 3, 123, 187, 243, 2, 130, 1, 0, 36, 121, 149, 41, 189, 115, 193, 110, 98, 69, 30, 145, 9, 231, 177, 98, 120, 118, 126, 102, 62, 220, 58, 207, 73, 211, 60, 15, 24, 107, 208, 95, 29, 107, 40, 190, 182, 84, 106, 17, 217, 198, 210, 27, 233, 227, 153, 252, 128, 181, 44, 145, 101, 156, 7, 209, 23, 149, 66, 78, 109, 145, 138, 13, 241, 174, 198, 3, 26, 222, 15, 241, 120, 176, 54, 190, 97, 80, 215, 99, 49, 62, 204, 135, 226, 32, 141, 102, 251, 32, 152, 108, 113, 237, 59, 142, 30, 185, 195, 135, 145, 1, 86, 115, 56, 253, 215, 186, 221, 202, 196, 36, 227, 118, 177, 130, 60, 59, 56, 190, 198, 157, 142, 18, 96, 43, 218, 199, 150, 42, 174, 44, 198, 65, 103, 139, 167, 177, 46, 26, 155, 248, 209, 56, 155, 209, 204, 42, 89, 224, 212, 75, 80, 135, 106, 203, 4, 81, 181, 85, 128, 247, 73, 134, 41, 48, 183, 57, 127, 28, 234, 26, 244, 177, 159, 113, 90, 249, 120, 32, 248, 134, 79, 99, 123, 155, 173, 201, 185, 216, 166, 32, 152, 181, 6, 154, 118, 18, 181, 245, 106, 25, 37, 146, 118, 16, 215, 30, 83, 96, 35, 154, 93, 0, 13, 5, 206, 156, 129, 147, 118, 87, 248, 155, 49, 135, 7, 39, 157, 226, 171, 96, 16, 112, 122, 173, 58, 145, 19, 6, 90, 11, 221, 109, 208, 16, 251, 188, 18, 120, 106, 170, 143, 149, 79, 192]),
+ jwk: {
+ kty: "RSA",
+ n: "2qr2TL2c2JmbsN0OLIRnaAB_ZKb1-Gh9H0qb4lrBuDaqkW_eFPwT-JIsvnNJvDT7BLJ57tTMIj56ZMtv6efSSTWSk9MOoW2J1K_iEretZ2cegB_aRX7qQVjnoFsz9U02BKfAIUT0o_K7b9G08d1rrAUohi_SVQhwObodg7BddMbKUmz70QNIS487LN44WUVnn9OgE9atTYUARNukT0DuQb3J-K20ksTuVujXbSelohDmLobqlGoi5sY_548Qs9BtFmQ2nGuEHNB2zdlZ5EvEqbUFVZ2QboG6jXdoos6qcwdgUvAhj1Hz10Ngic_RFqL7bNDoIOzNp66hdA35uxbwuaygZ16ikxoPj7eTYud1hrkyQCgeGw2YhCiKIE6eos_U5dL7WHRD5aSkkzsgXtnF8pVmStsuf0QcdAoC-eeCex0tSTgRw9AtGTz8Yr1tGQD9l_580zAXnE6jmrwRRQ68EEA7vohGov3tnG8pGyg_zcxeADLtPlfTc1tEwmh3SGrioDClioYCipm1JvkweEgP9eMPpEC8SgRU1VNDSVe1SF4uNsH8vA7PHFKfg6juqJEc5ht-l10FYER-Qq6bZXsU2oNcfE5SLDeLTWmxiHmxK00M8ABMFIV5gUkPoMiWcl87O6XwzA2chsIERp7Vb-Vn2O-EELiXzv7lPhc6fTGQ0Nc",
+ e: "AQAB",
+ d: "uXPRXBhcE5-DWabBRKQuhxgU8ype5gTISWefeYP7U96ZHqu_sBByZ5ihdgyU9pgAZGVx4Ep9rnVKnH2lNr2zrP9Qhyqy99nM0aMxmypIWLAuP__DwLj4t99M4sU29c48CAq1egHfccSFjzpNuetOTCA71EJuokt70pm0OmGzgTyvjuR7VTLxd5PMXitBowSn8_cphmnFpT8tkTiuy8CH0R3DU7MOuINomDD1s8-yPBcVAVTPUnwJiauNuzestLQKMLlhT5wn-cAbYk36XRKdgkjSc2AkhHRl4WDqT1nzWYdh_DVIYSLiKSktkPO9ovMrRYiPtozfhl0m9SR9Ll0wXtcnnDlWXc_MSGpw18vmUBSJ4PIhkiFsvLn-db3wUkA8uve-iqqfk0sxlGWughWx03kGmZDmprWbXugCBHfsI4X93w4exznXH_tapxPnmjbhVUQR6p41MvO2lcHWPLwGJgLIoejBHpnn3TmMN0UjFZki7q9B_dJ3fXh0mX9DzAlC0sil1NgCPhMPq02393_giinQquMknrBvgKxGSfGUrDKuflCx611ZZlRM3R7YMX2OIy1g4DyhPzBVjxRMtm8PnIs3m3Hi-O-C_PHF93w9J8Wqd0yIw7SpavDqZXLPC6Cqi8K7MBZyVECXHtRj1bBqT-h_xZmFCDjSU0NqfOdgApE",
+ p: "9NrXwq4kY9kBBOwLoFZVQc4kJI_NbKa_W9FLdQdRIbMsZZHXJ3XDUR9vJAcaaR75WwIC7X6N55nVtWTq28Bys9flJ9RrCTfciOntHEphBhYaL5ZTUl-6khYmsOf_psff2VaOOCvHGff5ejuOmBQxkw2E-cv7knRgWFHoLWpku2NJIMuGHt9ks7OAUfIZVYl9YJnw4FYUzhgaxemknjLeZ8XTkGW2zckzF-d95YI9i8zD80Umubsw-YxriSfqFQ0rGHBsbQ8ZOTd_KJju42BWnXIjNDYmjFUqdzVjI4XQ8EGrCEf_8_iwphGyXD7LOJ4fqd97B3bYpoRTPnCgY_SEHQ",
+ q: "5J758_NeKr1XPZiLxXohYQQnh0Lb4QtGZ1xzCgjhBQLcIBeTOG_tYjCues9tmLt93LpJfypSJ-SjDLwkR2s069_IByYGpxyeGtV-ulqYhSw1nD2CXKMDGyO5jXDs9tJrS_UhfobXKQH03CRdFugyPkSNmXY-AafFynG7xLr7oYBC05FnhUXPm3VBTPt9K-BpqwYd_h9vkAWeprSPo83UlwcLMupSJY9LaHxhRdz2yi0ZKNwXXHRwcszGjDBvvzUcCYbqWqjzbEvFY6KtH8Jh4LhM46rHaoEOTernJsDF6a6W8Df88RthqTExcwnaQf0O_dlbjSxEIPfbxx8t1EQugw",
+ dp: "4Y7Hu5tYAnLhMXuQqj9dgqU3PkcKYdCp7xc6f7Ah2P2JJHfYz4z4RD7Ez1eLyNKzulZ8A_PVHUjlSZiRkaYTBAEaJDrV70P6cFWuC6WpA0ZREQ1V7EgrQnANbGILa8QsPbYyhSQu4YlB1IwQq5_OmzyVBtgWA7AZIMMzMsMT0FuB_if-gWohBjmRN-vh0p45VUf6UW568-_YmgDFmMYbg1UFs7s_TwrNenPR0h7MO4CB8hP9vJLoZrooRczzIjljPbwy5bRG9CJfjTJ0vhj9MUT3kR1hHV1HJVGU5iBbfTfBKnvJGSI6-IDM4ZUm-B0R5hbs6s9cfOjhFmACIJIbMQ",
+ dq: "gT4iPbfyHyVEwWyQb4X4grjvg7bXSKSwG1SXMDAOzV9tg7LwJjKYNy8gJAtJgNNVdsfVLs-E_Epzpoph1AIWO9YZZXkov6Yc9zyEVONMX9S7ReU74hTBd8E9b2lMfMg9ogYk9jtSPTt-6kigW4fOh4cHqZ6_tP3cgfLD3JZ8FDPHE4WaySvLDq49yUBO5dQKyIU_xV6OGhQjOUjP_yEoMmzn9tOittsIHTxbXTxqQ6c1FvU9O6YTv8Jl5_Cl66khfX1I1RG38xvurcHULyUbYgeuZ_Iuo9XreT73h9_owo9RguGT29XH4vcNZmRGf5GIvRb4e5lvtleIZkwJA3u78w",
+ qi: "JHmVKb1zwW5iRR6RCeexYnh2fmY-3DrPSdM8Dxhr0F8dayi-tlRqEdnG0hvp45n8gLUskWWcB9EXlUJObZGKDfGuxgMa3g_xeLA2vmFQ12MxPsyH4iCNZvsgmGxx7TuOHrnDh5EBVnM4_de63crEJON2sYI8Ozi-xp2OEmAr2seWKq4sxkFni6exLhqb-NE4m9HMKlng1EtQh2rLBFG1VYD3SYYpMLc5fxzqGvSxn3Fa-Xgg-IZPY3ubrcm52KYgmLUGmnYStfVqGSWSdhDXHlNgI5pdAA0FzpyBk3ZX-JsxhwcnneKrYBBweq06kRMGWgvdbdAQ-7wSeGqqj5VPwA"
+ }
+ },
+
+ };
+
+ // combinations to test
+ var testVectors = [
+ {name: "RSA-OAEP", privateUsages: ["decrypt", "unwrapKey"], publicUsages: ["encrypt", "wrapKey"]},
+ {name: "RSA-PSS", privateUsages: ["sign"], publicUsages: ["verify"]},
+ {name: "RSASSA-PKCS1-v1_5", privateUsages: ["sign"], publicUsages: ["verify"]}
+ ];
+
+ // TESTS ARE HERE:
+ // Test every test vector, along with all available key data
+ testVectors.forEach(function(vector) {
+ sizes.forEach(function(size) {
+
+ hashes.forEach(function(hash) {
+ [true, false].forEach(function(extractable) {
+
+ // Test public keys first
+ allValidUsages(vector.publicUsages, true).forEach(function(usages) {
+ ['spki', 'jwk'].forEach(function(format) {
+ var algorithm = {name: vector.name, hash: hash};
+ var data = keyData[size];
+ if (format === "jwk") { // Not all fields used for public keys
+ data = {jwk: {kty: keyData[size].jwk.kty, n: keyData[size].jwk.n, e: keyData[size].jwk.e}};
+ }
+
+ testFormat(format, algorithm, data, size, usages, extractable);
+ });
+
+ });
+
+ // Next, test private keys
+ ['pkcs8', 'jwk'].forEach(function(format) {
+ var algorithm = {name: vector.name, hash: hash};
+ var data = keyData[size];
+ allValidUsages(vector.privateUsages).forEach(function(usages) {
+ testFormat(format, algorithm, data, size, usages, extractable);
+ });
+ testEmptyUsages(format, algorithm, data, size, extractable);
+ });
+ });
+ });
+
+ });
+ });
+
+
+ // Test importKey with a given key format and other parameters. If
+ // extrable is true, export the key and verify that it matches the input.
+ function testFormat(format, algorithm, keyData, keySize, usages, extractable) {
+ promise_test(function(test) {
+ return subtle.importKey(format, keyData[format], algorithm, extractable, usages).
+ then(function(key) {
+ assert_equals(key.constructor, CryptoKey, "Imported a CryptoKey object");
+ assert_goodCryptoKey(key, algorithm, extractable, usages, (format === 'pkcs8' || (format === 'jwk' && keyData[format].d)) ? 'private' : 'public');
+ if (!extractable) {
+ return;
+ }
+
+ return subtle.exportKey(format, key).
+ then(function(result) {
+ if (format !== "jwk") {
+ assert_true(equalBuffers(keyData[format], result), "Round trip works");
+ } else {
+ assert_true(equalJwk(keyData[format], result), "Round trip works");
+ }
+ }, function(err) {
+ assert_unreached("Threw an unexpected error: " + err.toString());
+ });
+ }, function(err) {
+ assert_unreached("Threw an unexpected error: " + err.toString());
+ });
+ }, "Good parameters: " + keySize.toString() + " bits " + parameterString(format, keyData[format], algorithm, extractable, usages));
+ }
+
+ // Test importKey with a given key format and other parameters but with empty usages.
+ // Should fail with SyntaxError
+ function testEmptyUsages(format, algorithm, keyData, keySize, extractable) {
+ const usages = [];
+ promise_test(function(test) {
+ return subtle.importKey(format, keyData[format], algorithm, extractable, usages).
+ then(function(key) {
+ assert_unreached("importKey succeeded but should have failed with SyntaxError");
+ }, function(err) {
+ assert_equals(err.name, "SyntaxError", "Should throw correct error, not " + err.name + ": " + err.message);
+ });
+ }, "Empty Usages: " + keySize.toString() + " bits " + parameterString(format, keyData, algorithm, extractable, usages));
+ }
+
+
+
+ // Helper methods follow:
+
+ // Are two array buffers the same?
+ function equalBuffers(a, b) {
+ if (a.byteLength !== b.byteLength) {
+ return false;
+ }
+
+ var aBytes = new Uint8Array(a);
+ var bBytes = new Uint8Array(b);
+
+ for (var i=0; i<a.byteLength; i++) {
+ if (aBytes[i] !== bBytes[i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // Are two Jwk objects "the same"? That is, does the object returned include
+ // matching values for each property that was expected? It's okay if the
+ // returned object has extra methods; they aren't checked.
+ function equalJwk(expected, got) {
+ var fields = Object.keys(expected);
+ var fieldName;
+
+ for(var i=0; i<fields.length; i++) {
+ fieldName = fields[i];
+ if (!(fieldName in got)) {
+ return false;
+ }
+ if (expected[fieldName] !== got[fieldName]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // Build minimal Jwk objects from raw key data and algorithm specifications
+ function jwkData(keyData, algorithm) {
+ var result = {
+ kty: "oct",
+ k: byteArrayToUnpaddedBase64(keyData)
+ };
+
+ if (algorithm.name.substring(0, 3) === "AES") {
+ result.alg = "A" + (8 * keyData.byteLength).toString() + algorithm.name.substring(4);
+ } else if (algorithm.name === "HMAC") {
+ result.alg = "HS" + algorithm.hash.substring(4);
+ }
+ return result;
+ }
+
+ // Jwk format wants Base 64 without the typical padding at the end.
+ function byteArrayToUnpaddedBase64(byteArray){
+ var binaryString = "";
+ for (var i=0; i<byteArray.byteLength; i++){
+ binaryString += String.fromCharCode(byteArray[i]);
+ }
+ var base64String = btoa(binaryString);
+
+ return base64String.replace(/=/g, "");
+ }
+
+ // Convert method parameters to a string to uniquely name each test
+ function parameterString(format, data, algorithm, extractable, usages) {
+ if ("byteLength" in data) {
+ data = "buffer(" + data.byteLength.toString() + ")";
+ } else {
+ data = "object(" + Object.keys(data).join(", ") + ")";
+ }
+ var result = "(" +
+ objectToString(format) + ", " +
+ objectToString(data) + ", " +
+ objectToString(algorithm) + ", " +
+ objectToString(extractable) + ", " +
+ objectToString(usages) +
+ ")";
+
+ return result;
+ }
+
+ // Character representation of any object we may use as a parameter.
+ function objectToString(obj) {
+ var keyValuePairs = [];
+
+ if (Array.isArray(obj)) {
+ return "[" + obj.map(function(elem){return objectToString(elem);}).join(", ") + "]";
+ } else if (typeof obj === "object") {
+ Object.keys(obj).sort().forEach(function(keyName) {
+ keyValuePairs.push(keyName + ": " + objectToString(obj[keyName]));
+ });
+ return "{" + keyValuePairs.join(", ") + "}";
+ } else if (typeof obj === "undefined") {
+ return "undefined";
+ } else {
+ return obj.toString();
+ }
+
+ var keyValuePairs = [];
+
+ Object.keys(obj).sort().forEach(function(keyName) {
+ var value = obj[keyName];
+ if (typeof value === "object") {
+ value = objectToString(value);
+ } else if (typeof value === "array") {
+ value = "[" + value.map(function(elem){return objectToString(elem);}).join(", ") + "]";
+ } else {
+ value = value.toString();
+ }
+
+ keyValuePairs.push(keyName + ": " + value);
+ });
+
+ return "{" + keyValuePairs.join(", ") + "}";
+ }
|
134f43ba12488201fab7cf43fbf525040fecbb57
|
2021-11-16 06:19:48
|
Hendiadyoin1
|
profiler: Don't try to disassemble empty buffers
| false
|
Don't try to disassemble empty buffers
|
profiler
|
diff --git a/Userland/DevTools/Profiler/DisassemblyModel.cpp b/Userland/DevTools/Profiler/DisassemblyModel.cpp
index 5daf43b425f6..4e6dd9cb7c80 100644
--- a/Userland/DevTools/Profiler/DisassemblyModel.cpp
+++ b/Userland/DevTools/Profiler/DisassemblyModel.cpp
@@ -97,6 +97,10 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
dbgln("DisassemblyModel: symbol not found");
return;
}
+ if (!symbol.value().raw_data().length()) {
+ dbgln("DisassemblyModel: Found symbol without code");
+ return;
+ }
VERIFY(symbol.has_value());
auto symbol_offset_from_function_start = node.address() - base_address - symbol->value();
|
4db05ecf69bee07a060f2e4513e9d53b6110dcc4
|
2024-06-28 20:40:52
|
Andreas Kling
|
libweb: Set the correct prototype for SVGAElement instances
| false
|
Set the correct prototype for SVGAElement instances
|
libweb
|
diff --git a/Tests/LibWeb/Text/expected/SVG/a-element-prototype.txt b/Tests/LibWeb/Text/expected/SVG/a-element-prototype.txt
new file mode 100644
index 000000000000..27ba77ddaf61
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/SVG/a-element-prototype.txt
@@ -0,0 +1 @@
+true
diff --git a/Tests/LibWeb/Text/input/SVG/a-element-prototype.html b/Tests/LibWeb/Text/input/SVG/a-element-prototype.html
new file mode 100644
index 000000000000..fba38cfa4689
--- /dev/null
+++ b/Tests/LibWeb/Text/input/SVG/a-element-prototype.html
@@ -0,0 +1,7 @@
+<script src="../include.js"></script>
+<script>
+ test(() => {
+ let a = document.createElementNS("http://www.w3.org/2000/svg", "a");
+ println(a.__proto__ === SVGAElement.prototype);
+ });
+</script>
diff --git a/Userland/Libraries/LibWeb/SVG/SVGAElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGAElement.cpp
index 04af8c846a3a..a2b480d894e3 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGAElement.cpp
+++ b/Userland/Libraries/LibWeb/SVG/SVGAElement.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <LibWeb/Bindings/SVGAElementPrototype.h>
#include <LibWeb/Layout/SVGGraphicsBox.h>
#include <LibWeb/SVG/SVGAElement.h>
@@ -18,6 +19,12 @@ SVGAElement::SVGAElement(DOM::Document& document, DOM::QualifiedName qualified_n
SVGAElement::~SVGAElement() = default;
+void SVGAElement::initialize(JS::Realm& realm)
+{
+ Base::initialize(realm);
+ WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAElement);
+}
+
JS::GCPtr<Layout::Node> SVGAElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
diff --git a/Userland/Libraries/LibWeb/SVG/SVGAElement.h b/Userland/Libraries/LibWeb/SVG/SVGAElement.h
index c18e1f9d6dde..98bc1d12f319 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGAElement.h
+++ b/Userland/Libraries/LibWeb/SVG/SVGAElement.h
@@ -17,9 +17,11 @@ class SVGAElement final : public SVGGraphicsElement {
public:
virtual ~SVGAElement() override;
- SVGAElement(DOM::Document&, DOM::QualifiedName);
-
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
+
+private:
+ SVGAElement(DOM::Document&, DOM::QualifiedName);
+ virtual void initialize(JS::Realm&) override;
};
}
|
a533ea7ae694a0e72be05e5ce63a6098613a3852
|
2023-02-09 00:17:15
|
Rodrigo Tobar
|
libpdf: Improve stream parsing
| false
|
Improve stream parsing
|
libpdf
|
diff --git a/Userland/Libraries/LibPDF/Document.h b/Userland/Libraries/LibPDF/Document.h
index 85a64baa00b1..bbb7bc164f5b 100644
--- a/Userland/Libraries/LibPDF/Document.h
+++ b/Userland/Libraries/LibPDF/Document.h
@@ -119,6 +119,11 @@ class Document final
return cast_to<T>(TRY(resolve(value)));
}
+ /// Whether this Document is reasdy to resolve references, which is usually
+ /// true, except just before the XRef table is parsed (and while the linearization
+ /// dict is being read).
+ bool can_resolve_refefences() { return m_parser->can_resolve_references(); }
+
private:
explicit Document(NonnullRefPtr<DocumentParser> const& parser);
diff --git a/Userland/Libraries/LibPDF/DocumentParser.h b/Userland/Libraries/LibPDF/DocumentParser.h
index 590bca7f1a28..0f58821a73b2 100644
--- a/Userland/Libraries/LibPDF/DocumentParser.h
+++ b/Userland/Libraries/LibPDF/DocumentParser.h
@@ -25,6 +25,8 @@ class DocumentParser final : public RefCounted<DocumentParser>
// Parses the header and initializes the xref table and trailer
PDFErrorOr<void> initialize();
+ bool can_resolve_references() { return m_xref_table; };
+
PDFErrorOr<Value> parse_object_with_index(u32 index);
// Specialized version of parse_dict which aborts early if the dict being parsed
diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp
index a51f0f8e53a8..374230a49bc3 100644
--- a/Userland/Libraries/LibPDF/Parser.cpp
+++ b/Userland/Libraries/LibPDF/Parser.cpp
@@ -446,7 +446,7 @@ PDFErrorOr<NonnullRefPtr<StreamObject>> Parser::parse_stream(NonnullRefPtr<DictO
ReadonlyBytes bytes;
auto maybe_length = dict->get(CommonNames::Length);
- if (maybe_length.has_value() && (!maybe_length->has<Reference>())) {
+ if (maybe_length.has_value() && m_document->can_resolve_refefences()) {
// The PDF writer has kindly provided us with the direct length of the stream
m_reader.save();
auto length = TRY(m_document->resolve_to<int>(maybe_length.value()));
@@ -457,17 +457,13 @@ PDFErrorOr<NonnullRefPtr<StreamObject>> Parser::parse_stream(NonnullRefPtr<DictO
} else {
// We have to look for the endstream keyword
auto stream_start = m_reader.offset();
-
- while (true) {
- m_reader.move_until([&](auto) { return m_reader.matches_eol(); });
- auto potential_stream_end = m_reader.offset();
- m_reader.consume_eol();
- if (!m_reader.matches("endstream"))
- continue;
-
- bytes = m_reader.bytes().slice(stream_start, potential_stream_end - stream_start);
- break;
+ while (!m_reader.matches("endstream")) {
+ m_reader.consume();
+ m_reader.move_until('e');
}
+ auto stream_end = m_reader.offset();
+ m_reader.consume_eol();
+ bytes = m_reader.bytes().slice(stream_start, stream_end - stream_start);
}
m_reader.move_by(9);
|
94bfde2a3851e5d6ac09c2f4848b0336dcf91271
|
2021-01-26 03:01:43
|
Zac
|
texteditor: Fix bug in delete_current_line() when deleting the last line
| false
|
Fix bug in delete_current_line() when deleting the last line
|
texteditor
|
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp
index 3798a50c5bb5..d4b916b99478 100644
--- a/Userland/Libraries/LibGUI/TextEditor.cpp
+++ b/Userland/Libraries/LibGUI/TextEditor.cpp
@@ -770,7 +770,7 @@ void TextEditor::delete_current_line()
start = { 0, 0 };
end = { 0, line(0).length() };
} else if (m_cursor.line() == line_count() - 1) {
- start = { m_cursor.line() - 1, line(m_cursor.line()).length() };
+ start = { m_cursor.line() - 1, line(m_cursor.line() - 1).length() };
end = { m_cursor.line(), line(m_cursor.line()).length() };
} else {
start = { m_cursor.line(), 0 };
|
50336dc6ff2e52b2997e86b0c547fcfd4f839c7f
|
2020-05-18 13:06:00
|
jarhill0
|
base: Add splashing sweat emoji (U+1F4A6) 💦
| false
|
Add splashing sweat emoji (U+1F4A6) 💦
|
base
|
diff --git a/Base/home/anon/emoji.txt b/Base/home/anon/emoji.txt
index c8902841b652..8901620b22ac 100644
--- a/Base/home/anon/emoji.txt
+++ b/Base/home/anon/emoji.txt
@@ -5,6 +5,7 @@
👀 - U+1F440 EYES
👍 - U+1F44D THUMBS UP SIGN
👎 - U+1F44E THUMBS DOWN SIGN
+💦 - U+1F4A6 SWEAT DROPLETS
🔥 - U+1F525 FIRE
😀 - U+1F600 GRINNING FACE
😂 - U+1F602 FACE WITH TEARS OF JOY
diff --git a/Base/res/emoji/U+1F4A6.png b/Base/res/emoji/U+1F4A6.png
new file mode 100644
index 000000000000..855604d08ed5
Binary files /dev/null and b/Base/res/emoji/U+1F4A6.png differ
|
6c9f1c396ab420368fb5b82f32a6cdded0ad1850
|
2023-08-18 08:56:04
|
MacDue
|
libweb: Don't use CSSPixels when resolving radial gradient color stops
| false
|
Don't use CSSPixels when resolving radial gradient color stops
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/Painting/GradientPainting.cpp b/Userland/Libraries/LibWeb/Painting/GradientPainting.cpp
index b5fce6819032..0a7999cafbcc 100644
--- a/Userland/Libraries/LibWeb/Painting/GradientPainting.cpp
+++ b/Userland/Libraries/LibWeb/Painting/GradientPainting.cpp
@@ -140,7 +140,7 @@ RadialGradientData resolve_radial_gradient_data(Layout::NodeWithStyleAndBoxModel
// Start center, goes right to ending point, where the gradient line intersects the ending shape
auto resolved_color_stops = resolve_color_stop_positions(
node, radial_gradient.color_stop_list(), [&](auto const& length_percentage) {
- return (length_percentage.to_px(node, gradient_size.width()) / gradient_size.width()).to_float();
+ return length_percentage.to_px(node, gradient_size.width()).to_float() / gradient_size.width().to_float();
},
radial_gradient.is_repeating());
return { resolved_color_stops };
|
f25530a12d54cac620d81acb405c58ba16fe0e4b
|
2023-06-09 20:45:41
|
Tim Ledbetter
|
kernel: Store creation time when creating a process
| false
|
Store creation time when creating a process
|
kernel
|
diff --git a/Kernel/Tasks/Process.cpp b/Kernel/Tasks/Process.cpp
index ffeb4a005563..6f78745af2f0 100644
--- a/Kernel/Tasks/Process.cpp
+++ b/Kernel/Tasks/Process.cpp
@@ -291,7 +291,7 @@ ErrorOr<Process::ProcessAndFirstThread> Process::create(NonnullOwnPtr<KString> n
auto exec_unveil_tree = UnveilNode { TRY(KString::try_create("/"sv)), UnveilMetadata(TRY(KString::try_create("/"sv))) };
auto credentials = TRY(Credentials::create(uid, gid, uid, gid, uid, gid, {}, fork_parent ? fork_parent->sid() : 0, fork_parent ? fork_parent->pgid() : 0));
- auto process = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Process(move(name), move(credentials), ppid, is_kernel_process, move(current_directory), move(executable), tty, move(unveil_tree), move(exec_unveil_tree))));
+ auto process = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Process(move(name), move(credentials), ppid, is_kernel_process, move(current_directory), move(executable), tty, move(unveil_tree), move(exec_unveil_tree), kgettimeofday())));
OwnPtr<Memory::AddressSpace> new_address_space;
if (fork_parent) {
@@ -308,11 +308,12 @@ ErrorOr<Process::ProcessAndFirstThread> Process::create(NonnullOwnPtr<KString> n
return ProcessAndFirstThread { move(process), move(first_thread) };
}
-Process::Process(NonnullOwnPtr<KString> name, NonnullRefPtr<Credentials> credentials, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> current_directory, RefPtr<Custody> executable, RefPtr<TTY> tty, UnveilNode unveil_tree, UnveilNode exec_unveil_tree)
+Process::Process(NonnullOwnPtr<KString> name, NonnullRefPtr<Credentials> credentials, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> current_directory, RefPtr<Custody> executable, RefPtr<TTY> tty, UnveilNode unveil_tree, UnveilNode exec_unveil_tree, UnixDateTime creation_time)
: m_name(move(name))
, m_is_kernel_process(is_kernel_process)
, m_executable(move(executable))
, m_current_directory(move(current_directory))
+ , m_creation_time(creation_time)
, m_unveil_data(move(unveil_tree))
, m_exec_unveil_data(move(exec_unveil_tree))
, m_wait_blocker_set(*this)
diff --git a/Kernel/Tasks/Process.h b/Kernel/Tasks/Process.h
index 19ebfbb8131c..91cb1927a8f2 100644
--- a/Kernel/Tasks/Process.h
+++ b/Kernel/Tasks/Process.h
@@ -482,6 +482,8 @@ class Process final
RefPtr<Custody> executable();
RefPtr<Custody const> executable() const;
+ UnixDateTime creation_time() const { return m_creation_time; };
+
static constexpr size_t max_arguments_size = Thread::default_userspace_stack_size / 8;
static constexpr size_t max_environment_size = Thread::default_userspace_stack_size / 8;
static constexpr size_t max_auxiliary_size = Thread::default_userspace_stack_size / 8;
@@ -608,7 +610,7 @@ class Process final
bool add_thread(Thread&);
bool remove_thread(Thread&);
- Process(NonnullOwnPtr<KString> name, NonnullRefPtr<Credentials>, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> current_directory, RefPtr<Custody> executable, RefPtr<TTY> tty, UnveilNode unveil_tree, UnveilNode exec_unveil_tree);
+ Process(NonnullOwnPtr<KString> name, NonnullRefPtr<Credentials>, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> current_directory, RefPtr<Custody> executable, RefPtr<TTY> tty, UnveilNode unveil_tree, UnveilNode exec_unveil_tree, UnixDateTime creation_time);
static ErrorOr<ProcessAndFirstThread> create(NonnullOwnPtr<KString> name, UserID, GroupID, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> current_directory = nullptr, RefPtr<Custody> executable = nullptr, RefPtr<TTY> = nullptr, Process* fork_parent = nullptr);
ErrorOr<NonnullRefPtr<Thread>> attach_resources(NonnullOwnPtr<Memory::AddressSpace>&&, Process* fork_parent);
static ProcessID allocate_pid();
@@ -856,6 +858,8 @@ class Process final
SpinlockProtected<RefPtr<Custody>, LockRank::None> m_current_directory;
+ UnixDateTime const m_creation_time;
+
Vector<NonnullOwnPtr<KString>> m_arguments;
Vector<NonnullOwnPtr<KString>> m_environment;
|
0e5e6f2e08117a0911a94d43db045c89e04c7915
|
2021-08-13 02:20:35
|
sin-ack
|
base: Convert postcreate scripts to use heredoc
| false
|
Convert postcreate scripts to use heredoc
|
base
|
diff --git a/Base/res/devel/templates/cpp-basic.postcreate b/Base/res/devel/templates/cpp-basic.postcreate
index 497471f45278..caa7f94cc996 100644
--- a/Base/res/devel/templates/cpp-basic.postcreate
+++ b/Base/res/devel/templates/cpp-basic.postcreate
@@ -1,19 +1,21 @@
#!/bin/sh
-echo "PROGRAM = $1" >> $2/Makefile
-echo "OBJS = main.o" >> $2/Makefile
-echo "CXXFLAGS = -g -std=c++2a" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "all: \$(PROGRAM)" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "\$(PROGRAM): \$(OBJS)" >> $2/Makefile
-echo " \$(CXX) -o \$@ \$(OBJS)" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "%.o: %.cpp" >> $2/Makefile
-echo " \$(CXX) \$(CXXFLAGS) -o \$@ -c \$< " >> $2/Makefile
-echo "" >> $2/Makefile
-echo "clean:" >> $2/Makefile
-echo " rm \$(OBJS) \$(PROGRAM)" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "run:" >> $2/Makefile
-echo " ./\$(PROGRAM)" >> $2/Makefile
+echo > $2/Makefile <<-EOF
+PROGRAM = $1
+OBJS = main.o
+CXXFLAGS = -g -std=c++2a
+
+all: \$(PROGRAM)
+
+\$(PROGRAM): \$(OBJS)
+ \$(CXX) -o \$@ \$(OBJS)
+
+%.o: %.cpp
+ \$(CXX) \$(CXXFLAGS) -o \$@ -c \$<
+
+clean:
+ rm \$(OBJS) \$(PROGRAM)
+
+run:
+ ./\$(PROGRAM)
+EOF
diff --git a/Base/res/devel/templates/cpp-gui.postcreate b/Base/res/devel/templates/cpp-gui.postcreate
index 822de7f1f7dd..141dd4d3b3bf 100644
--- a/Base/res/devel/templates/cpp-gui.postcreate
+++ b/Base/res/devel/templates/cpp-gui.postcreate
@@ -1,19 +1,22 @@
#!/bin/sh
-echo "PROGRAM = $1" >> $2/Makefile
-echo "OBJS = main.o" >> $2/Makefile
-echo "CXXFLAGS = -lgui -g -std=c++2a" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "all: \$(PROGRAM)" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "\$(PROGRAM): \$(OBJS)" >> $2/Makefile
-echo " \$(CXX) \$(CXXFLAGS) -o \$@ \$(OBJS)" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "%.o: %.cpp" >> $2/Makefile
-echo " \$(CXX) \$(CXXFLAGS) -o \$@ -c \$< " >> $2/Makefile
-echo "" >> $2/Makefile
-echo "clean:" >> $2/Makefile
-echo " rm \$(OBJS) \$(PROGRAM)" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "run:" >> $2/Makefile
-echo " ./\$(PROGRAM)" >> $2/Makefile
+echo > $2/Makefile <<-EOF
+PROGRAM = $1
+OBJS = main.o
+CXXFLAGS = -g -std=c++2a
+LDFLAGS = -lgui
+
+all: \$(PROGRAM)
+
+\$(PROGRAM): \$(OBJS)
+ \$(CXX) \$(LDFLAGS) -o \$@ \$(OBJS)
+
+%.o: %.cpp
+ \$(CXX) \$(CXXFLAGS) -o \$@ -c \$<
+
+clean:
+ rm \$(OBJS) \$(PROGRAM)
+
+run:
+ ./\$(PROGRAM)
+EOF
diff --git a/Base/res/devel/templates/cpp-library.postcreate b/Base/res/devel/templates/cpp-library.postcreate
index 3f4a254ebbe4..ba62fec9b3fd 100644
--- a/Base/res/devel/templates/cpp-library.postcreate
+++ b/Base/res/devel/templates/cpp-library.postcreate
@@ -5,45 +5,51 @@
# $3: Project name, namespace safe
# Generate Makefile
-echo "LIBRARY = $1.so" >> $2/Makefile
-echo "OBJS = Class1.o" >> $2/Makefile
-echo "CXXFLAGS = -g -std=c++2a" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "all: \$(LIBRARY)" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "\$(LIBRARY): \$(OBJS)" >> $2/Makefile
-echo " \$(CXX) -shared -o \$@ \$(OBJS)" >> $2/Makefile
-echo "" >> $2/Makefile
-echo "%.o: %.cpp" >> $2/Makefile
-echo " \$(CXX) \$(CXXFLAGS) -fPIC -o \$@ -c \$< " >> $2/Makefile
-echo "" >> $2/Makefile
-echo "clean:" >> $2/Makefile
-echo " rm \$(OBJS) \$(LIBRARY)" >> $2/Makefile
-echo "" >> $2/Makefile
+echo > $2/Makefile <<-EOF
+LIBRARY = $1.so
+OBJS = Class1.o
+CXXFLAGS = -g -std=c++2a
+
+all: \$(LIBRARY)
+
+\$(LIBRARY): \$(OBJS)
+ \$(CXX) -shared -o \$@ \$(OBJS)
+
+%.o: %.cpp
+ \$(CXX) \$(CXXFLAGS) -fPIC -o \$@ -c \$<
+
+clean:
+ rm \$(OBJS) \$(LIBRARY)
+
+EOF
# Generate 'Class1' header file
-echo "#pragma once" >> $2/Class1.h
-echo "" >> $2/Class1.h
-echo "namespace $3 {" >> $2/Class1.h
-echo "" >> $2/Class1.h
-echo "class Class1 {" >> $2/Class1.h
-echo "public:" >> $2/Class1.h
-echo " void hello();" >> $2/Class1.h
-echo "};" >> $2/Class1.h
-echo "" >> $2/Class1.h
-echo "}" >> $2/Class1.h
-echo "" >> $2/Class1.h
+echo > $2/Class1.h <<-EOF
+#pragma once
+
+namespace $3 {
+
+class Class1 {
+public:
+ void hello();
+};
+
+}
+
+EOF
# Generate 'Class1' source file
-echo "#include \"Class1.h\"" >> $2/Class1.cpp
-echo "#include <stdio.h>" >> $2/Class1.cpp
-echo "" >> $2/Class1.cpp
-echo "namespace $3 {" >> $2/Class1.cpp
-echo "" >> $2/Class1.cpp
-echo "void Class1::hello()" >> $2/Class1.cpp
-echo "{" >> $2/Class1.cpp
-echo " printf(\"Hello friends! :^)\\n\");" >> $2/Class1.cpp
-echo "}" >> $2/Class1.cpp
-echo "" >> $2/Class1.cpp
-echo "}" >> $2/Class1.cpp
-echo "" >> $2/Class1.cpp
+echo > $2/Class1.cpp <<-EOF
+#include "Class1.h"
+#include <stdio.h>
+
+namespace $3 {
+
+void Class1::hello()
+{
+ printf("Hello friends! :^)\\n");
+}
+
+}
+
+EOF
|
43da941de53398d3fec198880bddde5bd08b4c86
|
2019-12-27 02:43:50
|
Andreas Kling
|
libgui: Use NeverDestroyed<T> for the global GWindow tables
| false
|
Use NeverDestroyed<T> for the global GWindow tables
|
libgui
|
diff --git a/Libraries/LibGUI/GWindow.cpp b/Libraries/LibGUI/GWindow.cpp
index 3533a4c7a909..7860c9ece1d8 100644
--- a/Libraries/LibGUI/GWindow.cpp
+++ b/Libraries/LibGUI/GWindow.cpp
@@ -1,5 +1,6 @@
#include <AK/HashMap.h>
#include <AK/JsonObject.h>
+#include <AK/NeverDestroyed.h>
#include <AK/StringBuilder.h>
#include <LibC/SharedBuffer.h>
#include <LibC/stdio.h>
@@ -15,13 +16,13 @@
//#define UPDATE_COALESCING_DEBUG
-static HashTable<GWindow*> all_windows;
-static HashMap<int, GWindow*> reified_windows;
+static NeverDestroyed<HashTable<GWindow*>> all_windows;
+static NeverDestroyed<HashMap<int, GWindow*>> reified_windows;
GWindow* GWindow::from_window_id(int window_id)
{
- auto it = reified_windows.find(window_id);
- if (it != reified_windows.end())
+ auto it = reified_windows->find(window_id);
+ if (it != reified_windows->end())
return (*it).value;
return nullptr;
}
@@ -29,14 +30,14 @@ GWindow* GWindow::from_window_id(int window_id)
GWindow::GWindow(CObject* parent)
: CObject(parent)
{
- all_windows.set(this);
+ all_windows->set(this);
m_rect_when_windowless = { 100, 400, 140, 140 };
m_title_when_windowless = "GWindow";
}
GWindow::~GWindow()
{
- all_windows.remove(this);
+ all_windows->remove(this);
hide();
}
@@ -74,7 +75,7 @@ void GWindow::show()
apply_icon();
- reified_windows.set(m_window_id, this);
+ reified_windows->set(m_window_id, this);
GApplication::the().did_create_window({});
update();
}
@@ -83,7 +84,7 @@ void GWindow::hide()
{
if (!m_window_id)
return;
- reified_windows.remove(m_window_id);
+ reified_windows->remove(m_window_id);
GWindowServerConnection::the().send_sync<WindowServer::DestroyWindow>(m_window_id);
m_window_id = 0;
m_pending_paint_event_rects.clear();
@@ -91,7 +92,7 @@ void GWindow::hide()
m_front_bitmap = nullptr;
bool app_has_visible_windows = false;
- for (auto& window : all_windows) {
+ for (auto& window : *all_windows) {
if (window->is_visible()) {
app_has_visible_windows = true;
break;
@@ -689,7 +690,7 @@ void GWindow::schedule_relayout()
void GWindow::update_all_windows(Badge<GWindowServerConnection>)
{
- for (auto* window : all_windows) {
+ for (auto* window : *all_windows) {
window->update();
}
}
|
e4e6e03364d24ff4a9586153bca356922945436f
|
2021-06-14 06:15:04
|
Idan Horowitz
|
libjs: Add tests for DataView.prototype getters and setters
| false
|
Add tests for DataView.prototype getters and setters
|
libjs
|
diff --git a/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.bigInt64.js b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.bigInt64.js
new file mode 100644
index 000000000000..cad4a6fdd16c
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.bigInt64.js
@@ -0,0 +1,12 @@
+test("basic functionality", () => {
+ const buffer = new ArrayBuffer(8);
+ const view = new DataView(buffer);
+ view.setBigInt64(0, -0x6f80ff08n);
+ expect(view.getBigInt64(0)).toBe(-0x6f80ff08n);
+ view.setBigInt64(0, -0x6f80ff08n, true);
+ expect(view.getBigInt64(0)).toBe(-0x7ff806f00000001n);
+ view.setBigUint64(0, 0x6f80ff08n);
+ expect(view.getBigUint64(0)).toBe(0x6f80ff08n);
+ view.setBigUint64(0, 0x6f80ff08n, true);
+ expect(view.getBigUint64(0)).toBe(0x8ff806f00000000n);
+});
diff --git a/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.float32.js b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.float32.js
new file mode 100644
index 000000000000..80376dfd10e1
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.float32.js
@@ -0,0 +1,8 @@
+test("basic functionality", () => {
+ const buffer = new ArrayBuffer(8);
+ const view = new DataView(buffer);
+ view.setFloat32(0, 6854.162);
+ expect(view.getFloat32(0)).toBe(6854.162109375);
+ view.setFloat32(0, 6854.162, true);
+ expect(view.getFloat32(0)).toBe(46618900);
+});
diff --git a/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.float64.js b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.float64.js
new file mode 100644
index 000000000000..1aad5d8585a0
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.float64.js
@@ -0,0 +1,8 @@
+test("basic functionality", () => {
+ const buffer = new ArrayBuffer(8);
+ const view = new DataView(buffer);
+ view.setFloat64(0, 6865415254.161212);
+ expect(view.getFloat64(0)).toBe(6865415254.161212);
+ view.setFloat64(0, 6865415254.161212, true);
+ expect(view.getFloat64(0)).toBe(4.2523296908380055e94);
+});
diff --git a/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.int16.js b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.int16.js
new file mode 100644
index 000000000000..6a05ca08b045
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.int16.js
@@ -0,0 +1,12 @@
+test("basic functionality", () => {
+ const buffer = new ArrayBuffer(8);
+ const view = new DataView(buffer);
+ view.setInt16(0, -0xff8);
+ expect(view.getInt16(0)).toBe(-0xff8);
+ view.setInt16(0, -0xff8, true);
+ expect(view.getInt16(0)).toBe(0x8f0);
+ view.setUint16(0, 0xff8);
+ expect(view.getUint16(0)).toBe(0xff8);
+ view.setUint16(0, 0xff8, true);
+ expect(view.getUint16(0)).toBe(0xf80f);
+});
diff --git a/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.int32.js b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.int32.js
new file mode 100644
index 000000000000..7f205dfd51ac
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.int32.js
@@ -0,0 +1,12 @@
+test("basic functionality", () => {
+ const buffer = new ArrayBuffer(8);
+ const view = new DataView(buffer);
+ view.setInt32(0, -0xff08);
+ expect(view.getInt32(0)).toBe(-0xff08);
+ view.setInt32(0, -0xff08, true);
+ expect(view.getInt32(0)).toBe(-0x7ff0001);
+ view.setUint32(0, 0xff08);
+ expect(view.getUint32(0)).toBe(0xff08);
+ view.setUint32(0, 0xff08, true);
+ expect(view.getUint32(0)).toBe(0x8ff0000);
+});
diff --git a/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.int8.js b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.int8.js
new file mode 100644
index 000000000000..d085e0475031
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/DataView/ArrayBuffer.prototype.int8.js
@@ -0,0 +1,8 @@
+test("basic functionality", () => {
+ const buffer = new ArrayBuffer(8);
+ const view = new DataView(buffer);
+ view.setInt8(0, -0x88);
+ expect(view.getInt8(0)).toBe(0x78);
+ view.setUint8(0, 0x88);
+ expect(view.getUint8(0)).toBe(0x88);
+});
|
00531573a43447b235eca39cd6df68af6257b3be
|
2024-04-06 00:58:41
|
Aliaksandr Kalenik
|
libweb: Remove `SessionHistoryTraversalQueue::process()`
| false
|
Remove `SessionHistoryTraversalQueue::process()`
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.cpp b/Userland/Libraries/LibWeb/HTML/Navigable.cpp
index d09f6b45a6b1..9615b44bc1fa 100644
--- a/Userland/Libraries/LibWeb/HTML/Navigable.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Navigable.cpp
@@ -1281,8 +1281,6 @@ WebIDL::ExceptionOr<void> Navigable::navigate(NavigateParams params)
// 1. Navigate to a fragment given navigable, url, historyHandling, userInvolvement, navigationAPIState, and navigationId.
TRY(navigate_to_a_fragment(url, to_history_handling_behavior(history_handling), user_involvement, navigation_api_state, navigation_id));
- traversable_navigable()->process_session_history_traversal_queue();
-
// 2. Return.
return {};
}
@@ -1934,9 +1932,6 @@ void perform_url_and_history_update_steps(DOM::Document& document, URL::URL new_
// 1. Finalize a same-document navigation given traversable, navigable, newEntry, and entryToReplace.
finalize_a_same_document_navigation(*traversable, *navigable, new_entry, entry_to_replace, history_handling);
});
-
- // FIXME: Implement synchronous session history steps.
- traversable->process_session_history_traversal_queue();
}
void Navigable::scroll_offset_did_change()
diff --git a/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.h b/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.h
index 6ece5c0ca73c..88dace3641e5 100644
--- a/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.h
+++ b/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.h
@@ -57,14 +57,6 @@ class SessionHistoryTraversalQueue {
return index.has_value() ? m_queue.take(*index) : SessionHistoryTraversalQueueEntry {};
}
- void process()
- {
- while (m_queue.size() > 0) {
- auto entry = m_queue.take_first();
- entry.steps();
- }
- }
-
private:
Vector<SessionHistoryTraversalQueueEntry> m_queue;
RefPtr<Core::Timer> m_timer;
diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
index f065cfb4de67..aea131f18a57 100644
--- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
+++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
@@ -79,11 +79,6 @@ class TraversableNavigable final : public Navigable {
m_session_history_traversal_queue.append_sync(move(steps), target_navigable);
}
- void process_session_history_traversal_queue()
- {
- m_session_history_traversal_queue.process();
- }
-
Page& page() { return m_page; }
Page const& page() const { return m_page; }
|
81eb66c6ebe1547367a7761ec5a5f597612782ad
|
2025-01-13 20:14:35
|
Jelle Raaijmakers
|
ci: Remove conditional execution based on changed paths
| false
|
Remove conditional execution based on changed paths
|
ci
|
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a11f2ddf1ff2..6bd615de4619 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,34 +7,9 @@ concurrency:
cancel-in-progress: true
jobs:
- # Look at changed paths in the commit or PR to determine whether we need to run the complete CI job. If only
- # documentation or .md files were changed, we wouldn't need to compile and check anything here.
- path-changes:
- runs-on: ubuntu-24.04
- permissions:
- pull-requests: read
- outputs:
- source_excluding_docs: ${{ steps.filter.outputs.source_excluding_docs }}
- steps:
- # Only need a checkout if we're not running as part of a PR
- - uses: actions/checkout@v4
- if: github.event_name != 'pull_request'
-
- # FIXME: change into `dorny/paths-filter@v3` when https://github.com/dorny/paths-filter/pull/226 is merged
- - uses: petermetz/paths-filter@5ee2f5d4cf5d7bdd998a314a42da307e2ae1639d
- id: filter
- with:
- predicate-quantifier: every # all globs below must match
- filters: |
- source_excluding_docs:
- - '**'
- - '!Documentation/**'
- - '!*.md'
-
# CI matrix - runs the job in lagom-template.yml with different configurations.
Lagom:
- needs: path-changes
- if: github.repository == 'LadybirdBrowser/ladybird' && needs.path-changes.outputs.source_excluding_docs == 'true'
+ if: github.repository == 'LadybirdBrowser/ladybird'
strategy:
fail-fast: false
|
b7c435de173e6e8dc23ed548860e661f0e8d6c21
|
2022-02-14 16:02:17
|
Luke Wilde
|
libweb: Add support for record<K, V> types as input
| false
|
Add support for record<K, V> types as input
|
libweb
|
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
index 08a146d2e503..20e7cee7fdc6 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
@@ -461,8 +461,11 @@ static NonnullOwnPtr<Interface> parse_interface(StringView filename, StringView
bool is_parameterized_type = false;
if (lexer.consume_specific('<')) {
is_parameterized_type = true;
- // TODO: Parse multiple parameters if necessary
parameters.append(parse_type());
+ while (lexer.consume_specific(',')) {
+ consume_whitespace();
+ parameters.append(parse_type());
+ }
lexer.consume_specific('>');
}
auto nullable = lexer.consume_specific('?');
@@ -1002,6 +1005,16 @@ static CppType idl_type_name_to_cpp_type(Type const& type)
return { .name = String::formatted("{}<{}>", storage_type_name, sequence_cpp_type.name), .sequence_storage_type = SequenceStorageType::Vector };
}
+ if (type.name == "record") {
+ auto& parameterized_type = verify_cast<ParameterizedType>(type);
+ auto& record_key_type = parameterized_type.parameters[0];
+ auto& record_value_type = parameterized_type.parameters[1];
+ auto record_key_cpp_type = idl_type_name_to_cpp_type(record_key_type);
+ auto record_value_cpp_type = idl_type_name_to_cpp_type(record_value_type);
+
+ return { .name = String::formatted("OrderedHashMap<{}, {}>", record_key_cpp_type.name, record_value_cpp_type.name), .sequence_storage_type = SequenceStorageType::Vector };
+ }
+
if (is<UnionType>(type)) {
auto& union_type = verify_cast<UnionType>(type);
return { .name = union_type.to_variant(), .sequence_storage_type = SequenceStorageType::Vector };
@@ -1479,6 +1492,75 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
)~~~");
parameterized_type.generate_sequence_from_iterable(sequence_generator, acceptable_cpp_name, String::formatted("{}{}", js_name, js_suffix), String::formatted("iterator_method{}", recursion_depth), dictionaries, recursion_depth + 1);
+ } else if (parameter.type->name == "record") {
+ // https://webidl.spec.whatwg.org/#es-record
+
+ auto record_generator = scoped_generator.fork();
+ auto& parameterized_type = verify_cast<IDL::ParameterizedType>(*parameter.type);
+ record_generator.set("recursion_depth", String::number(recursion_depth));
+
+ // A record can only have two types: key type and value type.
+ VERIFY(parameterized_type.parameters.size() == 2);
+
+ // A record only allows the key to be a string.
+ VERIFY(parameterized_type.parameters[0].is_string());
+
+ // An ECMAScript value O is converted to an IDL record<K, V> value as follows:
+ // 1. If Type(O) is not Object, throw a TypeError.
+ // 2. Let result be a new empty instance of record<K, V>.
+ // 3. Let keys be ? O.[[OwnPropertyKeys]]().
+ // 4. For each key of keys:
+ // 1. Let desc be ? O.[[GetOwnProperty]](key).
+ // 2. If desc is not undefined and desc.[[Enumerable]] is true:
+ // 1. Let typedKey be key converted to an IDL value of type K.
+ // 2. Let value be ? Get(O, key).
+ // 3. Let typedValue be value converted to an IDL value of type V.
+ // 4. Set result[typedKey] to typedValue.
+ // 5. Return result.
+
+ auto record_cpp_type = IDL::idl_type_name_to_cpp_type(parameterized_type);
+ record_generator.set("record.type", record_cpp_type.name);
+
+ // If this is a recursive call to generate_to_cpp, assume that the caller has already handled converting the JS value to an object for us.
+ // This affects record types in unions for example.
+ if (recursion_depth == 0) {
+ record_generator.append(R"~~~(
+ if (!@js_name@@[email protected]_object())
+ return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObject, @js_name@@[email protected]_string_without_side_effects());
+
+ auto& @js_name@@js_suffix@_object = @js_name@@[email protected]_object();
+)~~~");
+ }
+
+ record_generator.append(R"~~~(
+ @record.type@ @cpp_name@;
+
+ auto record_keys@recursion_depth@ = TRY(@js_name@@js_suffix@_object.internal_own_property_keys());
+
+ for (auto& key@recursion_depth@ : record_keys@recursion_depth@) {
+ auto property_key@recursion_depth@ = MUST(JS::PropertyKey::from_value(global_object, key@recursion_depth@));
+
+ auto descriptor@recursion_depth@ = TRY(@js_name@@js_suffix@_object.internal_get_own_property(property_key@recursion_depth@));
+
+ if (!descriptor@[email protected]_value() || !descriptor@recursion_depth@->enumerable.has_value() || !descriptor@recursion_depth@->enumerable.value())
+ continue;
+)~~~");
+
+ IDL::Parameter key_parameter { .type = parameterized_type.parameters[0], .name = acceptable_cpp_name, .optional_default_value = {}, .extended_attributes = {} };
+ generate_to_cpp(record_generator, key_parameter, "key", String::number(recursion_depth), String::formatted("typed_key{}", recursion_depth), dictionaries, false, false, {}, false, recursion_depth + 1);
+
+ record_generator.append(R"~~~(
+ auto value@recursion_depth@ = TRY(@js_name@@js_suffix@_object.get(property_key@recursion_depth@));
+)~~~");
+
+ // FIXME: Record value types should be TypeWithExtendedAttributes, which would allow us to get [LegacyNullToEmptyString] here.
+ IDL::Parameter value_parameter { .type = parameterized_type.parameters[1], .name = acceptable_cpp_name, .optional_default_value = {}, .extended_attributes = {} };
+ generate_to_cpp(record_generator, value_parameter, "value", String::number(recursion_depth), String::formatted("typed_value{}", recursion_depth), dictionaries, false, false, {}, false, recursion_depth + 1);
+
+ record_generator.append(R"~~~(
+ @[email protected](typed_key@recursion_depth@, typed_value@recursion_depth@);
+ }
+)~~~");
} else if (is<IDL::UnionType>(*parameter.type)) {
// https://webidl.spec.whatwg.org/#es-union
@@ -1646,7 +1728,23 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
if (contains_dictionary_type)
TODO();
- // FIXME: 4. If types includes a record type, then return the result of converting V to that record type.
+ // 4. If types includes a record type, then return the result of converting V to that record type.
+ RefPtr<IDL::ParameterizedType> record_type;
+ for (auto& type : types) {
+ if (type.name == "record") {
+ record_type = verify_cast<IDL::ParameterizedType>(type);
+ break;
+ }
+ }
+
+ if (record_type) {
+ IDL::Parameter record_parameter { .type = *record_type, .name = acceptable_cpp_name, .optional_default_value = {}, .extended_attributes = {} };
+ generate_to_cpp(union_generator, record_parameter, js_name, js_suffix, "record_union_type"sv, dictionaries, false, false, {}, false, recursion_depth + 1);
+
+ union_generator.append(R"~~~(
+ return record_union_type;
+)~~~");
+ }
// FIXME: 5. If types includes a callback interface type, then return the result of converting V to that callback interface type.
|
08fa5138875899ca809fe8ddd8b6cade9c47e24a
|
2023-03-25 22:26:04
|
Sam Atkins
|
libweb: Split ShadowStyleValue out of StyleValue.{h,cpp}
| false
|
Split ShadowStyleValue out of StyleValue.{h,cpp}
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index d01584d73142..8bd8b2bd67fe 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -92,6 +92,7 @@ set(SOURCES
CSS/StyleValues/OverflowStyleValue.cpp
CSS/StyleValues/PositionStyleValue.cpp
CSS/StyleValues/RadialGradientStyleValue.cpp
+ CSS/StyleValues/ShadowStyleValue.cpp
CSS/Supports.cpp
CSS/SyntaxHighlighter/SyntaxHighlighter.cpp
CSS/Time.cpp
diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h
index 5c9ab79a8e0f..f503d380cd9c 100644
--- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h
+++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h
@@ -13,6 +13,7 @@
#include <LibWeb/CSS/Size.h>
#include <LibWeb/CSS/StyleValue.h>
#include <LibWeb/CSS/StyleValues/AbstractImageStyleValue.h>
+#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
namespace Web::CSS {
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index a94a6437521a..924e8c374df1 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -62,6 +62,7 @@
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
#include <LibWeb/CSS/StyleValues/RadialGradientStyleValue.h>
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
+#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Dump.h>
#include <LibWeb/Infra/Strings.h>
diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
index e59c5995855b..086cb711b496 100644
--- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
+++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
@@ -28,6 +28,7 @@
#include <LibWeb/CSS/StyleValues/NumericStyleValue.h>
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
+#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/Layout/Viewport.h>
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index 175e705f2245..cf930a5cb3e6 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -15,6 +15,7 @@
#include <LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h>
#include <LibWeb/CSS/StyleValues/GridTrackSizeStyleValue.h>
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>
+#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
#include <LibWeb/FontCache.h>
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/Node.h>
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
index 02883f8ebc11..b1dc817e27ed 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
@@ -45,6 +45,7 @@
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
#include <LibWeb/CSS/StyleValues/RadialGradientStyleValue.h>
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
+#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/Loader/LoadRequest.h>
@@ -1146,15 +1147,6 @@ ErrorOr<String> RectStyleValue::to_string() const
return String::formatted("rect({} {} {} {})", m_rect.top_edge, m_rect.right_edge, m_rect.bottom_edge, m_rect.left_edge);
}
-ErrorOr<String> ShadowStyleValue::to_string() const
-{
- StringBuilder builder;
- TRY(builder.try_appendff("{} {} {} {} {}", m_properties.color.to_deprecated_string(), TRY(m_properties.offset_x.to_string()), TRY(m_properties.offset_y.to_string()), TRY(m_properties.blur_radius.to_string()), TRY(m_properties.spread_distance.to_string())));
- if (m_properties.placement == ShadowPlacement::Inner)
- TRY(builder.try_append(" inset"sv));
- return builder.to_string();
-}
-
ErrorOr<String> TextDecorationStyleValue::to_string() const
{
return String::formatted("{} {} {} {}", TRY(m_properties.line->to_string()), TRY(m_properties.thickness->to_string()), TRY(m_properties.style->to_string()), TRY(m_properties.color->to_string()));
@@ -1246,15 +1238,6 @@ ValueComparingNonnullRefPtr<StyleValue const> StyleValue::absolutized(CSSPixelRe
return *this;
}
-ValueComparingNonnullRefPtr<StyleValue const> ShadowStyleValue::absolutized(CSSPixelRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, CSSPixels font_size, CSSPixels root_font_size, CSSPixels line_height, CSSPixels root_line_height) const
-{
- auto absolutized_offset_x = absolutized_length(m_properties.offset_x, viewport_rect, font_metrics, font_size, root_font_size, line_height, root_line_height).value_or(m_properties.offset_x);
- auto absolutized_offset_y = absolutized_length(m_properties.offset_y, viewport_rect, font_metrics, font_size, root_font_size, line_height, root_line_height).value_or(m_properties.offset_y);
- auto absolutized_blur_radius = absolutized_length(m_properties.blur_radius, viewport_rect, font_metrics, font_size, root_font_size, line_height, root_line_height).value_or(m_properties.blur_radius);
- auto absolutized_spread_distance = absolutized_length(m_properties.spread_distance, viewport_rect, font_metrics, font_size, root_font_size, line_height, root_line_height).value_or(m_properties.spread_distance);
- return ShadowStyleValue::create(m_properties.color, absolutized_offset_x, absolutized_offset_y, absolutized_blur_radius, absolutized_spread_distance, m_properties.placement);
-}
-
bool CalculatedStyleValue::contains_percentage() const
{
return m_expression->contains_percentage();
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h
index 1a51dd80d8eb..dc1649efb3b6 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.h
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h
@@ -52,11 +52,6 @@ enum class BackgroundSize {
LengthPercentage,
};
-enum class ShadowPlacement {
- Outer,
- Inner,
-};
-
enum class FlexBasis {
Content,
LengthPercentage,
@@ -627,46 +622,6 @@ class CalculatedStyleValue : public StyleValue {
NonnullOwnPtr<CalcSum> m_expression;
};
-class ShadowStyleValue final : public StyleValueWithDefaultOperators<ShadowStyleValue> {
-public:
- static ValueComparingNonnullRefPtr<ShadowStyleValue>
- create(Color color, Length const& offset_x, Length const& offset_y, Length const& blur_radius, Length const& spread_distance, ShadowPlacement placement)
- {
- return adopt_ref(*new ShadowStyleValue(color, offset_x, offset_y, blur_radius, spread_distance, placement));
- }
- virtual ~ShadowStyleValue() override = default;
-
- Color color() const { return m_properties.color; }
- Length const& offset_x() const { return m_properties.offset_x; }
- Length const& offset_y() const { return m_properties.offset_y; }
- Length const& blur_radius() const { return m_properties.blur_radius; }
- Length const& spread_distance() const { return m_properties.spread_distance; }
- ShadowPlacement placement() const { return m_properties.placement; }
-
- virtual ErrorOr<String> to_string() const override;
-
- bool properties_equal(ShadowStyleValue const& other) const { return m_properties == other.m_properties; }
-
-private:
- explicit ShadowStyleValue(Color color, Length const& offset_x, Length const& offset_y, Length const& blur_radius, Length const& spread_distance, ShadowPlacement placement)
- : StyleValueWithDefaultOperators(Type::Shadow)
- , m_properties { .color = color, .offset_x = offset_x, .offset_y = offset_y, .blur_radius = blur_radius, .spread_distance = spread_distance, .placement = placement }
- {
- }
-
- virtual ValueComparingNonnullRefPtr<StyleValue const> absolutized(CSSPixelRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, CSSPixels font_size, CSSPixels root_font_size, CSSPixels line_height, CSSPixels root_line_height) const override;
-
- struct Properties {
- Color color;
- Length offset_x;
- Length offset_y;
- Length blur_radius;
- Length spread_distance;
- ShadowPlacement placement;
- bool operator==(Properties const&) const = default;
- } m_properties;
-};
-
class StringStyleValue : public StyleValueWithDefaultOperators<StringStyleValue> {
public:
static ValueComparingNonnullRefPtr<StringStyleValue> create(String const& string)
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.cpp
new file mode 100644
index 000000000000..ee75a2366e08
--- /dev/null
+++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <[email protected]>
+ * Copyright (c) 2021, Tobias Christiansen <[email protected]>
+ * Copyright (c) 2021-2023, Sam Atkins <[email protected]>
+ * Copyright (c) 2022-2023, MacDue <[email protected]>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include "ShadowStyleValue.h"
+
+namespace Web::CSS {
+
+ErrorOr<String> ShadowStyleValue::to_string() const
+{
+ StringBuilder builder;
+ TRY(builder.try_appendff("{} {} {} {} {}", m_properties.color.to_deprecated_string(), TRY(m_properties.offset_x.to_string()), TRY(m_properties.offset_y.to_string()), TRY(m_properties.blur_radius.to_string()), TRY(m_properties.spread_distance.to_string())));
+ if (m_properties.placement == ShadowPlacement::Inner)
+ TRY(builder.try_append(" inset"sv));
+ return builder.to_string();
+}
+
+ValueComparingNonnullRefPtr<StyleValue const> ShadowStyleValue::absolutized(CSSPixelRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, CSSPixels font_size, CSSPixels root_font_size, CSSPixels line_height, CSSPixels root_line_height) const
+{
+ auto absolutized_offset_x = absolutized_length(m_properties.offset_x, viewport_rect, font_metrics, font_size, root_font_size, line_height, root_line_height).value_or(m_properties.offset_x);
+ auto absolutized_offset_y = absolutized_length(m_properties.offset_y, viewport_rect, font_metrics, font_size, root_font_size, line_height, root_line_height).value_or(m_properties.offset_y);
+ auto absolutized_blur_radius = absolutized_length(m_properties.blur_radius, viewport_rect, font_metrics, font_size, root_font_size, line_height, root_line_height).value_or(m_properties.blur_radius);
+ auto absolutized_spread_distance = absolutized_length(m_properties.spread_distance, viewport_rect, font_metrics, font_size, root_font_size, line_height, root_line_height).value_or(m_properties.spread_distance);
+ return ShadowStyleValue::create(m_properties.color, absolutized_offset_x, absolutized_offset_y, absolutized_blur_radius, absolutized_spread_distance, m_properties.placement);
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h
new file mode 100644
index 000000000000..3af4ec7bbbe0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <[email protected]>
+ * Copyright (c) 2021, Tobias Christiansen <[email protected]>
+ * Copyright (c) 2021-2023, Sam Atkins <[email protected]>
+ * Copyright (c) 2022-2023, MacDue <[email protected]>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibGfx/Color.h>
+#include <LibWeb/CSS/Length.h>
+#include <LibWeb/CSS/StyleValue.h>
+
+namespace Web::CSS {
+
+enum class ShadowPlacement {
+ Outer,
+ Inner,
+};
+
+class ShadowStyleValue final : public StyleValueWithDefaultOperators<ShadowStyleValue> {
+public:
+ static ValueComparingNonnullRefPtr<ShadowStyleValue> create(Color color, Length const& offset_x, Length const& offset_y, Length const& blur_radius, Length const& spread_distance, ShadowPlacement placement)
+ {
+ return adopt_ref(*new ShadowStyleValue(color, offset_x, offset_y, blur_radius, spread_distance, placement));
+ }
+ virtual ~ShadowStyleValue() override = default;
+
+ Color color() const { return m_properties.color; }
+ Length const& offset_x() const { return m_properties.offset_x; }
+ Length const& offset_y() const { return m_properties.offset_y; }
+ Length const& blur_radius() const { return m_properties.blur_radius; }
+ Length const& spread_distance() const { return m_properties.spread_distance; }
+ ShadowPlacement placement() const { return m_properties.placement; }
+
+ virtual ErrorOr<String> to_string() const override;
+
+ bool properties_equal(ShadowStyleValue const& other) const { return m_properties == other.m_properties; }
+
+private:
+ explicit ShadowStyleValue(Color color, Length const& offset_x, Length const& offset_y, Length const& blur_radius, Length const& spread_distance, ShadowPlacement placement)
+ : StyleValueWithDefaultOperators(Type::Shadow)
+ , m_properties { .color = color, .offset_x = offset_x, .offset_y = offset_y, .blur_radius = blur_radius, .spread_distance = spread_distance, .placement = placement }
+ {
+ }
+
+ virtual ValueComparingNonnullRefPtr<StyleValue const> absolutized(CSSPixelRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, CSSPixels font_size, CSSPixels root_font_size, CSSPixels line_height, CSSPixels root_line_height) const override;
+
+ struct Properties {
+ Color color;
+ Length offset_x;
+ Length offset_y;
+ Length blur_radius;
+ Length spread_distance;
+ ShadowPlacement placement;
+ bool operator==(Properties const&) const = default;
+ } m_properties;
+};
+
+}
|
751b605690fa28540243a347836c19b972362f20
|
2022-04-10 16:10:07
|
Andreas Kling
|
libweb: Cache scaled web fonts instead of recreating them every time
| false
|
Cache scaled web fonts instead of recreating them every time
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
index 9d7441c2b93f..ac474a653f6a 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
@@ -68,7 +68,19 @@ class StyleComputer::FontLoader : public ResourceClient {
{
if (!m_vector_font)
return nullptr;
- return adopt_ref(*new Gfx::ScaledFont(*m_vector_font, point_size, point_size));
+
+ if (auto it = m_cached_fonts.find(point_size); it != m_cached_fonts.end())
+ return it->value;
+
+ // FIXME: It might be nicer to have a global cap on the number of fonts we cache
+ // instead of doing it at the per-font level like this.
+ constexpr size_t max_cached_font_size_count = 64;
+ if (m_cached_fonts.size() > max_cached_font_size_count)
+ m_cached_fonts.remove(m_cached_fonts.begin());
+
+ auto font = adopt_ref(*new Gfx::ScaledFont(*m_vector_font, point_size, point_size));
+ m_cached_fonts.set(point_size, font);
+ return font;
}
private:
@@ -92,6 +104,8 @@ class StyleComputer::FontLoader : public ResourceClient {
StyleComputer& m_style_computer;
FlyString m_family_name;
RefPtr<Gfx::VectorFont> m_vector_font;
+
+ HashMap<float, NonnullRefPtr<Gfx::ScaledFont>> mutable m_cached_fonts;
};
static StyleSheet& default_stylesheet()
|
92a628c07cb5638a76ebef0642b25b32e2cab51b
|
2024-02-06 07:48:19
|
Nico Weber
|
libpdf: Always treat `/Subtype /Image` as binary data when dumping
| false
|
Always treat `/Subtype /Image` as binary data when dumping
|
libpdf
|
diff --git a/Userland/Libraries/LibPDF/ObjectDerivatives.cpp b/Userland/Libraries/LibPDF/ObjectDerivatives.cpp
index 9d77e3a1e667..933a36802d2e 100644
--- a/Userland/Libraries/LibPDF/ObjectDerivatives.cpp
+++ b/Userland/Libraries/LibPDF/ObjectDerivatives.cpp
@@ -5,6 +5,7 @@
*/
#include <AK/Hex.h>
+#include <LibPDF/CommonNames.h>
#include <LibPDF/Document.h>
#include <LibPDF/ObjectDerivatives.h>
@@ -136,6 +137,9 @@ ByteString StreamObject::to_byte_string(int indent) const
percentage_ascii = ascii_count * 100 / bytes().size();
bool is_mostly_text = percentage_ascii > 95;
+ if (dict()->contains(CommonNames::Subtype) && dict()->get_name(CommonNames::Subtype)->name() == "Image")
+ is_mostly_text = false;
+
if (is_mostly_text) {
for (size_t i = 0; i < bytes().size(); ++i) {
auto c = bytes()[i];
|
ce334ee1bca792ea0dc715519ca387cdc4e1ec55
|
2021-10-05 05:37:43
|
Idan Horowitz
|
kernel: Validate x86_64 address canonicality before SafeMem operations
| false
|
Validate x86_64 address canonicality before SafeMem operations
|
kernel
|
diff --git a/Kernel/Arch/x86/common/SafeMem.cpp b/Kernel/Arch/x86/common/SafeMem.cpp
index 36824714f8fd..d7100c31d7cd 100644
--- a/Kernel/Arch/x86/common/SafeMem.cpp
+++ b/Kernel/Arch/x86/common/SafeMem.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <Kernel/Arch/x86/Processor.h>
#include <Kernel/Arch/x86/RegisterState.h>
#include <Kernel/Arch/x86/SafeMem.h>
@@ -39,12 +40,32 @@ extern "C" u8 safe_atomic_compare_exchange_relaxed_faulted[];
namespace Kernel {
+ALWAYS_INLINE bool validate_canonical_address(size_t address)
+{
+#if ARCH(X86_64)
+ auto most_significant_bits = Processor::current().virtual_address_bit_width() - 1;
+ auto insignificant_bits = address >> most_significant_bits;
+ return insignificant_bits == 0 || insignificant_bits == (0xffffffffffffffffull >> most_significant_bits);
+#else
+ (void)address;
+ return true;
+#endif
+}
+
CODE_SECTION(".text.safemem")
NEVER_INLINE bool safe_memcpy(void* dest_ptr, const void* src_ptr, size_t n, void*& fault_at)
{
fault_at = nullptr;
size_t dest = (size_t)dest_ptr;
+ if (!validate_canonical_address(dest)) {
+ fault_at = dest_ptr;
+ return false;
+ }
size_t src = (size_t)src_ptr;
+ if (!validate_canonical_address(src)) {
+ fault_at = const_cast<void*>(src_ptr);
+ return false;
+ }
size_t remainder;
// FIXME: Support starting at an unaligned address.
if (!(dest & 0x3) && !(src & 0x3) && n >= 12) {
@@ -96,6 +117,10 @@ NEVER_INLINE bool safe_memcpy(void* dest_ptr, const void* src_ptr, size_t n, voi
CODE_SECTION(".text.safemem")
NEVER_INLINE ssize_t safe_strnlen(const char* str, size_t max_n, void*& fault_at)
{
+ if (!validate_canonical_address((size_t)str)) {
+ fault_at = const_cast<char*>(str);
+ return false;
+ }
ssize_t count = 0;
fault_at = nullptr;
asm volatile(
@@ -129,6 +154,10 @@ NEVER_INLINE bool safe_memset(void* dest_ptr, int c, size_t n, void*& fault_at)
{
fault_at = nullptr;
size_t dest = (size_t)dest_ptr;
+ if (!validate_canonical_address(dest)) {
+ fault_at = dest_ptr;
+ return false;
+ }
size_t remainder;
// FIXME: Support starting at an unaligned address.
if (!(dest & 0x3) && n >= 12) {
|
39f92fa1313d7e6b1eb99dbd2f60996e0877b669
|
2022-03-01 09:58:01
|
Andrew Kaster
|
libc: Define offsetof in stddef.h instead of sys/cdefs.h
| false
|
Define offsetof in stddef.h instead of sys/cdefs.h
|
libc
|
diff --git a/Userland/Libraries/LibC/stddef.h b/Userland/Libraries/LibC/stddef.h
index bd4131a7f8d4..49357f5c8b47 100644
--- a/Userland/Libraries/LibC/stddef.h
+++ b/Userland/Libraries/LibC/stddef.h
@@ -6,6 +6,8 @@
#pragma once
+#define offsetof(type, member) __builtin_offsetof(type, member)
+
#ifndef KERNEL
# include <sys/cdefs.h>
diff --git a/Userland/Libraries/LibC/sys/cdefs.h b/Userland/Libraries/LibC/sys/cdefs.h
index 00d644410273..e428ad6085ab 100644
--- a/Userland/Libraries/LibC/sys/cdefs.h
+++ b/Userland/Libraries/LibC/sys/cdefs.h
@@ -22,5 +22,3 @@
#undef __P
#define __P(a) a
-
-#define offsetof(type, member) __builtin_offsetof(type, member)
|
ca2c81251a7d036f586f3d0a32bc35e2b9f93144
|
2021-08-06 22:44:31
|
sin-ack
|
everywhere: Replace Model::update() with Model::invalidate()
| false
|
Replace Model::update() with Model::invalidate()
|
everywhere
|
diff --git a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
index c667c1c33477..5c233b4576f4 100644
--- a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
+++ b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp
@@ -97,11 +97,6 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode
}
}
-void ClipboardHistoryModel::update()
-{
- did_update();
-}
-
void ClipboardHistoryModel::add_item(const GUI::Clipboard::DataAndType& item)
{
m_history_items.remove_first_matching([&](GUI::Clipboard::DataAndType& existing) {
@@ -112,7 +107,7 @@ void ClipboardHistoryModel::add_item(const GUI::Clipboard::DataAndType& item)
m_history_items.take_last();
m_history_items.prepend(item);
- update();
+ invalidate();
}
void ClipboardHistoryModel::remove_item(int index)
diff --git a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h
index 58f3b9a212f5..b5482acf9825 100644
--- a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h
+++ b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h
@@ -35,7 +35,6 @@ class ClipboardHistoryModel final : public GUI::Model
virtual String column_name(int) const override;
virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; }
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
// ^GUI::Clipboard::ClipboardClient
virtual void clipboard_content_did_change(const String&) override { add_item(GUI::Clipboard::the().data_and_type()); }
diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp
index d6e96595e67c..da12d7e7537e 100644
--- a/Userland/Applications/Browser/BookmarksBarWidget.cpp
+++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp
@@ -146,7 +146,7 @@ BookmarksBarWidget::BookmarksBarWidget(const String& bookmarks_file, bool enable
fields.empend("title", "Title", Gfx::TextAlignment::CenterLeft);
fields.empend("url", "Url", Gfx::TextAlignment::CenterRight);
set_model(GUI::JsonArrayModel::create(bookmarks_file, move(fields)));
- model()->update();
+ model()->invalidate();
}
BookmarksBarWidget::~BookmarksBarWidget()
diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp
index be50d4067d5f..547298730cf3 100644
--- a/Userland/Applications/Calendar/AddEventDialog.cpp
+++ b/Userland/Applications/Calendar/AddEventDialog.cpp
@@ -98,10 +98,6 @@ AddEventDialog::MonthListModel::~MonthListModel()
{
}
-void AddEventDialog::MonthListModel::update()
-{
-}
-
int AddEventDialog::MonthListModel::row_count(const GUI::ModelIndex&) const
{
return 12;
diff --git a/Userland/Applications/Calendar/AddEventDialog.h b/Userland/Applications/Calendar/AddEventDialog.h
index c400476764be..d63114f02bbc 100644
--- a/Userland/Applications/Calendar/AddEventDialog.h
+++ b/Userland/Applications/Calendar/AddEventDialog.h
@@ -39,7 +39,6 @@ class AddEventDialog final : public GUI::Dialog {
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
private:
MonthListModel();
diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp
index 66739bd3ca73..b576ba49e0d3 100644
--- a/Userland/Applications/FileManager/DirectoryView.cpp
+++ b/Userland/Applications/FileManager/DirectoryView.cpp
@@ -360,7 +360,7 @@ void DirectoryView::open(String const& path)
auto real_path = Core::File::real_path_for(path);
if (model().root_path() == real_path) {
- model().update();
+ model().invalidate();
return;
}
@@ -382,7 +382,7 @@ void DirectoryView::open_parent_directory()
void DirectoryView::refresh()
{
- model().update();
+ model().invalidate();
}
void DirectoryView::open_previous_directory()
diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp
index e0384a233352..523bed4cd251 100644
--- a/Userland/Applications/FileManager/main.cpp
+++ b/Userland/Applications/FileManager/main.cpp
@@ -500,7 +500,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
};
auto refresh_tree_view = [&] {
- directories_model->update();
+ directories_model->invalidate();
auto current_path = directory_view.path();
diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp
index 9d2c04a2fca6..c69b6a4767b2 100644
--- a/Userland/Applications/Help/ManualModel.cpp
+++ b/Userland/Applications/Help/ManualModel.cpp
@@ -172,8 +172,3 @@ TriState ManualModel::data_matches(const GUI::ModelIndex& index, const GUI::Vari
return view_result.value().contains(term.as_string()) ? TriState::True : TriState::False;
}
-
-void ManualModel::update()
-{
- did_update();
-}
diff --git a/Userland/Applications/Help/ManualModel.h b/Userland/Applications/Help/ManualModel.h
index 39bd85360b11..9c2002f15f86 100644
--- a/Userland/Applications/Help/ManualModel.h
+++ b/Userland/Applications/Help/ManualModel.h
@@ -32,7 +32,6 @@ class ManualModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual TriState data_matches(const GUI::ModelIndex&, const GUI::Variant&) const override;
- virtual void update() override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override;
diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp
index 3c04aeb15fb0..3f88f099c230 100644
--- a/Userland/Applications/Help/main.cpp
+++ b/Userland/Applications/Help/main.cpp
@@ -109,11 +109,11 @@ int main(int argc, char* argv[])
if (auto model = search_list_view.model()) {
auto& search_model = *static_cast<GUI::FilteringProxyModel*>(model);
search_model.set_filter_term(search_box.text());
- search_model.update();
+ search_model.invalidate();
}
};
search_list_view.set_model(GUI::FilteringProxyModel::construct(model));
- search_list_view.model()->update();
+ search_list_view.model()->invalidate();
tree_view.set_model(model);
left_tab_bar.set_fixed_width(200);
diff --git a/Userland/Applications/HexEditor/SearchResultsModel.h b/Userland/Applications/HexEditor/SearchResultsModel.h
index c70e698bb173..edf9ec695a5c 100644
--- a/Userland/Applications/HexEditor/SearchResultsModel.h
+++ b/Userland/Applications/HexEditor/SearchResultsModel.h
@@ -75,8 +75,6 @@ class SearchResultsModel final : public GUI::Model {
return {};
}
- virtual void update() override { }
-
private:
Vector<Match> m_matches;
};
diff --git a/Userland/Applications/IRCClient/IRCAppWindow.cpp b/Userland/Applications/IRCClient/IRCAppWindow.cpp
index 3916467b5202..187e3dc29279 100644
--- a/Userland/Applications/IRCClient/IRCAppWindow.cpp
+++ b/Userland/Applications/IRCClient/IRCAppWindow.cpp
@@ -62,7 +62,7 @@ void IRCAppWindow::setup_client()
return static_cast<IRCWindow*>(m_container->active_widget());
};
m_client->aid_update_window_list = [this] {
- m_window_list->model()->update();
+ m_window_list->model()->invalidate();
};
m_client->on_nickname_changed = [this](const String&) {
update_title();
diff --git a/Userland/Applications/IRCClient/IRCChannel.cpp b/Userland/Applications/IRCClient/IRCChannel.cpp
index aba2668a6f11..7606b05a1f69 100644
--- a/Userland/Applications/IRCClient/IRCChannel.cpp
+++ b/Userland/Applications/IRCClient/IRCChannel.cpp
@@ -36,7 +36,7 @@ void IRCChannel::add_member(const String& name, char prefix)
}
}
m_members.append({ name, prefix });
- m_member_model->update();
+ m_member_model->invalidate();
}
void IRCChannel::remove_member(const String& name)
@@ -69,7 +69,7 @@ void IRCChannel::handle_join(const String& nick, const String& hostmask)
return;
}
add_member(nick, (char)0);
- m_member_model->update();
+ m_member_model->invalidate();
if (m_client.show_join_part_messages())
add_message(String::formatted("*** {} [{}] has joined {}", nick, hostmask, m_name), Color::MidGreen);
}
@@ -83,7 +83,7 @@ void IRCChannel::handle_part(const String& nick, const String& hostmask)
} else {
remove_member(nick);
}
- m_member_model->update();
+ m_member_model->invalidate();
if (m_client.show_join_part_messages())
add_message(String::formatted("*** {} [{}] has parted from {}", nick, hostmask, m_name), Color::MidGreen);
}
@@ -97,7 +97,7 @@ void IRCChannel::handle_quit(const String& nick, const String& hostmask, const S
} else {
remove_member(nick);
}
- m_member_model->update();
+ m_member_model->invalidate();
add_message(String::formatted("*** {} [{}] has quit ({})", nick, hostmask, message), Color::MidGreen);
}
@@ -114,7 +114,7 @@ void IRCChannel::notify_nick_changed(const String& old_nick, const String& new_n
for (auto& member : m_members) {
if (member.name == old_nick) {
member.name = new_nick;
- m_member_model->update();
+ m_member_model->invalidate();
if (m_client.show_nick_change_messages())
add_message(String::formatted("~ {} changed nickname to {}", old_nick, new_nick), Color::MidMagenta);
return;
diff --git a/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp b/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp
index 6ae117aba063..3dbd0997d07c 100644
--- a/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp
+++ b/Userland/Applications/IRCClient/IRCChannelMemberListModel.cpp
@@ -50,11 +50,6 @@ GUI::Variant IRCChannelMemberListModel::data(const GUI::ModelIndex& index, GUI::
return {};
}
-void IRCChannelMemberListModel::update()
-{
- did_update();
-}
-
String IRCChannelMemberListModel::nick_at(const GUI::ModelIndex& index) const
{
return data(index, GUI::ModelRole::Display).to_string();
diff --git a/Userland/Applications/IRCClient/IRCChannelMemberListModel.h b/Userland/Applications/IRCClient/IRCChannelMemberListModel.h
index 5d3145be6279..12ca9ca739d6 100644
--- a/Userland/Applications/IRCClient/IRCChannelMemberListModel.h
+++ b/Userland/Applications/IRCClient/IRCChannelMemberListModel.h
@@ -23,7 +23,6 @@ class IRCChannelMemberListModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex&) const override;
virtual String column_name(int column) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
virtual String nick_at(const GUI::ModelIndex& index) const;
private:
diff --git a/Userland/Applications/IRCClient/IRCClient.cpp b/Userland/Applications/IRCClient/IRCClient.cpp
index 0b66e7f358d2..d4f3692ab1f4 100644
--- a/Userland/Applications/IRCClient/IRCClient.cpp
+++ b/Userland/Applications/IRCClient/IRCClient.cpp
@@ -817,7 +817,7 @@ void IRCClient::register_subwindow(IRCWindow& subwindow)
subwindow.set_log_buffer(*m_log);
}
m_windows.append(&subwindow);
- m_client_window_list_model->update();
+ m_client_window_list_model->invalidate();
}
void IRCClient::unregister_subwindow(IRCWindow& subwindow)
@@ -831,7 +831,7 @@ void IRCClient::unregister_subwindow(IRCWindow& subwindow)
break;
}
}
- m_client_window_list_model->update();
+ m_client_window_list_model->invalidate();
}
void IRCClient::handle_user_command(const String& input)
@@ -1079,7 +1079,7 @@ void IRCClient::handle_kick_user_action(const String& channel, const String& nic
void IRCClient::handle_close_query_action(const String& nick)
{
m_queries.remove(nick);
- m_client_window_list_model->update();
+ m_client_window_list_model->invalidate();
}
void IRCClient::handle_join_action(const String& channel)
diff --git a/Userland/Applications/IRCClient/IRCWindowListModel.cpp b/Userland/Applications/IRCClient/IRCWindowListModel.cpp
index 7b9fad505f0c..76ef9623f971 100644
--- a/Userland/Applications/IRCClient/IRCWindowListModel.cpp
+++ b/Userland/Applications/IRCClient/IRCWindowListModel.cpp
@@ -64,8 +64,3 @@ GUI::Variant IRCWindowListModel::data(const GUI::ModelIndex& index, GUI::ModelRo
}
return {};
}
-
-void IRCWindowListModel::update()
-{
- did_update();
-}
diff --git a/Userland/Applications/IRCClient/IRCWindowListModel.h b/Userland/Applications/IRCClient/IRCWindowListModel.h
index fce8f8e3c6ff..8de806cbccad 100644
--- a/Userland/Applications/IRCClient/IRCWindowListModel.h
+++ b/Userland/Applications/IRCClient/IRCWindowListModel.h
@@ -25,7 +25,6 @@ class IRCWindowListModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex&) const override;
virtual String column_name(int column) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
private:
explicit IRCWindowListModel(IRCClient&);
diff --git a/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h b/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h
index 2dc6f3df04a4..88095ef537e5 100644
--- a/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h
+++ b/Userland/Applications/KeyboardSettings/CharacterMapFileListModel.h
@@ -39,11 +39,6 @@ class CharacterMapFileListModel final : public GUI::Model {
return {};
}
- virtual void update() override
- {
- did_update();
- }
-
private:
explicit CharacterMapFileListModel(Vector<String>& filenames)
: m_filenames(filenames)
diff --git a/Userland/Applications/Mail/AccountHolder.cpp b/Userland/Applications/Mail/AccountHolder.cpp
index 822604642741..f2edd1b236b4 100644
--- a/Userland/Applications/Mail/AccountHolder.cpp
+++ b/Userland/Applications/Mail/AccountHolder.cpp
@@ -75,5 +75,5 @@ void AccountHolder::add_account_with_name_and_mailboxes(String name, Vector<IMAP
void AccountHolder::rebuild_tree()
{
- m_mailbox_tree_model->update();
+ m_mailbox_tree_model->invalidate();
}
diff --git a/Userland/Applications/Mail/InboxModel.cpp b/Userland/Applications/Mail/InboxModel.cpp
index bfac9a94e3a8..4c1417e0ad51 100644
--- a/Userland/Applications/Mail/InboxModel.cpp
+++ b/Userland/Applications/Mail/InboxModel.cpp
@@ -43,8 +43,3 @@ GUI::Variant InboxModel::data(GUI::ModelIndex const& index, GUI::ModelRole role)
}
return {};
}
-
-void InboxModel::update()
-{
- did_update();
-}
diff --git a/Userland/Applications/Mail/InboxModel.h b/Userland/Applications/Mail/InboxModel.h
index a2b6724de89f..02d2f569d94c 100644
--- a/Userland/Applications/Mail/InboxModel.h
+++ b/Userland/Applications/Mail/InboxModel.h
@@ -33,7 +33,6 @@ class InboxModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
private:
InboxModel(Vector<InboxEntry>);
diff --git a/Userland/Applications/Mail/MailboxTreeModel.cpp b/Userland/Applications/Mail/MailboxTreeModel.cpp
index 4183e7fc5a30..737a9fb927f3 100644
--- a/Userland/Applications/Mail/MailboxTreeModel.cpp
+++ b/Userland/Applications/Mail/MailboxTreeModel.cpp
@@ -113,8 +113,3 @@ GUI::Variant MailboxTreeModel::data(GUI::ModelIndex const& index, GUI::ModelRole
return {};
}
-
-void MailboxTreeModel::update()
-{
- did_update();
-}
diff --git a/Userland/Applications/Mail/MailboxTreeModel.h b/Userland/Applications/Mail/MailboxTreeModel.h
index d24a766ce3e9..3df0c1ba6239 100644
--- a/Userland/Applications/Mail/MailboxTreeModel.h
+++ b/Userland/Applications/Mail/MailboxTreeModel.h
@@ -25,7 +25,6 @@ class MailboxTreeModel final : public GUI::Model {
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override;
virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override;
- virtual void update() override;
private:
explicit MailboxTreeModel(AccountHolder const&);
diff --git a/Userland/Applications/PDFViewer/OutlineModel.cpp b/Userland/Applications/PDFViewer/OutlineModel.cpp
index 290b8194a7c0..be56f6314021 100644
--- a/Userland/Applications/PDFViewer/OutlineModel.cpp
+++ b/Userland/Applications/PDFViewer/OutlineModel.cpp
@@ -61,11 +61,6 @@ GUI::Variant OutlineModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
}
}
-void OutlineModel::update()
-{
- did_update();
-}
-
GUI::ModelIndex OutlineModel::parent_index(const GUI::ModelIndex& index) const
{
if (!index.is_valid())
diff --git a/Userland/Applications/PDFViewer/OutlineModel.h b/Userland/Applications/PDFViewer/OutlineModel.h
index 2885647b7dad..e97fcb35747e 100644
--- a/Userland/Applications/PDFViewer/OutlineModel.h
+++ b/Userland/Applications/PDFViewer/OutlineModel.h
@@ -19,7 +19,6 @@ class OutlineModel final : public GUI::Model {
virtual int row_count(const GUI::ModelIndex&) const override;
virtual int column_count(const GUI::ModelIndex&) const override;
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override;
- virtual void update() override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override;
diff --git a/Userland/Applications/Settings/main.cpp b/Userland/Applications/Settings/main.cpp
index 90fc4222dc5f..2a94138993c6 100644
--- a/Userland/Applications/Settings/main.cpp
+++ b/Userland/Applications/Settings/main.cpp
@@ -59,8 +59,6 @@ class SettingsAppsModel final : public GUI::Model {
return {};
}
- virtual void update() override { }
-
private:
NonnullRefPtrVector<Desktop::AppFile> m_apps;
};
diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp
index 21ee4f3de6b9..fb7e737b27c4 100644
--- a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp
+++ b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp
@@ -92,10 +92,6 @@ String PlaylistModel::column_name(int column) const
VERIFY_NOT_REACHED();
}
-void PlaylistModel::update()
-{
-}
-
void PlaylistTableView::doubleclick_event(GUI::MouseEvent& event)
{
AbstractView::doubleclick_event(event);
diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.h b/Userland/Applications/SoundPlayer/PlaylistWidget.h
index 758003c152ef..5b19b6e79a18 100644
--- a/Userland/Applications/SoundPlayer/PlaylistWidget.h
+++ b/Userland/Applications/SoundPlayer/PlaylistWidget.h
@@ -24,7 +24,6 @@ class PlaylistModel : public GUI::Model {
int row_count(const GUI::ModelIndex&) const override { return m_playlist_items.size(); }
int column_count(const GUI::ModelIndex&) const override { return 6; }
GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- void update() override;
String column_name(int column) const override;
Vector<M3UEntry>& items() { return m_playlist_items; }
diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp
index 63ebdda6ef29..e6eba8c455d2 100644
--- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp
+++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp
@@ -258,7 +258,7 @@ void SoundPlayerWidgetAdvancedView::read_playlist(StringView path)
for (auto& item : *items)
m_playlist_model->items().append(item);
set_playlist_visible(true);
- m_playlist_model->update();
+ m_playlist_model->invalidate();
open_file(items->at(0).path);
diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp
index f3f07f222cb3..277a915f1b6c 100644
--- a/Userland/Applications/Spreadsheet/HelpWindow.cpp
+++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp
@@ -27,7 +27,6 @@ class HelpListModel final : public GUI::Model {
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_keys.size(); }
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; }
- virtual void update() override { }
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role = GUI::ModelRole::Display) const override
{
@@ -46,7 +45,7 @@ class HelpListModel final : public GUI::Model {
object.for_each_member([this](auto& name, auto&) {
m_keys.append(name);
});
- did_update();
+ invalidate();
}
private:
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp
index 142c27f3fd93..fdd11865f79c 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp
@@ -146,7 +146,7 @@ void SheetModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& valu
auto& cell = m_sheet->ensure({ (size_t)index.column(), (size_t)index.row() });
cell.set_data(value.to_string());
- update();
+ invalidate();
}
void SheetModel::update()
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.h b/Userland/Applications/Spreadsheet/SpreadsheetModel.h
index 0eb77e360075..1536074e7733 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetModel.h
+++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.h
@@ -23,11 +23,12 @@ class SheetModel final : public GUI::Model {
virtual RefPtr<Core::MimeData> mime_data(const GUI::ModelSelection&) const override;
virtual bool is_editable(const GUI::ModelIndex&) const override;
virtual void set_data(const GUI::ModelIndex&, const GUI::Variant&) override;
- virtual void update() override;
virtual bool is_column_sortable(int) const override { return false; }
virtual StringView drag_data_type() const override { return "text/x-spreadsheet-data"; }
Sheet& sheet() { return *m_sheet; }
+ void update();
+
private:
explicit SheetModel(Sheet& sheet)
: m_sheet(sheet)
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
index 97cc81b25847..f412dbfa2820 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
@@ -144,7 +144,7 @@ void InfinitelyScrollableTableView::mouseup_event(GUI::MouseEvent& event)
void SpreadsheetView::update_with_model()
{
- m_table_view->model()->update();
+ m_table_view->model()->invalidate();
m_table_view->update();
}
diff --git a/Userland/Applications/SystemMonitor/DevicesModel.cpp b/Userland/Applications/SystemMonitor/DevicesModel.cpp
index 569d3db8a8a6..eb8d5d104e62 100644
--- a/Userland/Applications/SystemMonitor/DevicesModel.cpp
+++ b/Userland/Applications/SystemMonitor/DevicesModel.cpp
@@ -118,8 +118,9 @@ GUI::Variant DevicesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
return {};
}
-void DevicesModel::update()
+void DevicesModel::invalidate()
{
+ // FIXME: granularly update this.
auto proc_devices = Core::File::construct("/proc/devices");
if (!proc_devices->open(Core::OpenMode::ReadOnly))
VERIFY_NOT_REACHED();
@@ -172,5 +173,5 @@ void DevicesModel::update()
fill_in_paths_from_dir("/dev");
fill_in_paths_from_dir("/dev/pts");
- did_update();
+ Model::invalidate();
}
diff --git a/Userland/Applications/SystemMonitor/DevicesModel.h b/Userland/Applications/SystemMonitor/DevicesModel.h
index 2358ae67d1a8..1e4a394f4645 100644
--- a/Userland/Applications/SystemMonitor/DevicesModel.h
+++ b/Userland/Applications/SystemMonitor/DevicesModel.h
@@ -28,7 +28,9 @@ class DevicesModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex&) const override;
virtual String column_name(int column) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
+
+ // FIXME: This should be moved to granularly updating itself.
+ virtual void invalidate() override;
private:
DevicesModel();
diff --git a/Userland/Applications/SystemMonitor/InterruptsWidget.cpp b/Userland/Applications/SystemMonitor/InterruptsWidget.cpp
index 4a64d7f78f45..594ad29da91d 100644
--- a/Userland/Applications/SystemMonitor/InterruptsWidget.cpp
+++ b/Userland/Applications/SystemMonitor/InterruptsWidget.cpp
@@ -44,5 +44,5 @@ InterruptsWidget::~InterruptsWidget()
void InterruptsWidget::update_model()
{
- m_interrupt_table_view->model()->update();
+ m_interrupt_model->invalidate();
}
diff --git a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
index ce842ca1fb8c..ec580f790f7b 100644
--- a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
+++ b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
@@ -117,7 +117,7 @@ NetworkStatisticsWidget::~NetworkStatisticsWidget()
void NetworkStatisticsWidget::update_models()
{
- m_adapter_table_view->model()->update();
- m_tcp_socket_table_view->model()->update();
- m_udp_socket_table_view->model()->update();
+ m_adapter_model->invalidate();
+ m_tcp_socket_model->invalidate();
+ m_udp_socket_model->invalidate();
}
diff --git a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
index 769ceacee843..ef4c156febcc 100644
--- a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
+++ b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
@@ -122,5 +122,5 @@ void ProcessMemoryMapWidget::set_pid(pid_t pid)
void ProcessMemoryMapWidget::refresh()
{
if (m_pid != -1)
- m_json_model->update();
+ m_json_model->invalidate();
}
diff --git a/Userland/Applications/SystemMonitor/ProcessModel.h b/Userland/Applications/SystemMonitor/ProcessModel.h
index c679e51d754b..f6a77c4106d9 100644
--- a/Userland/Applications/SystemMonitor/ProcessModel.h
+++ b/Userland/Applications/SystemMonitor/ProcessModel.h
@@ -60,8 +60,8 @@ class ProcessModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex&) const override;
virtual String column_name(int column) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
virtual bool is_column_sortable(int column_index) const override { return column_index != Column::Icon; }
+ void update();
struct CpuInfo {
u32 id;
diff --git a/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp b/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp
index 145ba2c1c945..05e6c4cadb23 100644
--- a/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp
+++ b/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp
@@ -57,11 +57,6 @@ class ProcessStateModel final
return {};
}
- virtual void update() override
- {
- did_update(GUI::Model::DontInvalidateIndices);
- }
-
virtual void model_did_update([[maybe_unused]] unsigned flags) override
{
refresh();
@@ -77,7 +72,7 @@ class ProcessStateModel final
break;
}
}
- update();
+ invalidate();
}
private:
diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp
index 84fe4c144c7c..fcc43dbc6138 100644
--- a/Userland/Applications/SystemMonitor/main.cpp
+++ b/Userland/Applications/SystemMonitor/main.cpp
@@ -225,11 +225,11 @@ int main(int argc, char** argv)
process_table_view.set_column_visible(ProcessModel::Column::DirtyPrivate, true);
process_table_view.set_key_column_and_sort_order(ProcessModel::Column::CPU, GUI::SortOrder::Descending);
- process_table_view.model()->update();
+ process_model->update();
auto& refresh_timer = window->add<Core::Timer>(
3000, [&] {
- process_table_view.model()->update();
+ process_model->update();
if (auto* memory_stats_widget = MemoryStatsWidget::the())
memory_stats_widget->refresh();
});
@@ -567,11 +567,12 @@ NonnullRefPtr<GUI::Widget> build_file_systems_tab()
df_fields.empend("free_inode_count", "Free inodes", Gfx::TextAlignment::CenterRight);
df_fields.empend("total_inode_count", "Total inodes", Gfx::TextAlignment::CenterRight);
df_fields.empend("block_size", "Block size", Gfx::TextAlignment::CenterRight);
+
fs_table_view.set_model(GUI::SortingProxyModel::create(GUI::JsonArrayModel::create("/proc/df", move(df_fields))));
fs_table_view.set_column_painting_delegate(3, make<ProgressbarPaintingDelegate>());
- fs_table_view.model()->update();
+ fs_table_view.model()->invalidate();
};
return fs_widget;
}
@@ -629,7 +630,7 @@ NonnullRefPtr<GUI::Widget> build_pci_devices_tab()
});
pci_table_view.set_model(GUI::SortingProxyModel::create(GUI::JsonArrayModel::create("/proc/pci", move(pci_fields))));
- pci_table_view.model()->update();
+ pci_table_view.model()->invalidate();
};
return pci_widget;
@@ -645,7 +646,7 @@ NonnullRefPtr<GUI::Widget> build_devices_tab()
auto& devices_table_view = self.add<GUI::TableView>();
devices_table_view.set_model(GUI::SortingProxyModel::create(DevicesModel::create()));
- devices_table_view.model()->update();
+ devices_table_view.model()->invalidate();
};
return devices_widget;
@@ -748,8 +749,9 @@ NonnullRefPtr<GUI::Widget> build_processors_tab()
processors_field.empend("type", "Type", Gfx::TextAlignment::CenterRight);
auto& processors_table_view = self.add<GUI::TableView>();
- processors_table_view.set_model(GUI::JsonArrayModel::create("/proc/cpuinfo", move(processors_field)));
- processors_table_view.model()->update();
+ auto json_model = GUI::JsonArrayModel::create("/proc/cpuinfo", move(processors_field));
+ processors_table_view.set_model(json_model);
+ json_model->invalidate();
};
return processors_widget;
diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp
index 9bc0c985cdc1..accce0e93a2d 100644
--- a/Userland/Applications/ThemeEditor/main.cpp
+++ b/Userland/Applications/ThemeEditor/main.cpp
@@ -26,7 +26,6 @@ class ColorRoleModel final : public GUI::Model {
return Gfx::to_string(m_color_roles[(size_t)index.row()]);
return {};
}
- virtual void update() { did_update(); }
explicit ColorRoleModel(const Vector<Gfx::ColorRole>& color_roles)
: m_color_roles(color_roles)
diff --git a/Userland/Demos/WidgetGallery/GalleryModels.h b/Userland/Demos/WidgetGallery/GalleryModels.h
index 038a26b9cb82..85069ab3bc68 100644
--- a/Userland/Demos/WidgetGallery/GalleryModels.h
+++ b/Userland/Demos/WidgetGallery/GalleryModels.h
@@ -51,7 +51,7 @@ class MouseCursorModel final : public GUI::Model {
}
return {};
}
- virtual void update() override
+ virtual void update()
{
m_cursors.clear();
@@ -131,7 +131,7 @@ class FileIconsModel final : public GUI::Model {
}
return {};
}
- virtual void update() override
+ virtual void update()
{
m_icon_sets.clear();
diff --git a/Userland/Demos/WidgetGallery/GalleryWidget.cpp b/Userland/Demos/WidgetGallery/GalleryWidget.cpp
index f6d96a940098..662057d8e314 100644
--- a/Userland/Demos/WidgetGallery/GalleryWidget.cpp
+++ b/Userland/Demos/WidgetGallery/GalleryWidget.cpp
@@ -290,7 +290,7 @@ GalleryWidget::GalleryWidget()
m_cursors_tableview->set_model(sorting_proxy_model);
m_cursors_tableview->set_key_column_and_sort_order(MouseCursorModel::Column::Name, GUI::SortOrder::Ascending);
- m_cursors_tableview->model()->update();
+ m_cursors_tableview->model()->invalidate();
m_cursors_tableview->set_column_width(0, 25);
m_cursors_tableview->on_activation = [&](const GUI::ModelIndex& index) {
@@ -363,7 +363,7 @@ GalleryWidget::GalleryWidget()
m_icons_tableview->set_model(sorting_proxy_icons_model);
m_icons_tableview->set_key_column_and_sort_order(FileIconsModel::Column::Name, GUI::SortOrder::Ascending);
- m_icons_tableview->model()->update();
+ m_icons_tableview->model()->invalidate();
m_icons_tableview->set_column_width(0, 36);
m_icons_tableview->set_column_width(1, 20);
}
diff --git a/Userland/DevTools/HackStudio/ClassViewWidget.h b/Userland/DevTools/HackStudio/ClassViewWidget.h
index 08d348b3e049..fa25c5f46498 100644
--- a/Userland/DevTools/HackStudio/ClassViewWidget.h
+++ b/Userland/DevTools/HackStudio/ClassViewWidget.h
@@ -45,7 +45,6 @@ class ClassViewModel final : public GUI::Model {
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; }
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole role) const override;
- virtual void update() override { did_update(); }
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& parent_index = GUI::ModelIndex()) const override;
diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h
index 71000216eaa1..cc4512aaeeba 100644
--- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h
+++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h
@@ -33,7 +33,6 @@ class BacktraceModel final : public GUI::Model {
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override { }
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override;
struct FrameInfo {
diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp
index 62a4bc0c16c4..fdc43da6795c 100644
--- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp
@@ -111,9 +111,4 @@ GUI::Variant DisassemblyModel::data(const GUI::ModelIndex& index, GUI::ModelRole
return {};
}
-void DisassemblyModel::update()
-{
- did_update();
-}
-
}
diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h
index ba856bcb6c34..a188951c1791 100644
--- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h
+++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h
@@ -46,7 +46,6 @@ class DisassemblyModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
private:
DisassemblyModel(const Debug::DebugSession&, const PtraceRegisters&);
diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp
index d1c69090d3d8..1d62a924da67 100644
--- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp
@@ -136,9 +136,4 @@ GUI::Variant RegistersModel::data(const GUI::ModelIndex& index, GUI::ModelRole r
return {};
}
-void RegistersModel::update()
-{
- did_update();
-}
-
}
diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h
index c685a61cfaa3..86cd07a9f057 100644
--- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h
+++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h
@@ -42,7 +42,6 @@ class RegistersModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
const PtraceRegisters& raw_registers() const { return m_raw_registers; }
diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
index 8dfe5fb1ad5c..1bcae424feb1 100644
--- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
@@ -158,11 +158,6 @@ GUI::Variant VariablesModel::data(const GUI::ModelIndex& index, GUI::ModelRole r
}
}
-void VariablesModel::update()
-{
- did_update();
-}
-
RefPtr<VariablesModel> VariablesModel::create(const PtraceRegisters& regs)
{
auto lib = Debugger::the().session()->library_at(regs.ip());
diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h
index 5b028f910be8..a6856b99e1d2 100644
--- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h
+++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h
@@ -23,7 +23,6 @@ class VariablesModel final : public GUI::Model {
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; }
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override;
- virtual void update() override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override;
diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp
index c3fbe9aa5017..f9f7a4481e6d 100644
--- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp
+++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp
@@ -24,7 +24,7 @@ ProjectTemplatesModel::ProjectTemplatesModel()
if (!watcher_or_error.is_error()) {
m_file_watcher = watcher_or_error.release_value();
m_file_watcher->on_change = [&](auto) {
- update();
+ invalidate();
};
auto watch_result = m_file_watcher->add_watch(
diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h
index 4674a738cfac..4d0359f28cbb 100644
--- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h
+++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h
@@ -37,8 +37,8 @@ class ProjectTemplatesModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
+ void update();
void rescan_templates();
private:
diff --git a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp
index 7bc50f0da847..88fa1ad8991e 100644
--- a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp
+++ b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp
@@ -76,7 +76,6 @@ class SearchResultsModel final : public GUI::Model {
return {};
}
- virtual void update() override { }
virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override
{
if (row < 0 || row >= (int)m_matches.size())
diff --git a/Userland/DevTools/HackStudio/Git/GitFilesModel.h b/Userland/DevTools/HackStudio/Git/GitFilesModel.h
index 1fcc0fa4f89a..a773f984913b 100644
--- a/Userland/DevTools/HackStudio/Git/GitFilesModel.h
+++ b/Userland/DevTools/HackStudio/Git/GitFilesModel.h
@@ -27,7 +27,6 @@ class GitFilesModel final : public GUI::Model {
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override { }
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override;
private:
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index ee240c1040e2..d7da10e391cd 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -268,7 +268,7 @@ bool HackStudioWidget::open_file(const String& full_filename)
}
}
- m_open_files_view->model()->update();
+ m_open_files_view->model()->invalidate();
}
current_editor().set_document(const_cast<GUI::TextDocument&>(new_project_file->document()));
@@ -1115,7 +1115,7 @@ void HackStudioWidget::handle_external_file_deletion(const String& filepath)
}
}
- m_open_files_view->model()->update();
+ m_open_files_view->model()->invalidate();
}
HackStudioWidget::~HackStudioWidget()
diff --git a/Userland/DevTools/HackStudio/Locator.cpp b/Userland/DevTools/HackStudio/Locator.cpp
index 705fd23f0762..3c81a1896017 100644
--- a/Userland/DevTools/HackStudio/Locator.cpp
+++ b/Userland/DevTools/HackStudio/Locator.cpp
@@ -74,7 +74,6 @@ class LocatorSuggestionModel final : public GUI::Model {
}
return {};
}
- virtual void update() override {};
const Vector<Suggestion>& suggestions() const { return m_suggestions; }
diff --git a/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp b/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp
index 141fc27f31a7..88fd1336d91c 100644
--- a/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp
+++ b/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp
@@ -71,7 +71,6 @@ class ToDoEntriesModel final : public GUI::Model {
return {};
}
- virtual void update() override { }
virtual GUI::ModelIndex index(int row, int column = 0, const GUI::ModelIndex& = GUI::ModelIndex()) const override
{
if (row < 0 || row >= (int)m_matches.size())
diff --git a/Userland/DevTools/Inspector/RemoteObject.cpp b/Userland/DevTools/Inspector/RemoteObject.cpp
index 27e0c3d5842e..f4b044914350 100644
--- a/Userland/DevTools/Inspector/RemoteObject.cpp
+++ b/Userland/DevTools/Inspector/RemoteObject.cpp
@@ -16,7 +16,7 @@ RemoteObject::RemoteObject()
RemoteObjectPropertyModel& RemoteObject::property_model()
{
- m_property_model->update();
+ m_property_model->invalidate();
return *m_property_model;
}
diff --git a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
index 6ac721d98a5e..fa910bc0c705 100644
--- a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
+++ b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
@@ -95,9 +95,4 @@ GUI::Variant RemoteObjectGraphModel::data(const GUI::ModelIndex& index, GUI::Mod
return {};
}
-void RemoteObjectGraphModel::update()
-{
- did_update();
-}
-
}
diff --git a/Userland/DevTools/Inspector/RemoteObjectGraphModel.h b/Userland/DevTools/Inspector/RemoteObjectGraphModel.h
index dd2aec794811..610f03a820b7 100644
--- a/Userland/DevTools/Inspector/RemoteObjectGraphModel.h
+++ b/Userland/DevTools/Inspector/RemoteObjectGraphModel.h
@@ -30,7 +30,6 @@ class RemoteObjectGraphModel final : public GUI::Model {
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
- virtual void update() override;
private:
explicit RemoteObjectGraphModel(RemoteProcess&);
diff --git a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp
index 8244f012e512..85f3aa193621 100644
--- a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp
+++ b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp
@@ -67,11 +67,6 @@ GUI::Variant RemoteObjectPropertyModel::data(const GUI::ModelIndex& index, GUI::
return {};
}
-void RemoteObjectPropertyModel::update()
-{
- did_update();
-}
-
void RemoteObjectPropertyModel::set_data(const GUI::ModelIndex& index, const GUI::Variant& new_value)
{
if (!index.is_valid())
diff --git a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h
index fca20109fe22..8dc7a3d1342d 100644
--- a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h
+++ b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h
@@ -34,7 +34,6 @@ class RemoteObjectPropertyModel final : public GUI::Model {
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual void set_data(const GUI::ModelIndex&, const GUI::Variant&) override;
- virtual void update() override;
virtual bool is_editable(const GUI::ModelIndex& index) const override { return index.column() == Column::Value; }
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
diff --git a/Userland/DevTools/Inspector/RemoteProcess.cpp b/Userland/DevTools/Inspector/RemoteProcess.cpp
index 24a362da4851..9d744189af62 100644
--- a/Userland/DevTools/Inspector/RemoteProcess.cpp
+++ b/Userland/DevTools/Inspector/RemoteProcess.cpp
@@ -71,7 +71,7 @@ void RemoteProcess::handle_get_all_objects_response(const JsonObject& response)
}
}
- m_object_graph_model->update();
+ m_object_graph_model->invalidate();
if (on_update)
on_update();
diff --git a/Userland/DevTools/Profiler/DisassemblyModel.cpp b/Userland/DevTools/Profiler/DisassemblyModel.cpp
index d68f9ac00274..39f1bbc648a4 100644
--- a/Userland/DevTools/Profiler/DisassemblyModel.cpp
+++ b/Userland/DevTools/Profiler/DisassemblyModel.cpp
@@ -207,9 +207,4 @@ GUI::Variant DisassemblyModel::data(const GUI::ModelIndex& index, GUI::ModelRole
return {};
}
-void DisassemblyModel::update()
-{
- did_update();
-}
-
}
diff --git a/Userland/DevTools/Profiler/DisassemblyModel.h b/Userland/DevTools/Profiler/DisassemblyModel.h
index ef3644647769..1cb07448b85c 100644
--- a/Userland/DevTools/Profiler/DisassemblyModel.h
+++ b/Userland/DevTools/Profiler/DisassemblyModel.h
@@ -47,7 +47,6 @@ class DisassemblyModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
virtual bool is_column_sortable(int) const override { return false; }
private:
diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.cpp b/Userland/DevTools/Profiler/IndividualSampleModel.cpp
index 386d55991001..0f18a5c01edb 100644
--- a/Userland/DevTools/Profiler/IndividualSampleModel.cpp
+++ b/Userland/DevTools/Profiler/IndividualSampleModel.cpp
@@ -67,9 +67,4 @@ GUI::Variant IndividualSampleModel::data(const GUI::ModelIndex& index, GUI::Mode
return {};
}
-void IndividualSampleModel::update()
-{
- did_update(Model::InvalidateAllIndices);
-}
-
}
diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.h b/Userland/DevTools/Profiler/IndividualSampleModel.h
index 95abc2541f19..567830d34fa7 100644
--- a/Userland/DevTools/Profiler/IndividualSampleModel.h
+++ b/Userland/DevTools/Profiler/IndividualSampleModel.h
@@ -32,7 +32,6 @@ class IndividualSampleModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
private:
IndividualSampleModel(Profile&, size_t event_index);
diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp
index 86464140b4b6..c78ad405afa4 100644
--- a/Userland/DevTools/Profiler/Profile.cpp
+++ b/Userland/DevTools/Profiler/Profile.cpp
@@ -187,7 +187,7 @@ void Profile::rebuild_tree()
sort_profile_nodes(roots);
m_roots = move(roots);
- m_model->update();
+ m_model->invalidate();
}
Result<NonnullOwnPtr<Profile>, String> Profile::load_from_perfcore_file(const StringView& path)
@@ -378,7 +378,7 @@ void Profile::set_timestamp_filter_range(u64 start, u64 end)
m_timestamp_filter_range_end = max(start, end);
rebuild_tree();
- m_samples_model->update();
+ m_samples_model->invalidate();
}
void Profile::clear_timestamp_filter_range()
@@ -387,7 +387,7 @@ void Profile::clear_timestamp_filter_range()
return;
m_has_timestamp_filter_range = false;
rebuild_tree();
- m_samples_model->update();
+ m_samples_model->invalidate();
}
void Profile::add_process_filter(pid_t pid, EventSerialNumber start_valid, EventSerialNumber end_valid)
@@ -399,8 +399,8 @@ void Profile::add_process_filter(pid_t pid, EventSerialNumber start_valid, Event
rebuild_tree();
if (m_disassembly_model)
- m_disassembly_model->update();
- m_samples_model->update();
+ m_disassembly_model->invalidate();
+ m_samples_model->invalidate();
}
void Profile::remove_process_filter(pid_t pid, EventSerialNumber start_valid, EventSerialNumber end_valid)
@@ -414,8 +414,8 @@ void Profile::remove_process_filter(pid_t pid, EventSerialNumber start_valid, Ev
rebuild_tree();
if (m_disassembly_model)
- m_disassembly_model->update();
- m_samples_model->update();
+ m_disassembly_model->invalidate();
+ m_samples_model->invalidate();
}
void Profile::clear_process_filter()
@@ -425,8 +425,8 @@ void Profile::clear_process_filter()
m_process_filters.clear();
rebuild_tree();
if (m_disassembly_model)
- m_disassembly_model->update();
- m_samples_model->update();
+ m_disassembly_model->invalidate();
+ m_samples_model->invalidate();
}
bool Profile::process_filter_contains(pid_t pid, EventSerialNumber serial)
diff --git a/Userland/DevTools/Profiler/ProfileModel.cpp b/Userland/DevTools/Profiler/ProfileModel.cpp
index 2879da41553d..26342039b163 100644
--- a/Userland/DevTools/Profiler/ProfileModel.cpp
+++ b/Userland/DevTools/Profiler/ProfileModel.cpp
@@ -135,9 +135,4 @@ GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
return {};
}
-void ProfileModel::update()
-{
- did_update(Model::InvalidateAllIndices);
-}
-
}
diff --git a/Userland/DevTools/Profiler/ProfileModel.h b/Userland/DevTools/Profiler/ProfileModel.h
index 84c685940ed1..8adf6fb8c2df 100644
--- a/Userland/DevTools/Profiler/ProfileModel.h
+++ b/Userland/DevTools/Profiler/ProfileModel.h
@@ -35,7 +35,6 @@ class ProfileModel final : public GUI::Model {
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
- virtual void update() override;
virtual int tree_column() const override { return Column::StackFrame; }
virtual bool is_column_sortable(int) const override { return false; }
diff --git a/Userland/DevTools/Profiler/SamplesModel.cpp b/Userland/DevTools/Profiler/SamplesModel.cpp
index 49b2435e2e23..e0f461508d43 100644
--- a/Userland/DevTools/Profiler/SamplesModel.cpp
+++ b/Userland/DevTools/Profiler/SamplesModel.cpp
@@ -94,9 +94,4 @@ GUI::Variant SamplesModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
return {};
}
-void SamplesModel::update()
-{
- did_update(Model::InvalidateAllIndices);
-}
-
}
diff --git a/Userland/DevTools/Profiler/SamplesModel.h b/Userland/DevTools/Profiler/SamplesModel.h
index 8e89d5fc8273..5d190e9e0c1e 100644
--- a/Userland/DevTools/Profiler/SamplesModel.h
+++ b/Userland/DevTools/Profiler/SamplesModel.h
@@ -36,7 +36,6 @@ class SamplesModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
virtual bool is_column_sortable(int) const override { return false; }
private:
diff --git a/Userland/Libraries/LibGUI/AbstractView.h b/Userland/Libraries/LibGUI/AbstractView.h
index 69f734c87f93..2fbb86ae64a9 100644
--- a/Userland/Libraries/LibGUI/AbstractView.h
+++ b/Userland/Libraries/LibGUI/AbstractView.h
@@ -173,7 +173,6 @@ class AbstractView
bool m_editable { false };
bool m_searchable { true };
- ModelIndex m_edit_index;
RefPtr<Widget> m_edit_widget;
Gfx::IntRect m_edit_widget_content_rect;
OwnPtr<ModelEditingDelegate> m_editing_delegate;
@@ -181,20 +180,22 @@ class AbstractView
Gfx::IntPoint m_left_mousedown_position;
bool m_might_drag { false };
- ModelIndex m_hovered_index;
- ModelIndex m_highlighted_search_index;
-
int m_key_column { -1 };
SortOrder m_sort_order;
+ ModelIndex m_edit_index;
+ ModelIndex m_hovered_index;
+ ModelIndex m_highlighted_search_index;
+
private:
+ ModelIndex m_selection_start_index;
+ ModelIndex m_cursor_index;
+ ModelIndex m_drop_candidate_index;
+
RefPtr<Model> m_model;
ModelSelection m_selection;
- ModelIndex m_selection_start_index;
String m_searching;
RefPtr<Core::Timer> m_searching_timer;
- ModelIndex m_cursor_index;
- ModelIndex m_drop_candidate_index;
SelectionBehavior m_selection_behavior { SelectionBehavior::SelectItems };
SelectionMode m_selection_mode { SelectionMode::SingleSelection };
unsigned m_edit_triggers { EditTrigger::DoubleClicked | EditTrigger::EditKeyPressed };
diff --git a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
index 63e5ab18d753..25d604493507 100644
--- a/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
+++ b/Userland/Libraries/LibGUI/AutocompleteProvider.cpp
@@ -69,10 +69,6 @@ class AutocompleteSuggestionModel final : public GUI::Model {
return {};
}
- virtual void update() override
- {
- did_update();
- };
void set_suggestions(Vector<AutocompleteProvider::Entry>&& suggestions) { m_suggestions = move(suggestions); }
@@ -110,7 +106,7 @@ void AutocompleteBox::update_suggestions(Vector<AutocompleteProvider::Entry>&& s
m_suggestion_view->set_cursor(m_suggestion_view->model()->index(0), GUI::AbstractView::SelectionUpdate::Set);
}
- m_suggestion_view->model()->update();
+ m_suggestion_view->model()->invalidate();
m_suggestion_view->update();
if (!has_suggestions)
close();
diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp
index 5babccfca773..0a33540b3f14 100644
--- a/Userland/Libraries/LibGUI/FilePicker.cpp
+++ b/Userland/Libraries/LibGUI/FilePicker.cpp
@@ -135,7 +135,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen
if (rc < 0) {
MessageBox::show(this, String::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(errno)), "Error", MessageBox::Type::Error);
} else {
- m_model->update();
+ m_model->invalidate();
}
}
},
@@ -178,7 +178,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen
m_context_menu->add_action(GUI::Action::create_checkable(
"Show dotfiles", { Mod_Ctrl, Key_H }, [&](auto& action) {
m_model->set_should_show_dotfiles(action.is_checked());
- m_model->update();
+ m_model->invalidate();
},
this));
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp
index 797affd754c0..61f8ee874243 100644
--- a/Userland/Libraries/LibGUI/FileSystemModel.cpp
+++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp
@@ -286,7 +286,7 @@ FileSystemModel::FileSystemModel(String root_path, Mode mode)
did_update();
};
- update();
+ invalidate();
}
FileSystemModel::~FileSystemModel()
@@ -364,7 +364,7 @@ void FileSystemModel::set_root_path(String root_path)
m_root_path = {};
else
m_root_path = LexicalPath::canonicalized_path(move(root_path));
- update();
+ invalidate();
if (m_root->has_error()) {
if (on_directory_change_error)
@@ -374,7 +374,7 @@ void FileSystemModel::set_root_path(String root_path)
}
}
-void FileSystemModel::update()
+void FileSystemModel::invalidate()
{
m_root = adopt_own(*new Node(*this));
@@ -383,7 +383,7 @@ void FileSystemModel::update()
m_root->reify_if_needed();
- did_update();
+ Model::invalidate();
}
int FileSystemModel::row_count(const ModelIndex& index) const
@@ -665,7 +665,9 @@ void FileSystemModel::set_should_show_dotfiles(bool show)
if (m_should_show_dotfiles == show)
return;
m_should_show_dotfiles = show;
- update();
+
+ // FIXME: add a way to granularly update in this case.
+ invalidate();
}
bool FileSystemModel::is_editable(const ModelIndex& index) const
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.h b/Userland/Libraries/LibGUI/FileSystemModel.h
index f1984b3f3c6a..57af96a5f1d0 100644
--- a/Userland/Libraries/LibGUI/FileSystemModel.h
+++ b/Userland/Libraries/LibGUI/FileSystemModel.h
@@ -122,7 +122,6 @@ class FileSystemModel
virtual int column_count(const ModelIndex& = ModelIndex()) const override;
virtual String column_name(int column) const override;
virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const override;
- virtual void update() override;
virtual ModelIndex parent_index(const ModelIndex&) const override;
virtual ModelIndex index(int row, int column = 0, const ModelIndex& parent = ModelIndex()) const override;
virtual StringView drag_data_type() const override { return "text/uri-list"; }
@@ -132,6 +131,7 @@ class FileSystemModel
virtual bool is_searchable() const override { return true; }
virtual void set_data(const ModelIndex&, const Variant&) override;
virtual Vector<ModelIndex, 1> matches(const StringView&, unsigned = MatchesFlag::AllMatching, const ModelIndex& = ModelIndex()) override;
+ virtual void invalidate() override;
static String timestamp_string(time_t timestamp)
{
diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp
index 229e193a700d..eb66668aa08a 100644
--- a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp
+++ b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp
@@ -44,9 +44,9 @@ Variant FilteringProxyModel::data(const ModelIndex& index, ModelRole role) const
return m_matching_indices[index.row()].data(role);
}
-void FilteringProxyModel::update()
+void FilteringProxyModel::invalidate()
{
- m_model.update();
+ m_model.invalidate();
filter();
did_update();
}
@@ -84,7 +84,7 @@ void FilteringProxyModel::set_filter_term(const StringView& term)
if (m_filter_term == term)
return;
m_filter_term = term;
- update();
+ invalidate();
}
ModelIndex FilteringProxyModel::map(const ModelIndex& index) const
diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.h b/Userland/Libraries/LibGUI/FilteringProxyModel.h
index a83fb0f52fc4..31b06b10693d 100644
--- a/Userland/Libraries/LibGUI/FilteringProxyModel.h
+++ b/Userland/Libraries/LibGUI/FilteringProxyModel.h
@@ -26,7 +26,7 @@ class FilteringProxyModel final : public Model {
virtual int row_count(const ModelIndex& = ModelIndex()) const override;
virtual int column_count(const ModelIndex& = ModelIndex()) const override;
virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const override;
- virtual void update() override;
+ virtual void invalidate() override;
virtual ModelIndex index(int row, int column = 0, const ModelIndex& parent = ModelIndex()) const override;
virtual bool is_searchable() const override;
virtual Vector<ModelIndex, 1> matches(const StringView&, unsigned = MatchesFlag::AllMatching, const ModelIndex& = ModelIndex()) override;
diff --git a/Userland/Libraries/LibGUI/FontPicker.cpp b/Userland/Libraries/LibGUI/FontPicker.cpp
index cf84c3875b29..b15cca238141 100644
--- a/Userland/Libraries/LibGUI/FontPicker.cpp
+++ b/Userland/Libraries/LibGUI/FontPicker.cpp
@@ -71,7 +71,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo
if (m_weight.has_value())
index_of_old_weight_in_new_list = m_weights.find_first_index(m_weight.value());
- m_weight_list_view->model()->update();
+ m_weight_list_view->model()->invalidate();
m_weight_list_view->set_cursor(m_weight_list_view->model()->index(index_of_old_weight_in_new_list.value_or(0)), GUI::AbstractView::SelectionUpdate::Set);
update_font();
};
@@ -110,7 +110,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo
}
});
quick_sort(m_sizes);
- m_size_list_view->model()->update();
+ m_size_list_view->model()->invalidate();
m_size_list_view->set_selection_mode(GUI::AbstractView::SelectionMode::SingleSelection);
if (m_size.has_value()) {
@@ -188,8 +188,8 @@ void FontPicker::set_font(const Gfx::Font* font)
m_size = {};
m_weights.clear();
m_sizes.clear();
- m_weight_list_view->model()->update();
- m_size_list_view->model()->update();
+ m_weight_list_view->model()->invalidate();
+ m_size_list_view->model()->invalidate();
return;
}
diff --git a/Userland/Libraries/LibGUI/ItemListModel.h b/Userland/Libraries/LibGUI/ItemListModel.h
index fc6cbca461ba..4d4cca79f448 100644
--- a/Userland/Libraries/LibGUI/ItemListModel.h
+++ b/Userland/Libraries/LibGUI/ItemListModel.h
@@ -77,11 +77,6 @@ class ItemListModel : public Model {
return {};
}
- virtual void update() override
- {
- did_update();
- }
-
protected:
explicit ItemListModel(const Container& data, Optional<size_t> row_count = {}) requires(!IsTwoDimensional)
: m_data(data)
diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.cpp b/Userland/Libraries/LibGUI/JsonArrayModel.cpp
index f294083f142d..409c8ed732f3 100644
--- a/Userland/Libraries/LibGUI/JsonArrayModel.cpp
+++ b/Userland/Libraries/LibGUI/JsonArrayModel.cpp
@@ -10,7 +10,7 @@
namespace GUI {
-void JsonArrayModel::update()
+void JsonArrayModel::invalidate()
{
auto file = Core::File::construct(m_json_path);
if (!file->open(Core::OpenMode::ReadOnly)) {
@@ -131,7 +131,7 @@ void JsonArrayModel::set_json_path(const String& json_path)
return;
m_json_path = json_path;
- update();
+ invalidate();
}
}
diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.h b/Userland/Libraries/LibGUI/JsonArrayModel.h
index c8233bd15e9d..e898f9814626 100644
--- a/Userland/Libraries/LibGUI/JsonArrayModel.h
+++ b/Userland/Libraries/LibGUI/JsonArrayModel.h
@@ -50,7 +50,7 @@ class JsonArrayModel final : public Model {
virtual int column_count(const ModelIndex& = ModelIndex()) const override { return m_fields.size(); }
virtual String column_name(int column) const override { return m_fields[column].column_name; }
virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const override;
- virtual void update() override;
+ virtual void invalidate() override;
const String& json_path() const { return m_json_path; }
void set_json_path(const String& json_path);
diff --git a/Userland/Libraries/LibGUI/Model.cpp b/Userland/Libraries/LibGUI/Model.cpp
index 46420edfadb9..5a0406a1bbc3 100644
--- a/Userland/Libraries/LibGUI/Model.cpp
+++ b/Userland/Libraries/LibGUI/Model.cpp
@@ -29,6 +29,11 @@ void Model::unregister_view(Badge<AbstractView>, AbstractView& view)
m_clients.remove(&view);
}
+void Model::invalidate()
+{
+ did_update();
+}
+
void Model::for_each_view(Function<void(AbstractView&)> callback)
{
for (auto* view : m_views)
diff --git a/Userland/Libraries/LibGUI/Model.h b/Userland/Libraries/LibGUI/Model.h
index 8a314c45633f..551a30964b27 100644
--- a/Userland/Libraries/LibGUI/Model.h
+++ b/Userland/Libraries/LibGUI/Model.h
@@ -56,7 +56,7 @@ class Model : public RefCounted<Model> {
virtual String column_name(int) const { return {}; }
virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const = 0;
virtual TriState data_matches(const ModelIndex&, const Variant&) const { return TriState::Unknown; }
- virtual void update() = 0;
+ virtual void invalidate();
virtual ModelIndex parent_index(const ModelIndex&) const { return {}; }
virtual ModelIndex index(int row, int column = 0, const ModelIndex& parent = ModelIndex()) const;
virtual bool is_editable(const ModelIndex&) const { return false; }
diff --git a/Userland/Libraries/LibGUI/ProcessChooser.cpp b/Userland/Libraries/LibGUI/ProcessChooser.cpp
index d49d19929c1a..bd8b1b11439c 100644
--- a/Userland/Libraries/LibGUI/ProcessChooser.cpp
+++ b/Userland/Libraries/LibGUI/ProcessChooser.cpp
@@ -65,7 +65,7 @@ ProcessChooser::ProcessChooser(const StringView& window_title, const StringView&
done(ExecCancel);
};
- m_table_view->model()->update();
+ m_table_view->model()->invalidate();
m_refresh_timer = add<Core::Timer>();
@@ -77,7 +77,7 @@ ProcessChooser::ProcessChooser(const StringView& window_title, const StringView&
previous_selected_pid = pid_as_variant.as_i32();
}
- m_table_view->model()->update();
+ m_table_view->model()->invalidate();
if (previous_selected_pid == -1) {
return;
diff --git a/Userland/Libraries/LibGUI/RunningProcessesModel.h b/Userland/Libraries/LibGUI/RunningProcessesModel.h
index 7b18e9a33707..f57017e8186f 100644
--- a/Userland/Libraries/LibGUI/RunningProcessesModel.h
+++ b/Userland/Libraries/LibGUI/RunningProcessesModel.h
@@ -28,7 +28,8 @@ class RunningProcessesModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex&) const override;
virtual String column_name(int column_index) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
+
+ void update();
private:
RunningProcessesModel();
diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.cpp b/Userland/Libraries/LibGUI/SortingProxyModel.cpp
index 7ae72e907ee3..fd8a4dbb5197 100644
--- a/Userland/Libraries/LibGUI/SortingProxyModel.cpp
+++ b/Userland/Libraries/LibGUI/SortingProxyModel.cpp
@@ -14,7 +14,7 @@ SortingProxyModel::SortingProxyModel(NonnullRefPtr<Model> source)
: m_source(move(source))
{
m_source->register_client(*this);
- invalidate();
+ update_sort();
}
SortingProxyModel::~SortingProxyModel()
@@ -22,7 +22,13 @@ SortingProxyModel::~SortingProxyModel()
m_source->unregister_client(*this);
}
-void SortingProxyModel::invalidate(unsigned int flags)
+void SortingProxyModel::invalidate()
+{
+ source().invalidate();
+ Model::invalidate();
+}
+
+void SortingProxyModel::update_sort(unsigned flags)
{
if (flags == UpdateFlag::DontInvalidateIndices) {
sort(m_last_key_column, m_last_sort_order);
@@ -40,7 +46,7 @@ void SortingProxyModel::invalidate(unsigned int flags)
void SortingProxyModel::model_did_update(unsigned flags)
{
- invalidate(flags);
+ update_sort(flags);
}
bool SortingProxyModel::accepts_drag(const ModelIndex& proxy_index, const Vector<String>& mime_types) const
@@ -110,11 +116,6 @@ Variant SortingProxyModel::data(const ModelIndex& proxy_index, ModelRole role) c
return source().data(map_to_source(proxy_index), role);
}
-void SortingProxyModel::update()
-{
- source().update();
-}
-
StringView SortingProxyModel::drag_data_type() const
{
return source().drag_data_type();
diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.h b/Userland/Libraries/LibGUI/SortingProxyModel.h
index 22ce2935a4a7..27d6c351322e 100644
--- a/Userland/Libraries/LibGUI/SortingProxyModel.h
+++ b/Userland/Libraries/LibGUI/SortingProxyModel.h
@@ -21,7 +21,7 @@ class SortingProxyModel
virtual int column_count(const ModelIndex& = ModelIndex()) const override;
virtual String column_name(int) const override;
virtual Variant data(const ModelIndex&, ModelRole = ModelRole::Display) const override;
- virtual void update() override;
+ virtual void invalidate() override;
virtual StringView drag_data_type() const override;
virtual ModelIndex parent_index(const ModelIndex&) const override;
virtual ModelIndex index(int row, int column, const ModelIndex& parent) const override;
@@ -63,7 +63,7 @@ class SortingProxyModel
Model& source() { return *m_source; }
const Model& source() const { return *m_source; }
- void invalidate(unsigned flags = Model::UpdateFlag::DontInvalidateIndices);
+ void update_sort(unsigned = UpdateFlag::DontInvalidateIndices);
InternalMapIterator build_mapping(const ModelIndex& proxy_index);
NonnullRefPtr<Model> m_source;
diff --git a/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp b/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp
index a4a9300bc902..dbff61cd718e 100644
--- a/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp
+++ b/Userland/Libraries/LibWeb/DOMTreeJSONModel.cpp
@@ -152,11 +152,6 @@ GUI::Variant DOMTreeJSONModel::data(const GUI::ModelIndex& index, GUI::ModelRole
return {};
}
-void DOMTreeJSONModel::update()
-{
- did_update();
-}
-
void DOMTreeJSONModel::map_dom_nodes_to_parent(JsonObject const* parent, JsonObject const* node)
{
m_dom_node_to_parent_map.set(node, parent);
diff --git a/Userland/Libraries/LibWeb/DOMTreeJSONModel.h b/Userland/Libraries/LibWeb/DOMTreeJSONModel.h
index 90f6cfe862f2..f80f1b52b8c3 100644
--- a/Userland/Libraries/LibWeb/DOMTreeJSONModel.h
+++ b/Userland/Libraries/LibWeb/DOMTreeJSONModel.h
@@ -32,7 +32,6 @@ class DOMTreeJSONModel final : public GUI::Model {
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
- virtual void update() override;
private:
explicit DOMTreeJSONModel(JsonObject);
diff --git a/Userland/Libraries/LibWeb/DOMTreeModel.cpp b/Userland/Libraries/LibWeb/DOMTreeModel.cpp
index 35a2799cc0cb..df2209687a44 100644
--- a/Userland/Libraries/LibWeb/DOMTreeModel.cpp
+++ b/Userland/Libraries/LibWeb/DOMTreeModel.cpp
@@ -131,9 +131,4 @@ GUI::Variant DOMTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
return {};
}
-void DOMTreeModel::update()
-{
- did_update();
-}
-
}
diff --git a/Userland/Libraries/LibWeb/DOMTreeModel.h b/Userland/Libraries/LibWeb/DOMTreeModel.h
index 7a0c6656e486..574c2b316c9e 100644
--- a/Userland/Libraries/LibWeb/DOMTreeModel.h
+++ b/Userland/Libraries/LibWeb/DOMTreeModel.h
@@ -25,7 +25,6 @@ class DOMTreeModel final : public GUI::Model {
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
- virtual void update() override;
private:
explicit DOMTreeModel(DOM::Document&);
diff --git a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp
index 164b6a0b43b4..80f508486c12 100644
--- a/Userland/Libraries/LibWeb/LayoutTreeModel.cpp
+++ b/Userland/Libraries/LibWeb/LayoutTreeModel.cpp
@@ -134,9 +134,4 @@ GUI::Variant LayoutTreeModel::data(const GUI::ModelIndex& index, GUI::ModelRole
return {};
}
-void LayoutTreeModel::update()
-{
- did_update();
-}
-
}
diff --git a/Userland/Libraries/LibWeb/LayoutTreeModel.h b/Userland/Libraries/LibWeb/LayoutTreeModel.h
index ec203227d279..c533a95e3126 100644
--- a/Userland/Libraries/LibWeb/LayoutTreeModel.h
+++ b/Userland/Libraries/LibWeb/LayoutTreeModel.h
@@ -25,7 +25,6 @@ class LayoutTreeModel final : public GUI::Model {
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex& parent = GUI::ModelIndex()) const override;
virtual GUI::ModelIndex parent_index(const GUI::ModelIndex&) const override;
- virtual void update() override;
private:
explicit LayoutTreeModel(DOM::Document&);
diff --git a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp
index fbc95c695823..50ebd5b5e76e 100644
--- a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp
+++ b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp
@@ -53,9 +53,4 @@ GUI::Variant StylePropertiesModel::data(const GUI::ModelIndex& index, GUI::Model
return {};
}
-void StylePropertiesModel::update()
-{
- did_update();
-}
-
}
diff --git a/Userland/Libraries/LibWeb/StylePropertiesModel.h b/Userland/Libraries/LibWeb/StylePropertiesModel.h
index eba051770848..a5e84c617aa1 100644
--- a/Userland/Libraries/LibWeb/StylePropertiesModel.h
+++ b/Userland/Libraries/LibWeb/StylePropertiesModel.h
@@ -28,7 +28,6 @@ class StylePropertiesModel final : public GUI::Model {
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
- virtual void update() override;
private:
explicit StylePropertiesModel(const CSS::StyleProperties& properties);
|
44a6d7968a00f2b70720897d660f1512e3645416
|
2021-12-24 19:25:34
|
Michel Hermier
|
tests: Benchmark `DisjointChunck::is_empty`
| false
|
Benchmark `DisjointChunck::is_empty`
|
tests
|
diff --git a/Tests/AK/TestDisjointChunks.cpp b/Tests/AK/TestDisjointChunks.cpp
index 0d6c1d1f21b3..e8897d2a1515 100644
--- a/Tests/AK/TestDisjointChunks.cpp
+++ b/Tests/AK/TestDisjointChunks.cpp
@@ -80,3 +80,59 @@ TEST_CASE(spans)
EXPECT_EQ(it, cross_chunk_slice.end());
}
+
+#define INIT_ITERATIONS (1'000'000)
+#define ITERATIONS (100)
+
+static DisjointChunks<int> basic_really_empty_chunks;
+
+BENCHMARK_CASE(basic_really_empty)
+{
+ DisjointChunks<int> chunks;
+ for (size_t i = 0; i < ITERATIONS; ++i)
+ EXPECT(chunks.is_empty());
+}
+
+static DisjointChunks<int> basic_really_empty_large_chunks = []() {
+ DisjointChunks<int> chunks;
+ chunks.ensure_capacity(INIT_ITERATIONS);
+ for (size_t i = 0; i < INIT_ITERATIONS; ++i)
+ chunks.append({});
+ return chunks;
+}();
+
+BENCHMARK_CASE(basic_really_empty_large)
+{
+ for (size_t i = 0; i < ITERATIONS; ++i)
+ EXPECT(basic_really_empty_large_chunks.is_empty());
+}
+
+static DisjointChunks<int> basic_mostly_empty_chunks = []() {
+ DisjointChunks<int> chunks;
+ chunks.ensure_capacity(INIT_ITERATIONS + 1);
+ for (size_t i = 0; i < INIT_ITERATIONS; ++i)
+ chunks.append({});
+ chunks.append({ 1, 2, 3 });
+ return chunks;
+}();
+
+BENCHMARK_CASE(basic_mostly_empty)
+{
+ for (size_t i = 0; i < ITERATIONS; ++i) {
+ EXPECT(!basic_mostly_empty_chunks.is_empty());
+ }
+}
+
+static DisjointChunks<int> basic_full_chunks = []() {
+ DisjointChunks<int> chunks;
+ chunks.ensure_capacity(INIT_ITERATIONS + 1);
+ for (size_t i = 0; i < INIT_ITERATIONS; ++i)
+ chunks.append({ 1, 2, 3 });
+ return chunks;
+}();
+
+BENCHMARK_CASE(basic_full)
+{
+ for (size_t i = 0; i < ITERATIONS; ++i)
+ EXPECT(!basic_full_chunks.is_empty());
+}
|
81047d8f9cb092fa3ef83c4e06f1dfd8f65173be
|
2021-12-06 23:52:16
|
Andreas Kling
|
libcore: Make LocalServer::take_over_from_system_server() return ErrorOr
| false
|
Make LocalServer::take_over_from_system_server() return ErrorOr
|
libcore
|
diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp
index d1362b41ef15..aaba58baf9d6 100644
--- a/Userland/Libraries/LibCore/LocalServer.cpp
+++ b/Userland/Libraries/LibCore/LocalServer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Andreas Kling <[email protected]>
+ * Copyright (c) 2018-2021, Andreas Kling <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -7,6 +7,7 @@
#include <LibCore/LocalServer.h>
#include <LibCore/LocalSocket.h>
#include <LibCore/Notifier.h>
+#include <LibCore/System.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/socket.h>
@@ -30,10 +31,10 @@ LocalServer::~LocalServer()
::close(m_fd);
}
-bool LocalServer::take_over_from_system_server(String const& socket_path)
+ErrorOr<void> LocalServer::take_over_from_system_server(String const& socket_path)
{
if (m_listening)
- return false;
+ return Error::from_string_literal("Core::LocalServer: Can't perform socket takeover when already listening"sv);
if (!LocalSocket::s_overtaken_sockets_parsed)
LocalSocket::parse_sockets_from_system_server();
@@ -51,32 +52,27 @@ bool LocalServer::take_over_from_system_server(String const& socket_path)
}
}
- if (fd >= 0) {
- // Sanity check: it has to be a socket.
- struct stat stat;
- int rc = fstat(fd, &stat);
- if (rc == 0 && S_ISSOCK(stat.st_mode)) {
- // The SystemServer has passed us the socket, so use that instead of
- // creating our own.
- m_fd = fd;
- // It had to be !CLOEXEC for obvious reasons, but we
- // don't need it to be !CLOEXEC anymore, so set the
- // CLOEXEC flag now.
- fcntl(m_fd, F_SETFD, FD_CLOEXEC);
-
- m_listening = true;
- setup_notifier();
- return true;
- } else {
- if (rc != 0)
- perror("fstat");
- dbgln("It's not a socket, what the heck??");
- }
- }
+ if (fd < 0)
+ return Error::from_string_literal("Core::LocalServer: No file descriptor for socket takeover"sv);
+
+ // Sanity check: it has to be a socket.
+ auto stat = TRY(Core::System::fstat(fd));
- dbgln("Failed to take the socket over from SystemServer");
+ if (!S_ISSOCK(stat.st_mode))
+ return Error::from_string_literal("Core::LocalServer: Attempted socket takeover with non-socket file descriptor"sv);
- return false;
+ // It had to be !CLOEXEC for obvious reasons, but we
+ // don't need it to be !CLOEXEC anymore, so set the
+ // CLOEXEC flag now.
+ TRY(Core::System::fcntl(fd, F_SETFD, FD_CLOEXEC));
+
+ // The SystemServer has passed us the socket, so use that instead of
+ // creating our own.
+ m_fd = fd;
+
+ m_listening = true;
+ setup_notifier();
+ return {};
}
void LocalServer::setup_notifier()
diff --git a/Userland/Libraries/LibCore/LocalServer.h b/Userland/Libraries/LibCore/LocalServer.h
index 7974d3aa28d2..ba7a56d7d231 100644
--- a/Userland/Libraries/LibCore/LocalServer.h
+++ b/Userland/Libraries/LibCore/LocalServer.h
@@ -16,7 +16,7 @@ class LocalServer : public Object {
public:
virtual ~LocalServer() override;
- bool take_over_from_system_server(String const& path = String());
+ ErrorOr<void> take_over_from_system_server(String const& path = String());
bool is_listening() const { return m_listening; }
bool listen(const String& address);
diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
index f354be13dcce..2bde03a70ecf 100644
--- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
+++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
@@ -44,9 +44,12 @@ bool MediaQueryList::matches() const
bool MediaQueryList::evaluate()
{
+ if (!m_document)
+ return false;
+
bool now_matches = false;
for (auto& media : m_media) {
- now_matches = now_matches || media.evaluate(m_document.window());
+ now_matches = now_matches || media.evaluate(m_document->window());
}
return now_matches;
diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.h b/Userland/Libraries/LibWeb/CSS/MediaQueryList.h
index ced43fe3d249..0585e759e123 100644
--- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.h
+++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.h
@@ -54,7 +54,7 @@ class MediaQueryList final
private:
MediaQueryList(DOM::Document&, NonnullRefPtrVector<MediaQuery>&&);
- DOM::Document& m_document;
+ WeakPtr<DOM::Document> m_document;
NonnullRefPtrVector<MediaQuery> m_media;
};
diff --git a/Userland/Services/AudioServer/main.cpp b/Userland/Services/AudioServer/main.cpp
index 72593f9d971f..3e00d15e8af2 100644
--- a/Userland/Services/AudioServer/main.cpp
+++ b/Userland/Services/AudioServer/main.cpp
@@ -23,8 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
Core::EventLoop event_loop;
auto mixer = TRY(AudioServer::Mixer::try_create(config));
auto server = TRY(Core::LocalServer::try_create());
- bool ok = server->take_over_from_system_server();
- VERIFY(ok);
+ TRY(server->take_over_from_system_server());
server->on_accept = [&](NonnullRefPtr<Core::LocalSocket> client_socket) {
static int s_next_client_id = 0;
diff --git a/Userland/Services/Clipboard/main.cpp b/Userland/Services/Clipboard/main.cpp
index 5e95d376b026..ea4ddc48556b 100644
--- a/Userland/Services/Clipboard/main.cpp
+++ b/Userland/Services/Clipboard/main.cpp
@@ -19,8 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
TRY(Core::System::unveil(nullptr, nullptr));
auto server = TRY(Core::LocalServer::try_create());
- bool ok = server->take_over_from_system_server();
- VERIFY(ok);
+ TRY(server->take_over_from_system_server());
server->on_accept = [&](auto client_socket) {
static int s_next_client_id = 0;
diff --git a/Userland/Services/ConfigServer/main.cpp b/Userland/Services/ConfigServer/main.cpp
index 65bbab3ae191..cde261b8a795 100644
--- a/Userland/Services/ConfigServer/main.cpp
+++ b/Userland/Services/ConfigServer/main.cpp
@@ -17,10 +17,9 @@ ErrorOr<int> serenity_main(Main::Arguments)
TRY(Core::System::unveil(nullptr, nullptr));
Core::EventLoop event_loop;
- auto server = TRY(Core::LocalServer::try_create());
- bool ok = server->take_over_from_system_server();
- VERIFY(ok);
+ auto server = TRY(Core::LocalServer::try_create());
+ TRY(server->take_over_from_system_server());
server->on_accept = [&](auto client_socket) {
static int s_next_client_id = 0;
int client_id = ++s_next_client_id;
diff --git a/Userland/Services/InspectorServer/main.cpp b/Userland/Services/InspectorServer/main.cpp
index 79d7f0fe602b..5029ffdc9044 100644
--- a/Userland/Services/InspectorServer/main.cpp
+++ b/Userland/Services/InspectorServer/main.cpp
@@ -19,8 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
TRY(Core::System::pledge("stdio unix accept"));
- bool ok = server->take_over_from_system_server("/tmp/portal/inspector");
- VERIFY(ok);
+ TRY(server->take_over_from_system_server("/tmp/portal/inspector"));
server->on_accept = [&](auto client_socket) {
static int s_next_client_id = 0;
int client_id = ++s_next_client_id;
@@ -28,8 +27,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
};
auto inspectables_server = TRY(Core::LocalServer::try_create());
- if (!inspectables_server->take_over_from_system_server("/tmp/portal/inspectables"))
- VERIFY_NOT_REACHED();
+ TRY(inspectables_server->take_over_from_system_server("/tmp/portal/inspectables"));
inspectables_server->on_accept = [&](auto client_socket) {
auto pid = client_socket->peer_pid();
diff --git a/Userland/Services/LaunchServer/main.cpp b/Userland/Services/LaunchServer/main.cpp
index 3b0d23bfc9d4..00d6137fb2d7 100644
--- a/Userland/Services/LaunchServer/main.cpp
+++ b/Userland/Services/LaunchServer/main.cpp
@@ -23,8 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
TRY(Core::System::pledge("stdio accept rpath proc exec"));
- bool ok = server->take_over_from_system_server();
- VERIFY(ok);
+ TRY(server->take_over_from_system_server());
server->on_accept = [&](auto client_socket) {
static int s_next_client_id = 0;
int client_id = ++s_next_client_id;
diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp
index 8d5f02163ae4..9cc5115117b0 100644
--- a/Userland/Services/LookupServer/LookupServer.cpp
+++ b/Userland/Services/LookupServer/LookupServer.cpp
@@ -78,8 +78,7 @@ LookupServer::LookupServer()
int client_id = ++s_next_client_id;
(void)IPC::new_client_connection<ClientConnection>(move(client_socket), client_id);
};
- bool ok = m_local_server->take_over_from_system_server();
- VERIFY(ok);
+ MUST(m_local_server->take_over_from_system_server());
}
void LookupServer::load_etc_hosts()
diff --git a/Userland/Services/NotificationServer/main.cpp b/Userland/Services/NotificationServer/main.cpp
index 7a3182166efe..ef74de1a2e0a 100644
--- a/Userland/Services/NotificationServer/main.cpp
+++ b/Userland/Services/NotificationServer/main.cpp
@@ -18,8 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app = TRY(GUI::Application::try_create(arguments));
auto server = TRY(Core::LocalServer::try_create());
- bool ok = server->take_over_from_system_server();
- VERIFY(ok);
+ TRY(server->take_over_from_system_server());
server->on_accept = [&](auto client_socket) {
static int s_next_client_id = 0;
int client_id = ++s_next_client_id;
diff --git a/Userland/Services/SQLServer/main.cpp b/Userland/Services/SQLServer/main.cpp
index cb387f13ebc8..814d3e342cc4 100644
--- a/Userland/Services/SQLServer/main.cpp
+++ b/Userland/Services/SQLServer/main.cpp
@@ -25,10 +25,9 @@ ErrorOr<int> serenity_main(Main::Arguments)
TRY(Core::System::unveil(nullptr, nullptr));
Core::EventLoop event_loop;
- auto server = TRY(Core::LocalServer::try_create());
- bool ok = server->take_over_from_system_server();
- VERIFY(ok);
+ auto server = TRY(Core::LocalServer::try_create());
+ TRY(server->take_over_from_system_server());
server->on_accept = [&](auto client_socket) {
static int s_next_client_id = 0;
int client_id = ++s_next_client_id;
diff --git a/Userland/Services/WindowServer/EventLoop.cpp b/Userland/Services/WindowServer/EventLoop.cpp
index 7f9c21c63db8..15a4f3d7013b 100644
--- a/Userland/Services/WindowServer/EventLoop.cpp
+++ b/Userland/Services/WindowServer/EventLoop.cpp
@@ -25,10 +25,8 @@ EventLoop::EventLoop()
m_keyboard_fd = open("/dev/keyboard0", O_RDONLY | O_NONBLOCK | O_CLOEXEC);
m_mouse_fd = open("/dev/mouse0", O_RDONLY | O_NONBLOCK | O_CLOEXEC);
- bool ok = m_window_server->take_over_from_system_server("/tmp/portal/window");
- VERIFY(ok);
- ok = m_wm_server->take_over_from_system_server("/tmp/portal/wm");
- VERIFY(ok);
+ MUST(m_window_server->take_over_from_system_server("/tmp/portal/window"));
+ MUST(m_wm_server->take_over_from_system_server("/tmp/portal/wm"));
m_window_server->on_accept = [&](auto client_socket) {
static int s_next_client_id = 0;
|
869393c7a01addf077de5ddbc8da9a20db92bab0
|
2022-03-03 18:20:25
|
Stephan Unverwerth
|
libgl: Fix interpretation of mipmap filtering modes
| false
|
Fix interpretation of mipmap filtering modes
|
libgl
|
diff --git a/Userland/Libraries/LibGL/SoftwareGLContext.cpp b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
index 475d22e8894f..d6424d67bee8 100644
--- a/Userland/Libraries/LibGL/SoftwareGLContext.cpp
+++ b/Userland/Libraries/LibGL/SoftwareGLContext.cpp
@@ -2996,13 +2996,13 @@ void SoftwareGLContext::sync_device_sampler_config()
config.mipmap_filter = SoftGPU::MipMapFilter::Nearest;
break;
case GL_LINEAR_MIPMAP_NEAREST:
- config.texture_min_filter = SoftGPU::TextureFilter::Nearest;
- config.mipmap_filter = SoftGPU::MipMapFilter::Linear;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
config.texture_min_filter = SoftGPU::TextureFilter::Linear;
config.mipmap_filter = SoftGPU::MipMapFilter::Nearest;
break;
+ case GL_NEAREST_MIPMAP_LINEAR:
+ config.texture_min_filter = SoftGPU::TextureFilter::Nearest;
+ config.mipmap_filter = SoftGPU::MipMapFilter::Linear;
+ break;
case GL_LINEAR_MIPMAP_LINEAR:
config.texture_min_filter = SoftGPU::TextureFilter::Linear;
config.mipmap_filter = SoftGPU::MipMapFilter::Linear;
|
655f4daeb1c88dfd38736b78cac697aab6e709f3
|
2020-07-06 20:47:24
|
Tom
|
kernel: Minor MM optimization for SMP
| false
|
Minor MM optimization for SMP
|
kernel
|
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp
index a01c61154179..eac9f719945e 100644
--- a/Kernel/VM/MemoryManager.cpp
+++ b/Kernel/VM/MemoryManager.cpp
@@ -60,6 +60,7 @@ MemoryManager& MM
MemoryManager::MemoryManager()
{
+ ScopedSpinLock lock(s_mm_lock);
m_kernel_page_directory = PageDirectory::create_kernel_page_directory();
parse_memory_map();
write_cr3(kernel_page_directory().cr3());
@@ -165,7 +166,7 @@ void MemoryManager::parse_memory_map()
const PageTableEntry* MemoryManager::pte(const PageDirectory& page_directory, VirtualAddress vaddr)
{
ASSERT_INTERRUPTS_DISABLED();
- ScopedSpinLock lock(s_mm_lock);
+ ASSERT(s_mm_lock.own_lock());
u32 page_directory_table_index = (vaddr.get() >> 30) & 0x3;
u32 page_directory_index = (vaddr.get() >> 21) & 0x1ff;
u32 page_table_index = (vaddr.get() >> 12) & 0x1ff;
@@ -181,7 +182,7 @@ const PageTableEntry* MemoryManager::pte(const PageDirectory& page_directory, Vi
PageTableEntry& MemoryManager::ensure_pte(PageDirectory& page_directory, VirtualAddress vaddr)
{
ASSERT_INTERRUPTS_DISABLED();
- ScopedSpinLock lock(s_mm_lock);
+ ASSERT(s_mm_lock.own_lock());
u32 page_directory_table_index = (vaddr.get() >> 30) & 0x3;
u32 page_directory_index = (vaddr.get() >> 21) & 0x1ff;
u32 page_table_index = (vaddr.get() >> 12) & 0x1ff;
@@ -554,7 +555,7 @@ extern "C" PageTableEntry boot_pd3_pt1023[1024];
PageDirectoryEntry* MemoryManager::quickmap_pd(PageDirectory& directory, size_t pdpt_index)
{
- ScopedSpinLock lock(s_mm_lock);
+ ASSERT(s_mm_lock.own_lock());
auto& pte = boot_pd3_pt1023[4];
auto pd_paddr = directory.m_directory_pages[pdpt_index]->paddr();
if (pte.physical_page_base() != pd_paddr.as_ptr()) {
@@ -565,14 +566,17 @@ PageDirectoryEntry* MemoryManager::quickmap_pd(PageDirectory& directory, size_t
pte.set_present(true);
pte.set_writable(true);
pte.set_user_allowed(false);
- flush_tlb(VirtualAddress(0xffe04000));
+ // Because we must continue to hold the MM lock while we use this
+ // mapping, it is sufficient to only flush on the current CPU. Other
+ // CPUs trying to use this API must wait on the MM lock anyway
+ flush_tlb_local(VirtualAddress(0xffe04000));
}
return (PageDirectoryEntry*)0xffe04000;
}
PageTableEntry* MemoryManager::quickmap_pt(PhysicalAddress pt_paddr)
{
- ScopedSpinLock lock(s_mm_lock);
+ ASSERT(s_mm_lock.own_lock());
auto& pte = boot_pd3_pt1023[0];
if (pte.physical_page_base() != pt_paddr.as_ptr()) {
#ifdef MM_DEBUG
@@ -582,7 +586,10 @@ PageTableEntry* MemoryManager::quickmap_pt(PhysicalAddress pt_paddr)
pte.set_present(true);
pte.set_writable(true);
pte.set_user_allowed(false);
- flush_tlb(VirtualAddress(0xffe00000));
+ // Because we must continue to hold the MM lock while we use this
+ // mapping, it is sufficient to only flush on the current CPU. Other
+ // CPUs trying to use this API must wait on the MM lock anyway
+ flush_tlb_local(VirtualAddress(0xffe00000));
}
return (PageTableEntry*)0xffe00000;
}
@@ -606,7 +613,7 @@ u8* MemoryManager::quickmap_page(PhysicalPage& physical_page)
pte.set_present(true);
pte.set_writable(true);
pte.set_user_allowed(false);
- flush_tlb_local(vaddr, 1);
+ flush_tlb_local(vaddr);
}
return vaddr.as_ptr();
}
@@ -621,7 +628,7 @@ void MemoryManager::unquickmap_page()
VirtualAddress vaddr(0xffe00000 + pte_idx * PAGE_SIZE);
auto& pte = boot_pd3_pt1023[pte_idx];
pte.clear();
- flush_tlb_local(vaddr, 1);
+ flush_tlb_local(vaddr);
mm_data.m_quickmap_in_use.unlock(mm_data.m_quickmap_prev_flags);
}
diff --git a/Kernel/VM/PageDirectory.cpp b/Kernel/VM/PageDirectory.cpp
index e04778dae9c9..b04febad88c2 100644
--- a/Kernel/VM/PageDirectory.cpp
+++ b/Kernel/VM/PageDirectory.cpp
@@ -48,7 +48,7 @@ static HashMap<u32, PageDirectory*>& cr3_map()
RefPtr<PageDirectory> PageDirectory::find_by_cr3(u32 cr3)
{
- InterruptDisabler disabler;
+ ScopedSpinLock lock(s_mm_lock);
return cr3_map().get(cr3).value_or({});
}
@@ -76,6 +76,7 @@ PageDirectory::PageDirectory()
PageDirectory::PageDirectory(Process& process, const RangeAllocator* parent_range_allocator)
: m_process(&process)
{
+ ScopedSpinLock lock(s_mm_lock);
if (parent_range_allocator) {
m_range_allocator.initialize_from_parent(*parent_range_allocator);
} else {
@@ -93,7 +94,6 @@ PageDirectory::PageDirectory(Process& process, const RangeAllocator* parent_rang
m_directory_pages[3] = MM.kernel_page_directory().m_directory_pages[3];
{
- InterruptDisabler disabler;
auto& table = *(PageDirectoryPointerTable*)MM.quickmap_page(*m_directory_table);
table.raw[0] = (u64)m_directory_pages[0]->paddr().as_ptr() | 1;
table.raw[1] = (u64)m_directory_pages[1]->paddr().as_ptr() | 1;
@@ -109,7 +109,6 @@ PageDirectory::PageDirectory(Process& process, const RangeAllocator* parent_rang
auto* new_pd = MM.quickmap_pd(*this, 0);
memcpy(new_pd, &buffer, sizeof(PageDirectoryEntry));
- InterruptDisabler disabler;
cr3_map().set(cr3(), this);
}
@@ -118,7 +117,7 @@ PageDirectory::~PageDirectory()
#ifdef MM_DEBUG
dbg() << "MM: ~PageDirectory K" << this;
#endif
- InterruptDisabler disabler;
+ ScopedSpinLock lock(s_mm_lock);
cr3_map().remove(cr3());
}
|
0d2bfe5c65b0820c84d77039b2b720194f44e68a
|
2020-02-26 00:26:48
|
joshua stein
|
build: Only look at SUBDIRS with Makefiles
| false
|
Only look at SUBDIRS with Makefiles
|
build
|
diff --git a/Applications/Makefile b/Applications/Makefile
index 6a7b80e89528..0025ae2061ef 100644
--- a/Applications/Makefile
+++ b/Applications/Makefile
@@ -1,3 +1,3 @@
-SUBDIRS := $(wildcard */.)
+SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir
diff --git a/Demos/Makefile b/Demos/Makefile
index 6a7b80e89528..0025ae2061ef 100644
--- a/Demos/Makefile
+++ b/Demos/Makefile
@@ -1,3 +1,3 @@
-SUBDIRS := $(wildcard */.)
+SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir
diff --git a/DevTools/Makefile b/DevTools/Makefile
index 6a7b80e89528..0025ae2061ef 100644
--- a/DevTools/Makefile
+++ b/DevTools/Makefile
@@ -1,3 +1,3 @@
-SUBDIRS := $(wildcard */.)
+SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir
diff --git a/Games/Makefile b/Games/Makefile
index 6a7b80e89528..0025ae2061ef 100644
--- a/Games/Makefile
+++ b/Games/Makefile
@@ -1,3 +1,3 @@
-SUBDIRS := $(wildcard */.)
+SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir
diff --git a/Libraries/Makefile b/Libraries/Makefile
index 6a7b80e89528..0025ae2061ef 100644
--- a/Libraries/Makefile
+++ b/Libraries/Makefile
@@ -1,3 +1,3 @@
-SUBDIRS := $(wildcard */.)
+SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir
diff --git a/MenuApplets/Makefile b/MenuApplets/Makefile
index 6a7b80e89528..0025ae2061ef 100644
--- a/MenuApplets/Makefile
+++ b/MenuApplets/Makefile
@@ -1,3 +1,3 @@
-SUBDIRS := $(wildcard */.)
+SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir
diff --git a/Servers/Makefile b/Servers/Makefile
index 6a7b80e89528..0025ae2061ef 100644
--- a/Servers/Makefile
+++ b/Servers/Makefile
@@ -1,3 +1,3 @@
-SUBDIRS := $(wildcard */.)
+SUBDIRS := $(patsubst %/Makefile,%/,$(wildcard */Makefile))
include ../Makefile.subdir
|
3941e4fe246d138d3e8164331f6c9285236988d2
|
2021-10-28 03:53:30
|
Jelle Raaijmakers
|
ports: Prevent exporting symbols for ScummVM
| false
|
Prevent exporting symbols for ScummVM
|
ports
|
diff --git a/Ports/scummvm/package.sh b/Ports/scummvm/package.sh
index dce2b079eb09..c50d3b8e0585 100755
--- a/Ports/scummvm/package.sh
+++ b/Ports/scummvm/package.sh
@@ -17,5 +17,14 @@ launcher_category=Games
launcher_command=/usr/local/bin/scummvm
icon_file=icons/scummvm.ico
-export FREETYPE2_CFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/freetype2"
-export SDL_CFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2"
+function pre_configure() {
+ export CPPFLAGS="-fvisibility=hidden"
+ export FREETYPE2_CFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/freetype2"
+ export SDL_CFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2"
+}
+
+function post_configure() {
+ unset CPPFLAGS
+ unset FREETYPE2_CFLAGS
+ unset SDL_CFLAGS
+}
|
a9f6f862e21161cf965c9fe15ae221b239c5d107
|
2020-04-30 12:34:39
|
Andreas Kling
|
windowserver: Fix typo (backgound_color => background_color)
| false
|
Fix typo (backgound_color => background_color)
|
windowserver
|
diff --git a/Servers/WindowServer/ClientConnection.cpp b/Servers/WindowServer/ClientConnection.cpp
index cd272d3a7951..c9517543509a 100644
--- a/Servers/WindowServer/ClientConnection.cpp
+++ b/Servers/WindowServer/ClientConnection.cpp
@@ -326,7 +326,7 @@ void ClientConnection::handle(const Messages::WindowServer::AsyncSetWallpaper& m
OwnPtr<Messages::WindowServer::SetBackgroundColorResponse> ClientConnection::handle(const Messages::WindowServer::SetBackgroundColor& message)
{
- Compositor::the().set_backgound_color(message.background_color());
+ Compositor::the().set_background_color(message.background_color());
return make<Messages::WindowServer::SetBackgroundColorResponse>();
}
diff --git a/Servers/WindowServer/Compositor.cpp b/Servers/WindowServer/Compositor.cpp
index b06cc9080e86..57f87178df6c 100644
--- a/Servers/WindowServer/Compositor.cpp
+++ b/Servers/WindowServer/Compositor.cpp
@@ -317,7 +317,7 @@ void Compositor::invalidate(const Gfx::Rect& a_rect)
}
}
-bool Compositor::set_backgound_color(const String& background_color)
+bool Compositor::set_background_color(const String& background_color)
{
auto& wm = WindowManager::the();
wm.wm_config()->write_entry("Background", "Color", background_color);
diff --git a/Servers/WindowServer/Compositor.h b/Servers/WindowServer/Compositor.h
index fa862764053f..99778d786c60 100644
--- a/Servers/WindowServer/Compositor.h
+++ b/Servers/WindowServer/Compositor.h
@@ -56,7 +56,7 @@ class Compositor final : public Core::Object {
bool set_resolution(int desired_width, int desired_height);
- bool set_backgound_color(const String& background_color);
+ bool set_background_color(const String& background_color);
bool set_wallpaper_mode(const String& mode);
diff --git a/Servers/WindowServer/WindowManager.cpp b/Servers/WindowServer/WindowManager.cpp
index 9b3ffdcbec56..309ac50deb28 100644
--- a/Servers/WindowServer/WindowManager.cpp
+++ b/Servers/WindowServer/WindowManager.cpp
@@ -1284,7 +1284,7 @@ bool WindowManager::update_theme(String theme_path, String theme_name)
ASSERT(new_theme);
Gfx::set_system_theme(*new_theme);
m_palette = Gfx::PaletteImpl::create_with_shared_buffer(*new_theme);
- Compositor::the().set_backgound_color(palette().desktop_background().to_string());
+ Compositor::the().set_background_color(palette().desktop_background().to_string());
HashTable<ClientConnection*> notified_clients;
for_each_window([&](Window& window) {
if (window.client()) {
|
ef6133337e76b4ffb4a4ca96e0c3a04bedc431f3
|
2023-08-21 00:34:42
|
Liav A
|
kernel: Merge PowerStateSwitchTask reboot and shutdown procedures
| false
|
Merge PowerStateSwitchTask reboot and shutdown procedures
|
kernel
|
diff --git a/Kernel/Tasks/PowerStateSwitchTask.cpp b/Kernel/Tasks/PowerStateSwitchTask.cpp
index 687f35f1b300..4fed1b46326c 100644
--- a/Kernel/Tasks/PowerStateSwitchTask.cpp
+++ b/Kernel/Tasks/PowerStateSwitchTask.cpp
@@ -35,10 +35,10 @@ void PowerStateSwitchTask::power_state_switch_task(void* raw_entry_data)
auto entry_data = bit_cast<PowerStateCommand>(raw_entry_data);
switch (entry_data) {
case PowerStateCommand::Shutdown:
- MUST(PowerStateSwitchTask::perform_shutdown());
+ MUST(PowerStateSwitchTask::perform_shutdown(DoReboot::No));
break;
case PowerStateCommand::Reboot:
- MUST(PowerStateSwitchTask::perform_reboot());
+ MUST(PowerStateSwitchTask::perform_shutdown(DoReboot::Yes));
break;
default:
PANIC("Unknown power state command: {}", to_underlying(entry_data));
@@ -57,24 +57,7 @@ void PowerStateSwitchTask::spawn(PowerStateCommand command)
g_power_state_switch_task = move(power_state_switch_task_thread);
}
-ErrorOr<void> PowerStateSwitchTask::perform_reboot()
-{
- dbgln("acquiring FS locks...");
- FileSystem::lock_all();
- dbgln("syncing mounted filesystems...");
- FileSystem::sync();
-
- dbgln("attempting reboot via ACPI");
- if (ACPI::is_enabled())
- ACPI::Parser::the()->try_acpi_reboot();
- arch_specific_reboot();
-
- dbgln("reboot attempts failed, applications will stop responding.");
- dmesgln("Reboot can't be completed. It's safe to turn off the computer!");
- Processor::halt();
-}
-
-ErrorOr<void> PowerStateSwitchTask::perform_shutdown()
+ErrorOr<void> PowerStateSwitchTask::perform_shutdown(PowerStateSwitchTask::DoReboot do_reboot)
{
// We assume that by this point userland has tried as much as possible to shut down everything in an orderly fashion.
// Therefore, we force kill remaining processes, including Kernel processes, except the finalizer and ourselves.
@@ -146,13 +129,25 @@ ErrorOr<void> PowerStateSwitchTask::perform_shutdown()
// Therefore, we just lock the scheduler big lock to ensure nothing happens
// beyond this point forward.
SpinlockLocker lock(g_scheduler_lock);
- dbgln("Attempting system shutdown...");
- arch_specific_poweroff();
+ if (do_reboot == DoReboot::Yes) {
+ dbgln("Attempting system reboot...");
+ dbgln("attempting reboot via ACPI");
+ if (ACPI::is_enabled())
+ ACPI::Parser::the()->try_acpi_reboot();
+ arch_specific_reboot();
- dbgln("shutdown attempts failed, applications will stop responding.");
+ dmesgln("Reboot can't be completed. It's safe to turn off the computer!");
+ Processor::halt();
+ VERIFY_NOT_REACHED();
+ }
+ VERIFY(do_reboot == DoReboot::No);
+
+ dbgln("Attempting system shutdown...");
+ arch_specific_poweroff();
dmesgln("Shutdown can't be completed. It's safe to turn off the computer!");
Processor::halt();
+ VERIFY_NOT_REACHED();
}
ErrorOr<void> PowerStateSwitchTask::kill_all_user_processes()
diff --git a/Kernel/Tasks/PowerStateSwitchTask.h b/Kernel/Tasks/PowerStateSwitchTask.h
index 1c87226001c5..834bfac0b02a 100644
--- a/Kernel/Tasks/PowerStateSwitchTask.h
+++ b/Kernel/Tasks/PowerStateSwitchTask.h
@@ -29,10 +29,13 @@ class PowerStateSwitchTask {
static void spawn(PowerStateCommand);
static void power_state_switch_task(void* raw_entry_data);
- static ErrorOr<void> perform_reboot();
- static ErrorOr<void> perform_shutdown();
static ErrorOr<void> kill_all_user_processes();
+ enum class DoReboot {
+ No,
+ Yes,
+ };
+ static ErrorOr<void> perform_shutdown(DoReboot);
};
}
|
721b280849fe983cb2b68fded899141efb00fb23
|
2023-01-28 05:57:07
|
Nico Weber
|
libgfx: Move ICCProfile.{h,cpp} to ICC/Profile.{h,cpp}
| false
|
Move ICCProfile.{h,cpp} to ICC/Profile.{h,cpp}
|
libgfx
|
diff --git a/Meta/Lagom/Fuzzers/FuzzICCProfile.cpp b/Meta/Lagom/Fuzzers/FuzzICCProfile.cpp
index 3c6fd041a961..6e172b6760d3 100644
--- a/Meta/Lagom/Fuzzers/FuzzICCProfile.cpp
+++ b/Meta/Lagom/Fuzzers/FuzzICCProfile.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-#include <LibGfx/ICCProfile.h>
+#include <LibGfx/ICC/Profile.h>
#include <stddef.h>
#include <stdint.h>
diff --git a/Userland/Libraries/LibGfx/CMakeLists.txt b/Userland/Libraries/LibGfx/CMakeLists.txt
index be1f67190d84..041c3f4168de 100644
--- a/Userland/Libraries/LibGfx/CMakeLists.txt
+++ b/Userland/Libraries/LibGfx/CMakeLists.txt
@@ -28,7 +28,7 @@ set(SOURCES
Font/WOFF/Font.cpp
GradientPainting.cpp
GIFLoader.cpp
- ICCProfile.cpp
+ ICC/Profile.cpp
ICOLoader.cpp
ImageDecoder.cpp
JPGLoader.cpp
diff --git a/Userland/Libraries/LibGfx/ICCProfile.cpp b/Userland/Libraries/LibGfx/ICC/Profile.cpp
similarity index 99%
rename from Userland/Libraries/LibGfx/ICCProfile.cpp
rename to Userland/Libraries/LibGfx/ICC/Profile.cpp
index a8c6b40fb72b..ca45e0fa217b 100644
--- a/Userland/Libraries/LibGfx/ICCProfile.cpp
+++ b/Userland/Libraries/LibGfx/ICC/Profile.cpp
@@ -5,7 +5,7 @@
*/
#include <AK/Endian.h>
-#include <LibGfx/ICCProfile.h>
+#include <LibGfx/ICC/Profile.h>
#include <LibTextCodec/Decoder.h>
#include <math.h>
#include <time.h>
diff --git a/Userland/Libraries/LibGfx/ICCProfile.h b/Userland/Libraries/LibGfx/ICC/Profile.h
similarity index 100%
rename from Userland/Libraries/LibGfx/ICCProfile.h
rename to Userland/Libraries/LibGfx/ICC/Profile.h
diff --git a/Userland/Utilities/icc.cpp b/Userland/Utilities/icc.cpp
index 159ed6bb398f..35ca614f3907 100644
--- a/Userland/Utilities/icc.cpp
+++ b/Userland/Utilities/icc.cpp
@@ -9,7 +9,7 @@
#include <LibCore/ArgsParser.h>
#include <LibCore/DateTime.h>
#include <LibCore/MappedFile.h>
-#include <LibGfx/ICCProfile.h>
+#include <LibGfx/ICC/Profile.h>
#include <LibGfx/ImageDecoder.h>
template<class T>
|
2a66878148842f06a2d88ffecfcea863596c14d5
|
2020-02-10 18:34:27
|
William McPherson
|
piano: Ensure WaveWidget paints in-bounds
| false
|
Ensure WaveWidget paints in-bounds
|
piano
|
diff --git a/Applications/Piano/WaveWidget.cpp b/Applications/Piano/WaveWidget.cpp
index bd2430099ee0..41659ce0e22d 100644
--- a/Applications/Piano/WaveWidget.cpp
+++ b/Applications/Piano/WaveWidget.cpp
@@ -47,8 +47,8 @@ int WaveWidget::sample_to_y(int sample) const
{
constexpr double sample_max = std::numeric_limits<i16>::max();
double percentage = sample / sample_max;
- double portion_of_height = percentage * frame_inner_rect().height();
- int y = (frame_inner_rect().height() / 2) + portion_of_height;
+ double portion_of_half_height = percentage * ((frame_inner_rect().height() - 1) / 2.0);
+ double y = (frame_inner_rect().height() / 2.0) + portion_of_half_height;
return y;
}
|
021c8dea1fc339c43d2b937978892c8cfffb8e37
|
2020-11-07 14:33:58
|
Linus Groh
|
libjs: Skip trailing empty values in IndexedPropertyIterator
| false
|
Skip trailing empty values in IndexedPropertyIterator
|
libjs
|
diff --git a/Libraries/LibJS/Runtime/IndexedProperties.cpp b/Libraries/LibJS/Runtime/IndexedProperties.cpp
index 83a79b9be80e..146296287c61 100644
--- a/Libraries/LibJS/Runtime/IndexedProperties.cpp
+++ b/Libraries/LibJS/Runtime/IndexedProperties.cpp
@@ -264,16 +264,13 @@ ValueAndAttributes IndexedPropertyIterator::value_and_attributes(Object* this_ob
void IndexedPropertyIterator::skip_empty_indices()
{
auto indices = m_indexed_properties.indices();
- if (indices.is_empty()) {
- m_index = m_indexed_properties.array_like_size();
- return;
- }
for (auto i : indices) {
if (i < m_index)
continue;
m_index = i;
- break;
+ return;
}
+ m_index = m_indexed_properties.array_like_size();
}
Optional<ValueAndAttributes> IndexedProperties::get(Object* this_object, u32 index, bool evaluate_accessors) const
|
e0def9d7453a6cb14d993a18ba7a44b210928084
|
2024-11-25 03:58:23
|
Andreas Kling
|
tests: Import WPT importKey tests for Ed25519 and X25519
| false
|
Import WPT importKey tests for Ed25519 and X25519
|
tests
|
diff --git a/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/import_export/okp_importKey_Ed25519.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/import_export/okp_importKey_Ed25519.https.any.txt
new file mode 100644
index 000000000000..0318f2efb5dc
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/import_export/okp_importKey_Ed25519.https.any.txt
@@ -0,0 +1,72 @@
+Summary
+
+Harness status: OK
+
+Rerun
+
+Found 62 tests
+
+62 Fail
+Details
+Result Test Name MessageFail Good parameters: Ed25519 bits (spki, buffer(44), {name: Ed25519}, true, [verify])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), Ed25519, true, [verify])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), {name: Ed25519}, true, [verify])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), Ed25519, true, [verify])
+Fail Good parameters with ignored JWK alg: Ed25519 (jwk, object(kty, crv, x), {name: Ed25519}, true, [verify])
+Fail Good parameters with ignored JWK alg: Ed25519 (jwk, object(kty, crv, x), Ed25519, true, [verify])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), {name: Ed25519}, true, [verify])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), Ed25519, true, [verify])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), {name: Ed25519}, true, [])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), Ed25519, true, [])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), {name: Ed25519}, true, [])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), Ed25519, true, [])
+Fail Good parameters with ignored JWK alg: Ed25519 (jwk, object(kty, crv, x), {name: Ed25519}, true, [])
+Fail Good parameters with ignored JWK alg: Ed25519 (jwk, object(kty, crv, x), Ed25519, true, [])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), {name: Ed25519}, true, [])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), Ed25519, true, [])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), {name: Ed25519}, true, [verify, verify])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), Ed25519, true, [verify, verify])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), {name: Ed25519}, true, [verify, verify])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), Ed25519, true, [verify, verify])
+Fail Good parameters with ignored JWK alg: Ed25519 (jwk, object(kty, crv, x), {name: Ed25519}, true, [verify, verify])
+Fail Good parameters with ignored JWK alg: Ed25519 (jwk, object(kty, crv, x), Ed25519, true, [verify, verify])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), {name: Ed25519}, true, [verify, verify])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), Ed25519, true, [verify, verify])
+Fail Good parameters: Ed25519 bits (pkcs8, buffer(48), {name: Ed25519}, true, [sign])
+Fail Good parameters: Ed25519 bits (pkcs8, buffer(48), Ed25519, true, [sign])
+Fail Good parameters: Ed25519 bits (jwk, object(crv, d, x, kty), {name: Ed25519}, true, [sign])
+Fail Good parameters: Ed25519 bits (jwk, object(crv, d, x, kty), Ed25519, true, [sign])
+Fail Good parameters with ignored JWK alg: Ed25519 (jwk, object(crv, d, x, kty), {name: Ed25519}, true, [sign])
+Fail Good parameters with ignored JWK alg: Ed25519 (jwk, object(crv, d, x, kty), Ed25519, true, [sign])
+Fail Good parameters: Ed25519 bits (pkcs8, buffer(48), {name: Ed25519}, true, [sign, sign])
+Fail Good parameters: Ed25519 bits (pkcs8, buffer(48), Ed25519, true, [sign, sign])
+Fail Good parameters: Ed25519 bits (jwk, object(crv, d, x, kty), {name: Ed25519}, true, [sign, sign])
+Fail Good parameters: Ed25519 bits (jwk, object(crv, d, x, kty), Ed25519, true, [sign, sign])
+Fail Good parameters with ignored JWK alg: Ed25519 (jwk, object(crv, d, x, kty), {name: Ed25519}, true, [sign, sign])
+Fail Good parameters with ignored JWK alg: Ed25519 (jwk, object(crv, d, x, kty), Ed25519, true, [sign, sign])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), {name: Ed25519}, false, [verify])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), Ed25519, false, [verify])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), {name: Ed25519}, false, [verify])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), Ed25519, false, [verify])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), {name: Ed25519}, false, [verify])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), Ed25519, false, [verify])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), {name: Ed25519}, false, [])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), Ed25519, false, [])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), {name: Ed25519}, false, [])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), Ed25519, false, [])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), {name: Ed25519}, false, [])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), Ed25519, false, [])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), {name: Ed25519}, false, [verify, verify])
+Fail Good parameters: Ed25519 bits (spki, buffer(44), Ed25519, false, [verify, verify])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), {name: Ed25519}, false, [verify, verify])
+Fail Good parameters: Ed25519 bits (jwk, object(kty, crv, x), Ed25519, false, [verify, verify])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), {name: Ed25519}, false, [verify, verify])
+Fail Good parameters: Ed25519 bits (raw, buffer(32), Ed25519, false, [verify, verify])
+Fail Good parameters: Ed25519 bits (pkcs8, buffer(48), {name: Ed25519}, false, [sign])
+Fail Good parameters: Ed25519 bits (pkcs8, buffer(48), Ed25519, false, [sign])
+Fail Good parameters: Ed25519 bits (jwk, object(crv, d, x, kty), {name: Ed25519}, false, [sign])
+Fail Good parameters: Ed25519 bits (jwk, object(crv, d, x, kty), Ed25519, false, [sign])
+Fail Good parameters: Ed25519 bits (pkcs8, buffer(48), {name: Ed25519}, false, [sign, sign])
+Fail Good parameters: Ed25519 bits (pkcs8, buffer(48), Ed25519, false, [sign, sign])
+Fail Good parameters: Ed25519 bits (jwk, object(crv, d, x, kty), {name: Ed25519}, false, [sign, sign])
+Fail Good parameters: Ed25519 bits (jwk, object(crv, d, x, kty), Ed25519, false, [sign, sign])
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.txt
new file mode 100644
index 000000000000..78aa51030c25
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.txt
@@ -0,0 +1,269 @@
+Summary
+
+Harness status: OK
+
+Rerun
+
+Found 258 tests
+
+10 Pass
+248 Fail
+Details
+Result Test Name MessageFail Bad usages: importKey(spki, {name: Ed25519}, true, [encrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [encrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, encrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, encrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, verify, encrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, verify, encrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [decrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [decrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, decrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, decrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, verify, decrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, verify, decrypt])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [sign])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [sign])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, sign])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, sign])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, verify, sign])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, verify, sign])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [wrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [wrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, wrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, wrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, verify, wrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, verify, wrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [unwrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [unwrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, unwrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, unwrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, verify, unwrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, verify, unwrapKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [deriveKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [deriveKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, deriveKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, deriveKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, verify, deriveKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, verify, deriveKey])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [deriveBits])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [deriveBits])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, deriveBits])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, deriveBits])
+Fail Bad usages: importKey(spki, {name: Ed25519}, true, [verify, verify, deriveBits])
+Fail Bad usages: importKey(spki, {name: Ed25519}, false, [verify, verify, deriveBits])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [encrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [encrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, encrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, encrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, sign, encrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, sign, encrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [decrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [decrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, decrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, decrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, sign, decrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, sign, decrypt])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [verify])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [verify])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, verify])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, verify])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, sign, verify])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, sign, verify])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [wrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [wrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, wrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, wrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, sign, wrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, sign, wrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [unwrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [unwrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, unwrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, unwrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, sign, unwrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, sign, unwrapKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [deriveKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [deriveKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, deriveKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, deriveKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, sign, deriveKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, sign, deriveKey])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [deriveBits])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [deriveBits])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, deriveBits])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, deriveBits])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, true, [sign, sign, deriveBits])
+Fail Bad usages: importKey(pkcs8, {name: Ed25519}, false, [sign, sign, deriveBits])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [encrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [encrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, encrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, encrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, verify, encrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, verify, encrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [decrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [decrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, decrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, decrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, verify, decrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, verify, decrypt])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [sign])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [sign])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, sign])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, sign])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, verify, sign])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, verify, sign])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [wrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [wrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, wrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, wrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, verify, wrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, verify, wrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [unwrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [unwrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, unwrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, unwrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, verify, unwrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, verify, unwrapKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [deriveKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [deriveKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, deriveKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, deriveKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, verify, deriveKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, verify, deriveKey])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [deriveBits])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [deriveBits])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, deriveBits])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, deriveBits])
+Fail Bad usages: importKey(raw, {name: Ed25519}, true, [verify, verify, deriveBits])
+Fail Bad usages: importKey(raw, {name: Ed25519}, false, [verify, verify, deriveBits])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [encrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [encrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, encrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, encrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, sign, encrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, sign, encrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [decrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [decrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, decrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, decrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, sign, decrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, sign, decrypt])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [verify])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [verify])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, verify])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, verify])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, sign, verify])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, sign, verify])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [wrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [wrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, wrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, wrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, sign, wrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, sign, wrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [unwrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [unwrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, unwrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, unwrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, sign, unwrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, sign, unwrapKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [deriveKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [deriveKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, deriveKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, deriveKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, sign, deriveKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, sign, deriveKey])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [deriveBits])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [deriveBits])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, deriveBits])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, deriveBits])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, true, [sign, sign, deriveBits])
+Fail Bad usages: importKey(jwk(private), {name: Ed25519}, false, [sign, sign, deriveBits])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [encrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [encrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, encrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, encrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, verify, encrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, verify, encrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [decrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [decrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, decrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, decrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, verify, decrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, verify, decrypt])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [sign])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [sign])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, sign])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, sign])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, verify, sign])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, verify, sign])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [wrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [wrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, wrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, wrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, verify, wrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, verify, wrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [unwrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [unwrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, unwrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, unwrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, verify, unwrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, verify, unwrapKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [deriveKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [deriveKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, deriveKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, deriveKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, verify, deriveKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, verify, deriveKey])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [deriveBits])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [deriveBits])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, deriveBits])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, deriveBits])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, true, [verify, verify, deriveBits])
+Fail Bad usages: importKey(jwk (public) , {name: Ed25519}, false, [verify, verify, deriveBits])
+Fail Empty usages: importKey(pkcs8, {name: Ed25519}, true, [])
+Fail Empty usages: importKey(pkcs8, {name: Ed25519}, false, [])
+Fail Empty usages: importKey(jwk(private), {name: Ed25519}, true, [])
+Fail Empty usages: importKey(jwk(private), {name: Ed25519}, false, [])
+Fail Bad key length: importKey(spki, {name: Ed25519}, true, [verify])
+Fail Bad key length: importKey(spki, {name: Ed25519}, false, [verify])
+Fail Bad key length: importKey(spki, {name: Ed25519}, true, [verify, verify])
+Fail Bad key length: importKey(spki, {name: Ed25519}, false, [verify, verify])
+Fail Bad key length: importKey(pkcs8, {name: Ed25519}, true, [sign])
+Fail Bad key length: importKey(pkcs8, {name: Ed25519}, false, [sign])
+Fail Bad key length: importKey(pkcs8, {name: Ed25519}, true, [sign, sign])
+Fail Bad key length: importKey(pkcs8, {name: Ed25519}, false, [sign, sign])
+Fail Bad key length: importKey(raw, {name: Ed25519}, true, [verify])
+Fail Bad key length: importKey(raw, {name: Ed25519}, false, [verify])
+Fail Bad key length: importKey(raw, {name: Ed25519}, true, [verify, verify])
+Fail Bad key length: importKey(raw, {name: Ed25519}, false, [verify, verify])
+Fail Bad key length: importKey(jwk(private), {name: Ed25519}, true, [sign])
+Fail Bad key length: importKey(jwk(private), {name: Ed25519}, false, [sign])
+Fail Bad key length: importKey(jwk(private), {name: Ed25519}, true, [sign, sign])
+Fail Bad key length: importKey(jwk(private), {name: Ed25519}, false, [sign, sign])
+Fail Bad key length: importKey(jwk (public) , {name: Ed25519}, true, [verify])
+Fail Bad key length: importKey(jwk (public) , {name: Ed25519}, false, [verify])
+Fail Bad key length: importKey(jwk (public) , {name: Ed25519}, true, [verify, verify])
+Fail Bad key length: importKey(jwk (public) , {name: Ed25519}, false, [verify, verify])
+Fail Missing JWK 'x' parameter: importKey(jwk(private), {name: Ed25519}, true, [sign])
+Fail Missing JWK 'x' parameter: importKey(jwk(private), {name: Ed25519}, false, [sign])
+Fail Missing JWK 'x' parameter: importKey(jwk(private), {name: Ed25519}, true, [sign, sign])
+Fail Missing JWK 'x' parameter: importKey(jwk(private), {name: Ed25519}, false, [sign, sign])
+Fail Missing JWK 'kty' parameter: importKey(jwk(private), {name: Ed25519}, true, [sign])
+Fail Missing JWK 'kty' parameter: importKey(jwk(private), {name: Ed25519}, false, [sign])
+Fail Missing JWK 'kty' parameter: importKey(jwk(private), {name: Ed25519}, true, [sign, sign])
+Fail Missing JWK 'kty' parameter: importKey(jwk(private), {name: Ed25519}, false, [sign, sign])
+Fail Missing JWK 'crv' parameter: importKey(jwk (public) , {name: Ed25519}, true, [verify])
+Fail Missing JWK 'crv' parameter: importKey(jwk (public) , {name: Ed25519}, false, [verify])
+Fail Missing JWK 'crv' parameter: importKey(jwk (public) , {name: Ed25519}, true, [verify, verify])
+Fail Missing JWK 'crv' parameter: importKey(jwk (public) , {name: Ed25519}, false, [verify, verify])
+Fail Invalid key pair: importKey(jwk(private), {name: Ed25519}, true, [sign])
+Fail Invalid key pair: importKey(jwk(private), {name: Ed25519}, true, [sign, sign])
+Pass Missing algorithm name: importKey(spki, {}, true, verify)
+Pass Missing algorithm name: importKey(spki, {}, false, verify)
+Pass Missing algorithm name: importKey(pkcs8, {}, true, sign)
+Pass Missing algorithm name: importKey(pkcs8, {}, false, sign)
+Pass Missing algorithm name: importKey(raw, {}, true, verify)
+Pass Missing algorithm name: importKey(raw, {}, false, verify)
+Pass Missing algorithm name: importKey(jwk(private), {}, true, sign)
+Pass Missing algorithm name: importKey(jwk(private), {}, false, sign)
+Pass Missing algorithm name: importKey(jwk (public) , {}, true, verify)
+Pass Missing algorithm name: importKey(jwk (public) , {}, false, verify)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/importKey_failures.js b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/importKey_failures.js
new file mode 100644
index 000000000000..077ae076c648
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/importKey_failures.js
@@ -0,0 +1,210 @@
+function run_test(algorithmNames) {
+ var subtle = crypto.subtle; // Change to test prefixed implementations
+
+ setup({explicit_timeout: true});
+
+// These tests check that importKey and exportKey throw an error, and that
+// the error is of the right type, for a wide set of incorrect parameters.
+
+// Error testing occurs by setting the parameter that should trigger the
+// error to an invalid value, then combining that with all valid
+// parameters that should be checked earlier by importKey, and all
+// valid and invalid parameters that should be checked later by
+// importKey.
+//
+// There are a lot of combinations of possible parameters for both
+// success and failure modes, resulting in a very large number of tests
+// performed.
+
+
+ var allTestVectors = [ // Parameters that should work for importKey / exportKey
+ {name: "Ed25519", privateUsages: ["sign"], publicUsages: ["verify"]},
+ {name: "Ed448", privateUsages: ["sign"], publicUsages: ["verify"]},
+ {name: "ECDSA", privateUsages: ["sign"], publicUsages: ["verify"]},
+ {name: "X25519", privateUsages: ["deriveKey", "deriveBits"], publicUsages: []},
+ {name: "X448", privateUsages: ["deriveKey", "deriveBits"], publicUsages: []},
+ {name: "ECDH", privateUsages: ["deriveKey", "deriveBits"], publicUsages: []}
+ ];
+
+ var testVectors = [];
+ if (algorithmNames && !Array.isArray(algorithmNames)) {
+ algorithmNames = [algorithmNames];
+ };
+ allTestVectors.forEach(function(vector) {
+ if (!algorithmNames || algorithmNames.includes(vector.name)) {
+ testVectors.push(vector);
+ }
+ });
+
+ function parameterString(format, algorithm, extractable, usages, data) {
+ if (typeof algorithm !== "object" && typeof algorithm !== "string") {
+ alert(algorithm);
+ }
+
+ var jwk_label = "";
+ if (format === "jwk")
+ jwk_label = data.d === undefined ? " (public) " : "(private)";
+
+ var result = "(" +
+ objectToString(format) + jwk_label + ", " +
+ objectToString(algorithm) + ", " +
+ objectToString(extractable) + ", " +
+ objectToString(usages) +
+ ")";
+
+ return result;
+ }
+
+ // Test that a given combination of parameters results in an error,
+ // AND that it is the correct kind of error.
+ //
+ // Expected error is either a number, tested against the error code,
+ // or a string, tested against the error name.
+ function testError(format, algorithm, keyData, keySize, usages, extractable, expectedError, testTag) {
+ promise_test(async() => {
+ let key;
+ try {
+ key = await subtle.importKey(format, keyData, algorithm, extractable, usages);
+ } catch(err) {
+ let actualError = typeof expectedError === "number" ? err.code : err.name;
+ assert_equals(actualError, expectedError, testTag + " not supported.");
+ }
+ assert_equals(key, undefined, "Operation succeeded, but should not have.");
+ }, testTag + ": importKey" + parameterString(format, algorithm, extractable, usages, keyData));
+ }
+
+ // Don't create an exhaustive list of all invalid usages,
+ // because there would usually be nearly 2**8 of them,
+ // way too many to test. Instead, create every singleton
+ // of an illegal usage, and "poison" every valid usage
+ // with an illegal one.
+ function invalidUsages(validUsages, mandatoryUsages) {
+ var results = [];
+
+ var illegalUsages = [];
+ ["encrypt", "decrypt", "sign", "verify", "wrapKey", "unwrapKey", "deriveKey", "deriveBits"].forEach(function(usage) {
+ if (!validUsages.includes(usage)) {
+ illegalUsages.push(usage);
+ }
+ });
+
+ var goodUsageCombinations = validUsages.length === 0 ? [] : allValidUsages(validUsages, false, mandatoryUsages);
+
+ illegalUsages.forEach(function(illegalUsage) {
+ results.push([illegalUsage]);
+ goodUsageCombinations.forEach(function(usageCombination) {
+ results.push(usageCombination.concat([illegalUsage]));
+ });
+ });
+
+ return results;
+ }
+
+ function validUsages(usages, format, data) {
+ if (format === 'spki' || format === 'raw') return usages.publicUsages
+ if (format === 'pkcs8') return usages.privateUsages
+ if (format === 'jwk') {
+ if (data === undefined)
+ return [];
+ return data.d === undefined ? usages.publicUsages : usages.privateUsages;
+ }
+ return [];
+ }
+
+ function isPrivateKey(data) {
+ return data.d !== undefined;
+ }
+
+// Now test for properly handling errors
+// - Unsupported algorithm
+// - Bad usages for algorithm
+// - Bad key lengths
+// - Lack of a mandatory format field
+// - Incompatible keys pair
+
+ // Algorithms normalize okay, but usages bad (though not empty).
+ // It shouldn't matter what other extractable is. Should fail
+ // due to SyntaxError
+ testVectors.forEach(function(vector) {
+ var name = vector.name;
+ allAlgorithmSpecifiersFor(name).forEach(function(algorithm) {
+ getValidKeyData(algorithm).forEach(function(test) {
+ invalidUsages(validUsages(vector, test.format, test.data)).forEach(function(usages) {
+ [true, false].forEach(function(extractable) {
+ testError(test.format, algorithm, test.data, name, usages, extractable, "SyntaxError", "Bad usages");
+ });
+ });
+ });
+ });
+ });
+
+ // Algorithms normalize okay, but usages bad (empty).
+ // Should fail due to SyntaxError
+ testVectors.forEach(function(vector) {
+ var name = vector.name;
+ allAlgorithmSpecifiersFor(name).forEach(function(algorithm) {
+ getValidKeyData(algorithm).filter((test) => test.format === 'pkcs8' || (test.format === 'jwk' && isPrivateKey(test.data))).forEach(function(test) {
+ [true, false].forEach(function(extractable) {
+ testError(test.format, algorithm, test.data, name, [/* Empty usages */], extractable, "SyntaxError", "Empty usages");
+ });
+ });
+ });
+ });
+
+ // Algorithms normalize okay, usages ok. The length of the key must throw a DataError exception.
+ testVectors.forEach(function(vector) {
+ var name = vector.name;
+ allAlgorithmSpecifiersFor(name).forEach(function(algorithm) {
+ getBadKeyLengthData(algorithm).forEach(function(test) {
+ allValidUsages(validUsages(vector, test.format, test.data)).forEach(function(usages) {
+ [true, false].forEach(function(extractable) {
+ testError(test.format, algorithm, test.data, name, usages, extractable, "DataError", "Bad key length");
+ });
+ });
+ });
+ });
+ });
+
+ // Algorithms normalize okay, usages ok and valid key. The lack of the mandatory JWK parameter must throw a DataError exception.
+ testVectors.forEach(function(vector) {
+ var name = vector.name;
+ allAlgorithmSpecifiersFor(name).forEach(function(algorithm) {
+ getMissingJWKFieldKeyData(algorithm).forEach(function(test) {
+ allValidUsages(validUsages(vector, 'jwk', test.data)).forEach(function(usages) {
+ [true, false].forEach(function(extractable) {
+ testError('jwk', algorithm, test.data, name, usages, extractable, "DataError", "Missing JWK '" + test.param + "' parameter");
+ });
+ });
+ });
+ });
+ });
+
+ // Algorithms normalize okay, usages ok and valid key. The public key is not compatible with the private key.
+ testVectors.forEach(function(vector) {
+ var name = vector.name;
+ allAlgorithmSpecifiersFor(name).forEach(function(algorithm) {
+ getMismatchedJWKKeyData(algorithm).forEach(function(data) {
+ allValidUsages(vector.privateUsages).forEach(function(usages) {
+ [true].forEach(function(extractable) {
+ testError('jwk', algorithm, data, name, usages, extractable, "DataError", "Invalid key pair");
+ });
+ });
+ });
+ });
+ });
+
+ // Missing mandatory "name" field on algorithm
+ testVectors.forEach(function(vector) {
+ var name = vector.name;
+ // We just need *some* valid keydata, so pick the first available algorithm.
+ var algorithm = allAlgorithmSpecifiersFor(name)[0];
+ getValidKeyData(algorithm).forEach(function(test) {
+ validUsages(vector, test.format, test.data).forEach(function(usages) {
+ [true, false].forEach(function(extractable) {
+ testError(test.format, {}, test.data, name, usages, extractable, "TypeError", "Missing algorithm name");
+ });
+ });
+ });
+ });
+
+}
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey.js b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey.js
new file mode 100644
index 000000000000..0e6a016fe209
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey.js
@@ -0,0 +1,213 @@
+var subtle = crypto.subtle;
+
+function runTests(algorithmName) {
+ var algorithm = {name: algorithmName};
+ var data = keyData[algorithmName];
+ var jwkData = {jwk: {kty: data.jwk.kty, crv: data.jwk.crv, x: data.jwk.x}};
+
+ [true, false].forEach(function(extractable) {
+ // Test public keys first
+ allValidUsages(data.publicUsages, true).forEach(function(usages) {
+ ['spki', 'jwk', 'raw'].forEach(function(format) {
+ if (format === "jwk") { // Not all fields used for public keys
+ testFormat(format, algorithm, jwkData, algorithmName, usages, extractable);
+ // Test for https://github.com/WICG/webcrypto-secure-curves/pull/24
+ if (extractable) {
+ testJwkAlgBehaviours(algorithm, jwkData.jwk, algorithmName, usages);
+ }
+ } else {
+ testFormat(format, algorithm, data, algorithmName, usages, extractable);
+ }
+ });
+
+ });
+
+ // Next, test private keys
+ allValidUsages(data.privateUsages).forEach(function(usages) {
+ ['pkcs8', 'jwk'].forEach(function(format) {
+ testFormat(format, algorithm, data, algorithmName, usages, extractable);
+
+ // Test for https://github.com/WICG/webcrypto-secure-curves/pull/24
+ if (format === "jwk" && extractable) {
+ testJwkAlgBehaviours(algorithm, data.jwk, algorithmName, usages);
+ }
+ });
+ });
+ });
+}
+
+
+// Test importKey with a given key format and other parameters. If
+// extrable is true, export the key and verify that it matches the input.
+function testFormat(format, algorithm, keyData, keySize, usages, extractable) {
+ [algorithm, algorithm.name].forEach((alg) => {
+ promise_test(function(test) {
+ return subtle.importKey(format, keyData[format], alg, extractable, usages).
+ then(function(key) {
+ assert_equals(key.constructor, CryptoKey, "Imported a CryptoKey object");
+ assert_goodCryptoKey(key, algorithm, extractable, usages, (format === 'pkcs8' || (format === 'jwk' && keyData[format].d)) ? 'private' : 'public');
+ if (!extractable) {
+ return;
+ }
+
+ return subtle.exportKey(format, key).
+ then(function(result) {
+ if (format !== "jwk") {
+ assert_true(equalBuffers(keyData[format], result), "Round trip works");
+ } else {
+ assert_true(equalJwk(keyData[format], result), "Round trip works");
+ }
+ }, function(err) {
+ assert_unreached("Threw an unexpected error: " + err.toString());
+ });
+ }, function(err) {
+ assert_unreached("Threw an unexpected error: " + err.toString());
+ });
+ }, "Good parameters: " + keySize.toString() + " bits " + parameterString(format, keyData[format], alg, extractable, usages));
+ });
+}
+
+// Test importKey/exportKey "alg" behaviours, alg is ignored upon import and alg is missing for Ed25519 and Ed448 JWK export
+// https://github.com/WICG/webcrypto-secure-curves/pull/24
+function testJwkAlgBehaviours(algorithm, keyData, crv, usages) {
+ [algorithm, algorithm.name].forEach((alg) => {
+ promise_test(function(test) {
+ return subtle.importKey('jwk', { ...keyData, alg: 'this is ignored' }, alg, true, usages).
+ then(function(key) {
+ assert_equals(key.constructor, CryptoKey, "Imported a CryptoKey object");
+
+ return subtle.exportKey('jwk', key).
+ then(function(result) {
+ assert_equals(Object.keys(result).length, keyData.d ? 6 : 5, "Correct number of JWK members");
+ assert_equals(result.alg, undefined, 'No JWK "alg" member is present');
+ assert_true(equalJwk(keyData, result), "Round trip works");
+ }, function(err) {
+ assert_unreached("Threw an unexpected error: " + err.toString());
+ });
+ }, function(err) {
+ assert_unreached("Threw an unexpected error: " + err.toString());
+ });
+ }, "Good parameters with ignored JWK alg: " + crv.toString() + " " + parameterString('jwk', keyData, alg, true, usages));
+ });
+}
+
+
+
+// Helper methods follow:
+
+// Are two array buffers the same?
+function equalBuffers(a, b) {
+ if (a.byteLength !== b.byteLength) {
+ return false;
+ }
+
+ var aBytes = new Uint8Array(a);
+ var bBytes = new Uint8Array(b);
+
+ for (var i=0; i<a.byteLength; i++) {
+ if (aBytes[i] !== bBytes[i]) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// Are two Jwk objects "the same"? That is, does the object returned include
+// matching values for each property that was expected? It's okay if the
+// returned object has extra methods; they aren't checked.
+function equalJwk(expected, got) {
+ var fields = Object.keys(expected);
+ var fieldName;
+
+ for(var i=0; i<fields.length; i++) {
+ fieldName = fields[i];
+ if (!(fieldName in got)) {
+ return false;
+ }
+ if (expected[fieldName] !== got[fieldName]) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+// Build minimal Jwk objects from raw key data and algorithm specifications
+function jwkData(keyData, algorithm) {
+ var result = {
+ kty: "oct",
+ k: byteArrayToUnpaddedBase64(keyData)
+ };
+
+ if (algorithm.name.substring(0, 3) === "AES") {
+ result.alg = "A" + (8 * keyData.byteLength).toString() + algorithm.name.substring(4);
+ } else if (algorithm.name === "HMAC") {
+ result.alg = "HS" + algorithm.hash.substring(4);
+ }
+ return result;
+}
+
+// Jwk format wants Base 64 without the typical padding at the end.
+function byteArrayToUnpaddedBase64(byteArray){
+ var binaryString = "";
+ for (var i=0; i<byteArray.byteLength; i++){
+ binaryString += String.fromCharCode(byteArray[i]);
+ }
+ var base64String = btoa(binaryString);
+
+ return base64String.replace(/=/g, "");
+}
+
+// Convert method parameters to a string to uniquely name each test
+function parameterString(format, data, algorithm, extractable, usages) {
+ if ("byteLength" in data) {
+ data = "buffer(" + data.byteLength.toString() + ")";
+ } else {
+ data = "object(" + Object.keys(data).join(", ") + ")";
+ }
+ var result = "(" +
+ objectToString(format) + ", " +
+ objectToString(data) + ", " +
+ objectToString(algorithm) + ", " +
+ objectToString(extractable) + ", " +
+ objectToString(usages) +
+ ")";
+
+ return result;
+}
+
+// Character representation of any object we may use as a parameter.
+function objectToString(obj) {
+ var keyValuePairs = [];
+
+ if (Array.isArray(obj)) {
+ return "[" + obj.map(function(elem){return objectToString(elem);}).join(", ") + "]";
+ } else if (typeof obj === "object") {
+ Object.keys(obj).sort().forEach(function(keyName) {
+ keyValuePairs.push(keyName + ": " + objectToString(obj[keyName]));
+ });
+ return "{" + keyValuePairs.join(", ") + "}";
+ } else if (typeof obj === "undefined") {
+ return "undefined";
+ } else {
+ return obj.toString();
+ }
+
+ var keyValuePairs = [];
+
+ Object.keys(obj).sort().forEach(function(keyName) {
+ var value = obj[keyName];
+ if (typeof value === "object") {
+ value = objectToString(value);
+ } else if (typeof value === "array") {
+ value = "[" + value.map(function(elem){return objectToString(elem);}).join(", ") + "]";
+ } else {
+ value = value.toString();
+ }
+
+ keyValuePairs.push(keyName + ": " + value);
+ });
+
+ return "{" + keyValuePairs.join(", ") + "}";
+}
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_Ed25519.https.any.html b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_Ed25519.https.any.html
new file mode 100644
index 000000000000..1a99a4a444d6
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_Ed25519.https.any.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>WebCryptoAPI: importKey() for OKP keys</title>
+<meta name="timeout" content="long">
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../util/helpers.js"></script>
+<script src="okp_importKey_fixtures.js"></script>
+<script src="okp_importKey.js"></script>
+<div id=log></div>
+<script src="../../WebCryptoAPI/import_export/okp_importKey_Ed25519.https.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_Ed25519.https.any.js b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_Ed25519.https.any.js
new file mode 100644
index 000000000000..49656489d425
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_Ed25519.https.any.js
@@ -0,0 +1,9 @@
+// META: title=WebCryptoAPI: importKey() for OKP keys
+// META: timeout=long
+// META: script=../util/helpers.js
+// META: script=okp_importKey_fixtures.js
+// META: script=okp_importKey.js
+
+
+// Test importKey and exportKey for OKP algorithms.
+runTests("Ed25519");
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_X25519.https.any.html b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_X25519.https.any.html
new file mode 100644
index 000000000000..ccac62768597
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_X25519.https.any.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>WebCryptoAPI: importKey() for OKP keys</title>
+<meta name="timeout" content="long">
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../util/helpers.js"></script>
+<script src="okp_importKey_fixtures.js"></script>
+<script src="okp_importKey.js"></script>
+<div id=log></div>
+<script src="../../WebCryptoAPI/import_export/okp_importKey_X25519.https.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_X25519.https.any.js b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_X25519.https.any.js
new file mode 100644
index 000000000000..de1431d6cc24
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_X25519.https.any.js
@@ -0,0 +1,9 @@
+// META: title=WebCryptoAPI: importKey() for OKP keys
+// META: timeout=long
+// META: script=../util/helpers.js
+// META: script=okp_importKey_fixtures.js
+// META: script=okp_importKey.js
+
+
+// Test importKey and exportKey for OKP algorithms.
+runTests("X25519");
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.html b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.html
new file mode 100644
index 000000000000..1a5f21397a24
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>WebCryptoAPI: importKey() for Failures</title>
+<meta name="timeout" content="long">
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../util/helpers.js"></script>
+<script src="okp_importKey_failures_fixtures.js"></script>
+<script src="importKey_failures.js"></script>
+<div id=log></div>
+<script src="../../WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.js b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.js
new file mode 100644
index 000000000000..e07b796df83d
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_Ed25519.https.any.js
@@ -0,0 +1,7 @@
+// META: title=WebCryptoAPI: importKey() for Failures
+// META: timeout=long
+// META: script=../util/helpers.js
+// META: script=okp_importKey_failures_fixtures.js
+// META: script=importKey_failures.js
+
+run_test(["Ed25519"]);
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_X25519.https.any.html b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_X25519.https.any.html
new file mode 100644
index 000000000000..7d1ac84d8041
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_X25519.https.any.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>WebCryptoAPI: importKey() for Failures</title>
+<meta name="timeout" content="long">
+<script>
+self.GLOBAL = {
+ isWindow: function() { return true; },
+ isWorker: function() { return false; },
+ isShadowRealm: function() { return false; },
+};
+</script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../util/helpers.js"></script>
+<script src="okp_importKey_failures_fixtures.js"></script>
+<script src="importKey_failures.js"></script>
+<div id=log></div>
+<script src="../../WebCryptoAPI/import_export/okp_importKey_failures_X25519.https.any.js"></script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_X25519.https.any.js b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_X25519.https.any.js
new file mode 100644
index 000000000000..a0116bee8885
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_X25519.https.any.js
@@ -0,0 +1,8 @@
+// META: title=WebCryptoAPI: importKey() for Failures
+// META: timeout=long
+// META: script=../util/helpers.js
+// META: script=okp_importKey_failures_fixtures.js
+// META: script=importKey_failures.js
+
+
+run_test(["X25519"]);
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_fixtures.js b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_fixtures.js
new file mode 100644
index 000000000000..88f552291cdf
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_failures_fixtures.js
@@ -0,0 +1,414 @@
+// Setup: define the correct behaviors that should be sought, and create
+// helper functions that generate all possible test parameters for
+// different situations.
+function getValidKeyData(algorithm) {
+ return validKeyData[algorithm.name];
+}
+
+function getBadKeyLengthData(algorithm) {
+ return badKeyLengthData[algorithm.name];
+}
+
+function getMissingJWKFieldKeyData(algorithm) {
+ return missingJWKFieldKeyData[algorithm.name];
+}
+
+function getMismatchedJWKKeyData(algorithm) {
+ return mismatchedJWKKeyData[algorithm.name];
+}
+
+var validKeyData = {
+ "Ed25519": [
+ {
+ format: "spki",
+ data: new Uint8Array([48, 42, 48, 5, 6, 3, 43, 101, 112, 3, 33, 0, 216, 225, 137, 99, 216, 9, 212, 135, 217, 84, 154, 204, 174, 198, 116, 46, 126, 235, 162, 77, 138, 13, 59, 20, 183, 227, 202, 234, 6, 137, 61, 204])
+ },
+ {
+ format: "pkcs8",
+ data: new Uint8Array([48, 46, 2, 1, 0, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32, 243, 200, 244, 196, 141, 248, 120, 20, 110, 140, 211, 191, 109, 244, 229, 14, 56, 155, 167, 7, 78, 21, 194, 53, 45, 205, 93, 48, 141, 76, 168, 31])
+ },
+ {
+ format: "raw",
+ data: new Uint8Array([216, 225, 137, 99, 216, 9, 212, 135, 217, 84, 154, 204, 174, 198, 116, 46, 126, 235, 162, 77, 138, 13, 59, 20, 183, 227, 202, 234, 6, 137, 61, 204])
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "Ed25519",
+ d: "88j0xI34eBRujNO_bfTlDjibpwdOFcI1Lc1dMI1MqB8",
+ x: "2OGJY9gJ1IfZVJrMrsZ0Ln7rok2KDTsUt-PK6gaJPcw",
+ kty: "OKP"
+ },
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "Ed25519",
+ x: "2OGJY9gJ1IfZVJrMrsZ0Ln7rok2KDTsUt-PK6gaJPcw",
+ kty: "OKP"
+ },
+ }
+ ],
+ "Ed448": [
+ {
+ format: "spki",
+ data: new Uint8Array([48, 67, 48, 5, 6, 3, 43, 101, 113, 3, 58, 0, 171, 75, 184, 133, 253, 125, 44, 90, 242, 78, 131, 113, 12, 255, 160, 199, 74, 87, 226, 116, 128, 29, 178, 5, 123, 11, 220, 94, 160, 50, 182, 254, 107, 199, 139, 128, 69, 54, 90, 235, 38, 232, 110, 31, 20, 253, 52, 157, 7, 196, 132, 149, 245, 164, 106, 90, 128]),
+ },
+ {
+ format: "pkcs8",
+ data: new Uint8Array([48, 71, 2, 1, 0, 48, 5, 6, 3, 43, 101, 113, 4, 59, 4, 57, 14, 255, 3, 69, 140, 40, 224, 23, 156, 82, 29, 227, 18, 201, 105, 183, 131, 67, 72, 236, 171, 153, 26, 96, 227, 178, 233, 167, 158, 76, 217, 228, 128, 239, 41, 23, 18, 210, 200, 61, 4, 114, 114, 213, 201, 244, 40, 102, 79, 105, 109, 38, 112, 69, 143, 29, 46]),
+ },
+ {
+ format: "raw",
+ data: new Uint8Array([171, 75, 184, 133, 253, 125, 44, 90, 242, 78, 131, 113, 12, 255, 160, 199, 74, 87, 226, 116, 128, 29, 178, 5, 123, 11, 220, 94, 160, 50, 182, 254, 107, 199, 139, 128, 69, 54, 90, 235, 38, 232, 110, 31, 20, 253, 52, 157, 7, 196, 132, 149, 245, 164, 106, 90, 128]),
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "Ed448",
+ d: "Dv8DRYwo4BecUh3jEslpt4NDSOyrmRpg47Lpp55M2eSA7ykXEtLIPQRyctXJ9ChmT2ltJnBFjx0u",
+ x: "q0u4hf19LFryToNxDP-gx0pX4nSAHbIFewvcXqAytv5rx4uARTZa6ybobh8U_TSdB8SElfWkalqA",
+ kty: "OKP"
+ },
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "Ed448",
+ x: "q0u4hf19LFryToNxDP-gx0pX4nSAHbIFewvcXqAytv5rx4uARTZa6ybobh8U_TSdB8SElfWkalqA",
+ kty: "OKP"
+ },
+ },
+ ],
+ "X25519": [
+ {
+ format: "spki",
+ data: new Uint8Array([48, 42, 48, 5, 6, 3, 43, 101, 110, 3, 33, 0, 28, 242, 177, 230, 2, 46, 197, 55, 55, 30, 215, 245, 62, 84, 250, 17, 84, 216, 62, 152, 235, 100, 234, 81, 250, 229, 179, 48, 124, 254, 151, 6]),
+ },
+ {
+ format: "pkcs8",
+ data: new Uint8Array([48, 46, 2, 1, 0, 48, 5, 6, 3, 43, 101, 110, 4, 34, 4, 32, 200, 131, 142, 118, 208, 87, 223, 183, 216, 201, 90, 105, 225, 56, 22, 10, 221, 99, 115, 253, 113, 164, 210, 118, 187, 86, 227, 168, 27, 100, 255, 97]),
+ },
+ {
+ format: "raw",
+ data: new Uint8Array([28, 242, 177, 230, 2, 46, 197, 55, 55, 30, 215, 245, 62, 84, 250, 17, 84, 216, 62, 152, 235, 100, 234, 81, 250, 229, 179, 48, 124, 254, 151, 6]),
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "X25519",
+ d: "yIOOdtBX37fYyVpp4TgWCt1jc_1xpNJ2u1bjqBtk_2E",
+ x: "HPKx5gIuxTc3Htf1PlT6EVTYPpjrZOpR-uWzMHz-lwY",
+ kty: "OKP"
+ },
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "X25519",
+ x: "HPKx5gIuxTc3Htf1PlT6EVTYPpjrZOpR-uWzMHz-lwY",
+ kty: "OKP"
+ },
+ },
+ ],
+ "X448": [
+ {
+ format: "spki",
+ data: new Uint8Array([48, 66, 48, 5, 6, 3, 43, 101, 111, 3, 57, 0, 182, 4, 161, 209, 165, 205, 29, 148, 38, 213, 97, 239, 99, 10, 158, 177, 108, 190, 105, 213, 185, 202, 97, 94, 220, 83, 99, 62, 251, 82, 234, 49, 230, 230, 160, 161, 219, 172, 198, 231, 108, 188, 230, 72, 45, 126, 75, 163, 213, 93, 158, 128, 39, 101, 206, 111]),
+ },
+ {
+ format: "pkcs8",
+ data: new Uint8Array([48, 70, 2, 1, 0, 48, 5, 6, 3, 43, 101, 111, 4, 58, 4, 56, 88, 199, 210, 154, 62, 181, 25, 178, 157, 0, 207, 177, 145, 187, 100, 252, 109, 138, 66, 216, 241, 113, 118, 39, 43, 137, 242, 39, 45, 24, 25, 41, 92, 101, 37, 192, 130, 150, 113, 176, 82, 239, 7, 39, 83, 15, 24, 142, 49, 208, 204, 83, 191, 38, 146, 158]),
+ },
+ {
+ format: "raw",
+ data: new Uint8Array([182, 4, 161, 209, 165, 205, 29, 148, 38, 213, 97, 239, 99, 10, 158, 177, 108, 190, 105, 213, 185, 202, 97, 94, 220, 83, 99, 62, 251, 82, 234, 49, 230, 230, 160, 161, 219, 172, 198, 231, 108, 188, 230, 72, 45, 126, 75, 163, 213, 93, 158, 128, 39, 101, 206, 111]),
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "X448",
+ d: "WMfSmj61GbKdAM-xkbtk_G2KQtjxcXYnK4nyJy0YGSlcZSXAgpZxsFLvBydTDxiOMdDMU78mkp4",
+ x: "tgSh0aXNHZQm1WHvYwqesWy-adW5ymFe3FNjPvtS6jHm5qCh26zG52y85kgtfkuj1V2egCdlzm8",
+ kty: "OKP"
+ },
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "X448",
+ x: "tgSh0aXNHZQm1WHvYwqesWy-adW5ymFe3FNjPvtS6jHm5qCh26zG52y85kgtfkuj1V2egCdlzm8",
+ kty: "OKP"
+ },
+ },
+ ],
+};
+
+// Removed just the last byte.
+var badKeyLengthData = {
+ "Ed25519": [
+ {
+ format: "spki",
+ data: new Uint8Array([48, 42, 48, 5, 6, 3, 43, 101, 112, 3, 33, 0, 216, 225, 137, 99, 216, 9, 212, 135, 217, 84, 154, 204, 174, 198, 116, 46, 126, 235, 162, 77, 138, 13, 59, 20, 183, 227, 202, 234, 6, 137, 61])
+ },
+ {
+ format: "pkcs8",
+ data: new Uint8Array([48, 46, 2, 1, 0, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32, 243, 200, 244, 196, 141, 248, 120, 20, 110, 140, 211, 191, 109, 244, 229, 14, 56, 155, 167, 7, 78, 21, 194, 53, 45, 205, 93, 48, 141, 76, 168])
+ },
+ {
+ format: "raw",
+ data: new Uint8Array([216, 225, 137, 99, 216, 9, 212, 135, 217, 84, 154, 204, 174, 198, 116, 46, 126, 235, 162, 77, 138, 13, 59, 20, 183, 227, 202, 234, 6, 137, 61])
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "Ed25519",
+ d: "88j0xI34eBRujNO_bfTlDjibpwdOFcI1Lc1dMI1MqB",
+ x: "2OGJY9gJ1IfZVJrMrsZ0Ln7rok2KDTsUt-PK6gaJPcw",
+ kty: "OKP"
+ }
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "Ed25519",
+ x: "2OGJY9gJ1IfZVJrMrsZ0Ln7rok2KDTsUt-PK6gaJPc",
+ kty: "OKP"
+ }
+ }
+ ],
+ "Ed448": [
+ {
+ format: "spki",
+ data: new Uint8Array([48, 67, 48, 5, 6, 3, 43, 101, 113, 3, 58, 0, 171, 75, 184, 133, 253, 125, 44, 90, 242, 78, 131, 113, 12, 255, 160, 199, 74, 87, 226, 116, 128, 29, 178, 5, 123, 11, 220, 94, 160, 50, 182, 254, 107, 199, 139, 128, 69, 54, 90, 235, 38, 232, 110, 31, 20, 253, 52, 157, 7, 196, 132, 149, 245, 164, 106, 90]),
+ },
+ {
+ format: "pkcs8",
+ data: new Uint8Array([48, 71, 2, 1, 0, 48, 5, 6, 3, 43, 101, 113, 4, 59, 4, 57, 14, 255, 3, 69, 140, 40, 224, 23, 156, 82, 29, 227, 18, 201, 105, 183, 131, 67, 72, 236, 171, 153, 26, 96, 227, 178, 233, 167, 158, 76, 217, 228, 128, 239, 41, 23, 18, 210, 200, 61, 4, 114, 114, 213, 201, 244, 40, 102, 79, 105, 109, 38, 112, 69, 143, 29]),
+ },
+ {
+ format: "raw",
+ data: new Uint8Array([171, 75, 184, 133, 253, 125, 44, 90, 242, 78, 131, 113, 12, 255, 160, 199, 74, 87, 226, 116, 128, 29, 178, 5, 123, 11, 220, 94, 160, 50, 182, 254, 107, 199, 139, 128, 69, 54, 90, 235, 38, 232, 110, 31, 20, 253, 52, 157, 7, 196, 132, 149, 245, 164, 106, 90]),
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "Ed448",
+ d: "Dv8DRYwo4BecUh3jEslpt4NDSOyrmRpg47Lpp55M2eSA7ykXEtLIPQRyctXJ9ChmT2ltJnBFjx0",
+ x: "q0u4hf19LFryToNxDP-gx0pX4nSAHbIFewvcXqAytv5rx4uARTZa6ybobh8U_TSdB8SElfWkalqA",
+ kty: "OKP"
+ },
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "Ed448",
+ x: "q0u4hf19LFryToNxDP-gx0pX4nSAHbIFewvcXqAytv5rx4uARTZa6ybobh8U_TSdB8SElfWkalq",
+ kty: "OKP"
+ },
+ },
+ ],
+ "X25519": [
+ {
+ format: "spki",
+ data: new Uint8Array([48, 42, 48, 5, 6, 3, 43, 101, 110, 3, 33, 0, 28, 242, 177, 230, 2, 46, 197, 55, 55, 30, 215, 245, 62, 84, 250, 17, 84, 216, 62, 152, 235, 100, 234, 81, 250, 229, 179, 48, 124, 254, 151]),
+ },
+ {
+ format: "pkcs8",
+ data: new Uint8Array([48, 46, 2, 1, 0, 48, 5, 6, 3, 43, 101, 110, 4, 34, 4, 32, 200, 131, 142, 118, 208, 87, 223, 183, 216, 201, 90, 105, 225, 56, 22, 10, 221, 99, 115, 253, 113, 164, 210, 118, 187, 86, 227, 168, 27, 100, 255]),
+ },
+ {
+ format: "raw",
+ data: new Uint8Array([28, 242, 177, 230, 2, 46, 197, 55, 55, 30, 215, 245, 62, 84, 250, 17, 84, 216, 62, 152, 235, 100, 234, 81, 250, 229, 179, 48, 124, 254, 151]),
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "X25519",
+ x: "HPKx5gIuxTc3Htf1PlT6EVTYPpjrZOpR-uWzMHz-lw",
+ kty: "OKP"
+ }
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "X25519",
+ d: "yIOOdtBX37fYyVpp4TgWCt1jc_1xpNJ2u1bjqBtk_2",
+ x: "HPKx5gIuxTc3Htf1PlT6EVTYPpjrZOpR-uWzMHz-lwY",
+ kty: "OKP"
+ },
+ },
+ ],
+ "X448": [
+ {
+ format: "spki",
+ data: new Uint8Array([48, 66, 48, 5, 6, 3, 43, 101, 111, 3, 57, 0, 182, 4, 161, 209, 165, 205, 29, 148, 38, 213, 97, 239, 99, 10, 158, 177, 108, 190, 105, 213, 185, 202, 97, 94, 220, 83, 99, 62, 251, 82, 234, 49, 230, 230, 160, 161, 219, 172, 198, 231, 108, 188, 230, 72, 45, 126, 75, 163, 213, 93, 158, 128, 39, 101, 206]),
+ },
+ {
+ format: "pkcs8",
+ data: new Uint8Array([48, 70, 2, 1, 0, 48, 5, 6, 3, 43, 101, 111, 4, 58, 4, 56, 88, 199, 210, 154, 62, 181, 25, 178, 157, 0, 207, 177, 145, 187, 100, 252, 109, 138, 66, 216, 241, 113, 118, 39, 43, 137, 242, 39, 45, 24, 25, 41, 92, 101, 37, 192, 130, 150, 113, 176, 82, 239, 7, 39, 83, 15, 24, 142, 49, 208, 204, 83, 191, 38, 146]),
+ },
+ {
+ format: "raw",
+ data: new Uint8Array([182, 4, 161, 209, 165, 205, 29, 148, 38, 213, 97, 239, 99, 10, 158, 177, 108, 190, 105, 213, 185, 202, 97, 94, 220, 83, 99, 62, 251, 82, 234, 49, 230, 230, 160, 161, 219, 172, 198, 231, 108, 188, 230, 72, 45, 126, 75, 163, 213, 93, 158, 128, 39, 101, 206]),
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "X448",
+ d: "WMfSmj61GbKdAM-xkbtk_G2KQtjxcXYnK4nyJy0YGSlcZSXAgpZxsFLvBydTDxiOMdDMU78mkp",
+ x: "tgSh0aXNHZQm1WHvYwqesWy-adW5ymFe3FNjPvtS6jHm5qCh26zG52y85kgtfkuj1V2egCdlzm8",
+ kty: "OKP"
+ },
+ },
+ {
+ format: "jwk",
+ data: {
+ crv: "X448",
+ x: "tgSh0aXNHZQm1WHvYwqesWy-adW5ymFe3FNjPvtS6jHm5qCh26zG52y85kgtfkuj1V2egCdlzm",
+ kty: "OKP"
+ },
+ },
+ ],
+};
+
+var missingJWKFieldKeyData = {
+ "Ed25519": [
+ {
+ param: "x",
+ data: {
+ crv: "Ed25519",
+ d: "88j0xI34eBRujNO_bfTlDjibpwdOFcI1Lc1dMI1MqB8",
+ kty: "OKP"
+ },
+ },
+ {
+ param: "kty",
+ data: {
+ crv: "Ed25519",
+ x: "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo",
+ d: "88j0xI34eBRujNO_bfTlDjibpwdOFcI1Lc1dMI1MqB8",
+ },
+ },
+ {
+ param: "crv",
+ data: {
+ x: "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo",
+ kty: "OKP"
+ },
+ }
+ ],
+ "Ed448": [
+ {
+ param: "x",
+ data: {
+ crv: "Ed448",
+ d: "Dv8DRYwo4BecUh3jEslpt4NDSOyrmRpg47Lpp55M2eSA7ykXEtLIPQRyctXJ9ChmT2ltJnBFjx0u",
+ kty: "OKP"
+ }
+ },
+ {
+ param: "kty",
+ data: {
+ crv: "Ed448",
+ d: "Dv8DRYwo4BecUh3jEslpt4NDSOyrmRpg47Lpp55M2eSA7ykXEtLIPQRyctXJ9ChmT2ltJnBFjx0u",
+ x: "q0u4hf19LFryToNxDP-gx0pX4nSAHbIFewvcXqAytv5rx4uARTZa6ybobh8U_TSdB8SElfWkalqA",
+ }
+ },
+ {
+ param: "crv",
+ data: {
+ d: "Dv8DRYwo4BecUh3jEslpt4NDSOyrmRpg47Lpp55M2eSA7ykXEtLIPQRyctXJ9ChmT2ltJnBFjx0u",
+ x: "q0u4hf19LFryToNxDP-gx0pX4nSAHbIFewvcXqAytv5rx4uARTZa6ybobh8U_TSdB8SElfWkalqA",
+ kty: "OKP"
+ }
+ }
+ ],
+ "X25519": [
+ {
+ param: "x",
+ data: {
+ crv: "X25519",
+ d: "yIOOdtBX37fYyVpp4TgWCt1jc_1xpNJ2u1bjqBtk_2E",
+ kty: "OKP"
+ },
+ },
+ {
+ param: "kty",
+ data: {
+ crv: "X25519",
+ d: "yIOOdtBX37fYyVpp4TgWCt1jc_1xpNJ2u1bjqBtk_2E",
+ x: "HPKx5gIuxTc3Htf1PlT6EVTYPpjrZOpR-uWzMHz-lwY",
+ },
+ },
+ {
+ param: "crv",
+ data: {
+ x: "HPKx5gIuxTc3Htf1PlT6EVTYPpjrZOpR-uWzMHz-lwY",
+ kty: "OKP"
+ },
+ }
+ ],
+ "X448": [
+ {
+ param: "x",
+ data: {
+ crv: "X448",
+ d: "WMfSmj61GbKdAM-xkbtk_G2KQtjxcXYnK4nyJy0YGSlcZSXAgpZxsFLvBydTDxiOMdDMU78mkp4",
+ kty: "OKP"
+ }
+ },
+ {
+ param: "kty",
+ data: {
+ crv: "X448",
+ d: "WMfSmj61GbKdAM-xkbtk_G2KQtjxcXYnK4nyJy0YGSlcZSXAgpZxsFLvBydTDxiOMdDMU78mkp4",
+ x: "tgSh0aXNHZQm1WHvYwqesWy-adW5ymFe3FNjPvtS6jHm5qCh26zG52y85kgtfkuj1V2egCdlzm8",
+ }
+ },
+ {
+ param: "crv",
+ data: {
+ x: "tgSh0aXNHZQm1WHvYwqesWy-adW5ymFe3FNjPvtS6jHm5qCh26zG52y85kgtfkuj1V2egCdlzm8",
+ kty: "OKP"
+ }
+ }
+ ],
+};
+
+// The public key doesn't match the private key.
+var mismatchedJWKKeyData = {
+ "Ed25519": [
+ {
+ crv: "Ed25519",
+ d: "88j0xI34eBRujNO_bfTlDjibpwdOFcI1Lc1dMI1MqB8",
+ x: "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo",
+ kty: "OKP"
+ },
+ ],
+ "Ed448": [
+ {
+ crv: "Ed448",
+ d: "Dv8DRYwo4BecUh3jEslpt4NDSOyrmRpg47Lpp55M2eSA7ykXEtLIPQRyctXJ9ChmT2ltJnBFjx0u",
+ x: "X9dEm1m0Yf0s54fsYWrUah2hNCSFpw4fig6nXYDpZ3jt8SR2m0bHBhvWeD3x5Q9s0foavq_oJWGA",
+ kty: "OKP"
+ },
+ ],
+ "X25519": [
+ {
+ crv: "X25519",
+ d: "yIOOdtBX37fYyVpp4TgWCt1jc_1xpNJ2u1bjqBtk_2E",
+ x: "hSDwCYkwp1R0i33ctD73Wg2_Og0mOBr066SpjqqbTmo",
+ kty: "OKP"
+ },
+ ],
+ "X448": [
+ {
+
+ crv: "X448",
+ kty: "OKP",
+ d: "WMfSmj61GbKdAM-xkbtk_G2KQtjxcXYnK4nyJy0YGSlcZSXAgpZxsFLvBydTDxiOMdDMU78mkp4",
+ x: "mwj3zDG34+Z9ItWuoSEHSic70rg94Jxj+qc9LCLF2bvINmRyQdlT1AxbEtqIEg1TF3+A5TLEH6A",
+ },
+ ],
+}
diff --git a/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_fixtures.js b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_fixtures.js
new file mode 100644
index 000000000000..58b41d52601e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/WebCryptoAPI/import_export/okp_importKey_fixtures.js
@@ -0,0 +1,58 @@
+var keyData = {
+ "Ed25519": {
+ privateUsages: ["sign"],
+ publicUsages: ["verify"],
+ spki: new Uint8Array([48, 42, 48, 5, 6, 3, 43, 101, 112, 3, 33, 0, 216, 225, 137, 99, 216, 9, 212, 135, 217, 84, 154, 204, 174, 198, 116, 46, 126, 235, 162, 77, 138, 13, 59, 20, 183, 227, 202, 234, 6, 137, 61, 204]),
+ raw: new Uint8Array([216, 225, 137, 99, 216, 9, 212, 135, 217, 84, 154, 204, 174, 198, 116, 46, 126, 235, 162, 77, 138, 13, 59, 20, 183, 227, 202, 234, 6, 137, 61, 204]),
+ pkcs8: new Uint8Array([48, 46, 2, 1, 0, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32, 243, 200, 244, 196, 141, 248, 120, 20, 110, 140, 211, 191, 109, 244, 229, 14, 56, 155, 167, 7, 78, 21, 194, 53, 45, 205, 93, 48, 141, 76, 168, 31]),
+ jwk: {
+ crv: "Ed25519",
+ d: "88j0xI34eBRujNO_bfTlDjibpwdOFcI1Lc1dMI1MqB8",
+ x: "2OGJY9gJ1IfZVJrMrsZ0Ln7rok2KDTsUt-PK6gaJPcw",
+ kty: "OKP"
+ }
+ },
+
+ "Ed448": {
+ privateUsages: ["sign"],
+ publicUsages: ["verify"],
+ spki: new Uint8Array([48, 67, 48, 5, 6, 3, 43, 101, 113, 3, 58, 0, 171, 75, 184, 133, 253, 125, 44, 90, 242, 78, 131, 113, 12, 255, 160, 199, 74, 87, 226, 116, 128, 29, 178, 5, 123, 11, 220, 94, 160, 50, 182, 254, 107, 199, 139, 128, 69, 54, 90, 235, 38, 232, 110, 31, 20, 253, 52, 157, 7, 196, 132, 149, 245, 164, 106, 90, 128]),
+ raw: new Uint8Array([171, 75, 184, 133, 253, 125, 44, 90, 242, 78, 131, 113, 12, 255, 160, 199, 74, 87, 226, 116, 128, 29, 178, 5, 123, 11, 220, 94, 160, 50, 182, 254, 107, 199, 139, 128, 69, 54, 90, 235, 38, 232, 110, 31, 20, 253, 52, 157, 7, 196, 132, 149, 245, 164, 106, 90, 128]),
+ pkcs8: new Uint8Array([48, 71, 2, 1, 0, 48, 5, 6, 3, 43, 101, 113, 4, 59, 4, 57, 14, 255, 3, 69, 140, 40, 224, 23, 156, 82, 29, 227, 18, 201, 105, 183, 131, 67, 72, 236, 171, 153, 26, 96, 227, 178, 233, 167, 158, 76, 217, 228, 128, 239, 41, 23, 18, 210, 200, 61, 4, 114, 114, 213, 201, 244, 40, 102, 79, 105, 109, 38, 112, 69, 143, 29, 46]),
+ jwk: {
+ crv: "Ed448",
+ d: "Dv8DRYwo4BecUh3jEslpt4NDSOyrmRpg47Lpp55M2eSA7ykXEtLIPQRyctXJ9ChmT2ltJnBFjx0u",
+ x: "q0u4hf19LFryToNxDP-gx0pX4nSAHbIFewvcXqAytv5rx4uARTZa6ybobh8U_TSdB8SElfWkalqA",
+ kty: "OKP"
+ }
+ },
+
+ "X25519": {
+ privateUsages: ["deriveKey", "deriveBits"],
+ publicUsages: [],
+ spki: new Uint8Array([48, 42, 48, 5, 6, 3, 43, 101, 110, 3, 33, 0, 28, 242, 177, 230, 2, 46, 197, 55, 55, 30, 215, 245, 62, 84, 250, 17, 84, 216, 62, 152, 235, 100, 234, 81, 250, 229, 179, 48, 124, 254, 151, 6]),
+ raw: new Uint8Array([28, 242, 177, 230, 2, 46, 197, 55, 55, 30, 215, 245, 62, 84, 250, 17, 84, 216, 62, 152, 235, 100, 234, 81, 250, 229, 179, 48, 124, 254, 151, 6]),
+ pkcs8: new Uint8Array([48, 46, 2, 1, 0, 48, 5, 6, 3, 43, 101, 110, 4, 34, 4, 32, 200, 131, 142, 118, 208, 87, 223, 183, 216, 201, 90, 105, 225, 56, 22, 10, 221, 99, 115, 253, 113, 164, 210, 118, 187, 86, 227, 168, 27, 100, 255, 97]),
+ jwk: {
+ crv: "X25519",
+ d: "yIOOdtBX37fYyVpp4TgWCt1jc_1xpNJ2u1bjqBtk_2E",
+ x: "HPKx5gIuxTc3Htf1PlT6EVTYPpjrZOpR-uWzMHz-lwY",
+ kty: "OKP"
+ }
+ },
+
+ "X448": {
+ privateUsages: ["deriveKey", "deriveBits"],
+ publicUsages: [],
+ spki: new Uint8Array([48, 66, 48, 5, 6, 3, 43, 101, 111, 3, 57, 0, 182, 4, 161, 209, 165, 205, 29, 148, 38, 213, 97, 239, 99, 10, 158, 177, 108, 190, 105, 213, 185, 202, 97, 94, 220, 83, 99, 62, 251, 82, 234, 49, 230, 230, 160, 161, 219, 172, 198, 231, 108, 188, 230, 72, 45, 126, 75, 163, 213, 93, 158, 128, 39, 101, 206, 111]),
+ raw: new Uint8Array([182, 4, 161, 209, 165, 205, 29, 148, 38, 213, 97, 239, 99, 10, 158, 177, 108, 190, 105, 213, 185, 202, 97, 94, 220, 83, 99, 62, 251, 82, 234, 49, 230, 230, 160, 161, 219, 172, 198, 231, 108, 188, 230, 72, 45, 126, 75, 163, 213, 93, 158, 128, 39, 101, 206, 111]),
+ pkcs8: new Uint8Array([48, 70, 2, 1, 0, 48, 5, 6, 3, 43, 101, 111, 4, 58, 4, 56, 88, 199, 210, 154, 62, 181, 25, 178, 157, 0, 207, 177, 145, 187, 100, 252, 109, 138, 66, 216, 241, 113, 118, 39, 43, 137, 242, 39, 45, 24, 25, 41, 92, 101, 37, 192, 130, 150, 113, 176, 82, 239, 7, 39, 83, 15, 24, 142, 49, 208, 204, 83, 191, 38, 146, 158]),
+ jwk: {
+ crv: "X448",
+ d: "WMfSmj61GbKdAM-xkbtk_G2KQtjxcXYnK4nyJy0YGSlcZSXAgpZxsFLvBydTDxiOMdDMU78mkp4",
+ x: "tgSh0aXNHZQm1WHvYwqesWy-adW5ymFe3FNjPvtS6jHm5qCh26zG52y85kgtfkuj1V2egCdlzm8",
+ kty: "OKP"
+ }
+ },
+
+};
|
b1274a885b10a7e698d9d9b3902283699a84135b
|
2023-10-30 23:01:15
|
Timothy Flynn
|
libweb: Return success when a <link> element decodes a valid favicon
| false
|
Return success when a <link> element decodes a valid favicon
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp
index 6a793093aac4..ad0662ee7497 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp
@@ -462,7 +462,7 @@ bool HTMLLinkElement::load_favicon_and_use_if_window_is_active()
navigable()->traversable_navigable()->page()->client().page_did_change_favicon(*favicon_bitmap);
}
- return false;
+ return true;
}
void HTMLLinkElement::visit_edges(Cell::Visitor& visitor)
|
b17fb76ace658a9a8ad3a8399748af3ecf27e7dc
|
2022-03-24 21:23:21
|
Jelle Raaijmakers
|
libgfx: Implement TTF kerning tables
| false
|
Implement TTF kerning tables
|
libgfx
|
diff --git a/Userland/Libraries/LibGfx/BitmapFont.h b/Userland/Libraries/LibGfx/BitmapFont.h
index a38f3612141e..b02222489dbc 100644
--- a/Userland/Libraries/LibGfx/BitmapFont.h
+++ b/Userland/Libraries/LibGfx/BitmapFont.h
@@ -54,6 +54,7 @@ class BitmapFont final : public Font {
return m_glyph_width;
return glyph_or_emoji_width_for_variable_width_font(code_point);
}
+ i32 glyphs_horizontal_kerning(u32, u32) const override { return 0; }
u8 glyph_height() const override { return m_glyph_height; }
int x_height() const override { return m_x_height; }
int preferred_line_height() const override { return glyph_height() + m_line_gap; }
diff --git a/Userland/Libraries/LibGfx/Font.h b/Userland/Libraries/LibGfx/Font.h
index 441e9dbad907..85967645336b 100644
--- a/Userland/Libraries/LibGfx/Font.h
+++ b/Userland/Libraries/LibGfx/Font.h
@@ -114,6 +114,7 @@ class Font : public RefCounted<Font> {
virtual u8 glyph_width(u32 code_point) const = 0;
virtual int glyph_or_emoji_width(u32 code_point) const = 0;
+ virtual i32 glyphs_horizontal_kerning(u32 left_code_point, u32 right_code_point) const = 0;
virtual u8 glyph_height() const = 0;
virtual int x_height() const = 0;
virtual int preferred_line_height() const = 0;
diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp
index 132b2c18ccd1..91e12bd24010 100644
--- a/Userland/Libraries/LibGfx/Painter.cpp
+++ b/Userland/Libraries/LibGfx/Painter.cpp
@@ -1378,12 +1378,19 @@ void draw_text_line(IntRect const& a_rect, Utf8View const& text, Font const& fon
space_width = -space_width; // Draw spaces backwards
}
+ u32 last_code_point { 0 };
for (auto it = text.begin(); it != text.end(); ++it) {
auto code_point = *it;
if (code_point == ' ') {
point.translate_by(space_width, 0);
+ last_code_point = code_point;
continue;
}
+
+ int kerning = font.glyphs_horizontal_kerning(last_code_point, code_point);
+ if (kerning != 0)
+ point.translate_by(direction == TextDirection::LTR ? kerning : -kerning, 0);
+
IntSize glyph_size(font.glyph_or_emoji_width(code_point) + font.glyph_spacing(), font.glyph_height());
if (direction == TextDirection::RTL)
point.translate_by(-glyph_size.width(), 0); // If we are drawing right to left, we have to move backwards before drawing the glyph
@@ -1393,6 +1400,7 @@ void draw_text_line(IntRect const& a_rect, Utf8View const& text, Font const& fon
// The callback function might have exhausted the iterator.
if (it == text.end())
break;
+ last_code_point = code_point;
}
}
diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp b/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp
index 8cdb37d0dd2d..80123199a57a 100644
--- a/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp
+++ b/Userland/Libraries/LibGfx/TrueTypeFont/Font.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2020, Srimanta Barua <[email protected]>
* Copyright (c) 2021, Andreas Kling <[email protected]>
+ * Copyright (c) 2022, Jelle Raaijmakers <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -167,6 +168,137 @@ Optional<Name> Name::from_slice(ReadonlyBytes slice)
return Name(slice);
}
+ErrorOr<Kern> Kern::from_slice(ReadonlyBytes slice)
+{
+ if (slice.size() < sizeof(u32))
+ return Error::from_string_literal("Invalid kern table header"sv);
+
+ // We only support the old (2x u16) version of the header
+ auto version = be_u16(slice.data());
+ auto number_of_subtables = be_u16(slice.offset(sizeof(u16)));
+ if (version != 0)
+ return Error::from_string_literal("Unsupported kern table version"sv);
+ if (number_of_subtables == 0)
+ return Error::from_string_literal("Kern table does not contain any subtables"sv);
+
+ // Read all subtable offsets
+ auto subtable_offsets = TRY(FixedArray<size_t>::try_create(number_of_subtables));
+ size_t offset = 2 * sizeof(u16);
+ for (size_t i = 0; i < number_of_subtables; ++i) {
+ if (slice.size() < offset + Sizes::SubtableHeader)
+ return Error::from_string_literal("Invalid kern subtable header"sv);
+
+ subtable_offsets[i] = offset;
+ auto subtable_size = be_u16(slice.offset(offset + sizeof(u16)));
+ offset += subtable_size;
+ }
+
+ return Kern(slice, move(subtable_offsets));
+}
+
+i16 Kern::get_glyph_kerning(u16 left_glyph_id, u16 right_glyph_id) const
+{
+ VERIFY(left_glyph_id > 0 && right_glyph_id > 0);
+
+ i16 glyph_kerning = 0;
+ for (auto subtable_offset : m_subtable_offsets) {
+ auto subtable_slice = m_slice.slice(subtable_offset);
+
+ auto version = be_u16(subtable_slice.data());
+ auto length = be_u16(subtable_slice.offset(sizeof(u16)));
+ auto coverage = be_u16(subtable_slice.offset(2 * sizeof(u16)));
+
+ if (version != 0) {
+ dbgln("TTF::Kern: unsupported subtable version {}", version);
+ continue;
+ }
+
+ if (subtable_slice.size() < length) {
+ dbgln("TTF::Kern: subtable has an invalid size {}", length);
+ continue;
+ }
+
+ auto is_horizontal = (coverage & (1 << 0)) > 0;
+ auto is_minimum = (coverage & (1 << 1)) > 0;
+ auto is_cross_stream = (coverage & (1 << 2)) > 0;
+ auto is_override = (coverage & (1 << 3)) > 0;
+ auto reserved_bits = (coverage & 0xF0);
+ auto format = (coverage & 0xFF00) >> 8;
+
+ // FIXME: implement support for these features
+ if (!is_horizontal || is_minimum || is_cross_stream || (reserved_bits > 0)) {
+ dbgln("TTF::Kern: FIXME: implement missing feature support for subtable");
+ continue;
+ }
+
+ // FIXME: implement support for subtable formats other than 0
+ Optional<i16> subtable_kerning;
+ switch (format) {
+ case 0:
+ subtable_kerning = read_glyph_kerning_format0(subtable_slice.slice(Sizes::SubtableHeader), left_glyph_id, right_glyph_id);
+ break;
+ default:
+ dbgln("TTF::Kern: FIXME: subtable format {} is unsupported", format);
+ continue;
+ }
+ if (!subtable_kerning.has_value())
+ continue;
+ auto kerning_value = subtable_kerning.release_value();
+
+ if (is_override)
+ glyph_kerning = kerning_value;
+ else
+ glyph_kerning += kerning_value;
+ }
+ return glyph_kerning;
+}
+
+Optional<i16> Kern::read_glyph_kerning_format0(ReadonlyBytes slice, u16 left_glyph_id, u16 right_glyph_id)
+{
+ if (slice.size() < 4 * sizeof(u16))
+ return {};
+
+ u16 number_of_pairs = be_u16(slice.data());
+ u16 search_range = be_u16(slice.offset_pointer(sizeof(u16)));
+ u16 entry_selector = be_u16(slice.offset_pointer(2 * sizeof(u16)));
+ u16 range_shift = be_u16(slice.offset_pointer(3 * sizeof(u16)));
+
+ // Sanity checks for this table format
+ auto pairs_in_search_range = search_range / Sizes::Format0Entry;
+ if (number_of_pairs == 0)
+ return {};
+ if (pairs_in_search_range > number_of_pairs)
+ return {};
+ if ((1 << entry_selector) * Sizes::Format0Entry != search_range)
+ return {};
+ if ((number_of_pairs - pairs_in_search_range) * Sizes::Format0Entry != range_shift)
+ return {};
+
+ // FIXME: implement a possibly slightly more efficient binary search using the parameters above
+ auto search_slice = slice.slice(4 * sizeof(u16));
+ size_t left_idx = 0;
+ size_t right_idx = number_of_pairs - 1;
+ for (auto i = 0; i < 16; ++i) {
+ size_t pivot_idx = (left_idx + right_idx) / 2;
+
+ u16 pivot_left_glyph_id = be_u16(search_slice.offset(pivot_idx * Sizes::Format0Entry + 0));
+ u16 pivot_right_glyph_id = be_u16(search_slice.offset(pivot_idx * Sizes::Format0Entry + 2));
+
+ // Match
+ if (pivot_left_glyph_id == left_glyph_id && pivot_right_glyph_id == right_glyph_id)
+ return be_i16(search_slice.offset(pivot_idx * Sizes::Format0Entry + 4));
+
+ // Narrow search area
+ if (pivot_left_glyph_id < left_glyph_id || (pivot_left_glyph_id == left_glyph_id && pivot_right_glyph_id < right_glyph_id))
+ left_idx = pivot_idx + 1;
+ else if (pivot_idx == left_idx)
+ break;
+ else
+ right_idx = pivot_idx - 1;
+ }
+ return 0;
+}
+
String Name::string_for_id(NameId id) const
{
auto num_entries = be_u16(m_slice.offset_pointer(2));
@@ -274,6 +406,7 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3
Optional<ReadonlyBytes> opt_loca_slice = {};
Optional<ReadonlyBytes> opt_glyf_slice = {};
Optional<ReadonlyBytes> opt_os2_slice = {};
+ Optional<ReadonlyBytes> opt_kern_slice = {};
Optional<Head> opt_head = {};
Optional<Name> opt_name = {};
@@ -283,6 +416,7 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3
Optional<Cmap> opt_cmap = {};
Optional<Loca> opt_loca = {};
Optional<OS2> opt_os2 = {};
+ Optional<Kern> opt_kern = {};
auto num_tables = be_u16(buffer.offset_pointer(offset + (u32)Offsets::NumTables));
if (buffer.size() < offset + (u32)Sizes::OffsetTable + num_tables * (u32)Sizes::TableRecord)
@@ -321,6 +455,8 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3
opt_glyf_slice = buffer_here;
} else if (tag == tag_from_str("OS/2")) {
opt_os2_slice = buffer_here;
+ } else if (tag == tag_from_str("kern")) {
+ opt_kern_slice = buffer_here;
}
}
@@ -360,6 +496,10 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3
return Error::from_string_literal("Could not load OS/2"sv);
auto os2 = OS2(opt_os2_slice.value());
+ Optional<Kern> kern {};
+ if (opt_kern_slice.has_value())
+ kern = TRY(Kern::from_slice(opt_kern_slice.value()));
+
// Select cmap table. FIXME: Do this better. Right now, just looks for platform "Windows"
// and corresponding encoding "Unicode full repertoire", or failing that, "Unicode BMP"
for (u32 i = 0; i < cmap.num_subtables(); i++) {
@@ -384,7 +524,7 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3
}
}
- return adopt_ref(*new Font(move(buffer), move(head), move(name), move(hhea), move(maxp), move(hmtx), move(cmap), move(loca), move(glyf), move(os2)));
+ return adopt_ref(*new Font(move(buffer), move(head), move(name), move(hhea), move(maxp), move(hmtx), move(cmap), move(loca), move(glyf), move(os2), move(kern)));
}
ScaledFontMetrics Font::metrics(float x_scale, float y_scale) const
@@ -420,6 +560,13 @@ ScaledGlyphMetrics Font::glyph_metrics(u32 glyph_id, float x_scale, float y_scal
};
}
+i32 Font::glyphs_horizontal_kerning(u32 left_glyph_id, u32 right_glyph_id, float x_scale) const
+{
+ if (!m_kern.has_value())
+ return 0;
+ return m_kern->get_glyph_kerning(left_glyph_id, right_glyph_id) * x_scale;
+}
+
// FIXME: "loca" and "glyf" are not available for CFF fonts.
RefPtr<Gfx::Bitmap> Font::rasterize_glyph(u32 glyph_id, float x_scale, float y_scale) const
{
@@ -510,15 +657,18 @@ ALWAYS_INLINE int ScaledFont::unicode_view_width(T const& view) const
return 0;
int width = 0;
int longest_width = 0;
+ u32 last_code_point = 0;
for (auto code_point : view) {
if (code_point == '\n' || code_point == '\r') {
longest_width = max(width, longest_width);
width = 0;
+ last_code_point = code_point;
continue;
}
u32 glyph_id = glyph_id_for_code_point(code_point);
- auto metrics = glyph_metrics(glyph_id);
- width += metrics.advance_width;
+ auto kerning = glyphs_horizontal_kerning(last_code_point, code_point);
+ width += kerning + glyph_metrics(glyph_id).advance_width;
+ last_code_point = code_point;
}
longest_width = max(width, longest_width);
return longest_width;
@@ -557,6 +707,19 @@ int ScaledFont::glyph_or_emoji_width(u32 code_point) const
return metrics.advance_width;
}
+i32 ScaledFont::glyphs_horizontal_kerning(u32 left_code_point, u32 right_code_point) const
+{
+ if (left_code_point == 0 || right_code_point == 0)
+ return 0;
+
+ auto left_glyph_id = glyph_id_for_code_point(left_code_point);
+ auto right_glyph_id = glyph_id_for_code_point(right_code_point);
+ if (left_glyph_id == 0 || right_glyph_id == 0)
+ return 0;
+
+ return m_font->glyphs_horizontal_kerning(left_glyph_id, right_glyph_id, m_x_scale);
+}
+
u8 ScaledFont::glyph_fixed_width() const
{
return glyph_metrics(glyph_id_for_code_point(' ')).advance_width;
diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Font.h b/Userland/Libraries/LibGfx/TrueTypeFont/Font.h
index 657c9d2930bc..7e77053707c8 100644
--- a/Userland/Libraries/LibGfx/TrueTypeFont/Font.h
+++ b/Userland/Libraries/LibGfx/TrueTypeFont/Font.h
@@ -50,6 +50,7 @@ class Font : public RefCounted<Font> {
ScaledFontMetrics metrics(float x_scale, float y_scale) const;
ScaledGlyphMetrics glyph_metrics(u32 glyph_id, float x_scale, float y_scale) const;
+ i32 glyphs_horizontal_kerning(u32 left_glyph_id, u32 right_glyph_id, float x_scale) const;
RefPtr<Gfx::Bitmap> rasterize_glyph(u32 glyph_id, float x_scale, float y_scale) const;
u32 glyph_count() const;
u16 units_per_em() const;
@@ -74,7 +75,7 @@ class Font : public RefCounted<Font> {
static ErrorOr<NonnullRefPtr<Font>> try_load_from_offset(ReadonlyBytes, unsigned index = 0);
- Font(ReadonlyBytes bytes, Head&& head, Name&& name, Hhea&& hhea, Maxp&& maxp, Hmtx&& hmtx, Cmap&& cmap, Loca&& loca, Glyf&& glyf, OS2&& os2)
+ Font(ReadonlyBytes bytes, Head&& head, Name&& name, Hhea&& hhea, Maxp&& maxp, Hmtx&& hmtx, Cmap&& cmap, Loca&& loca, Glyf&& glyf, OS2&& os2, Optional<Kern>&& kern)
: m_buffer(move(bytes))
, m_head(move(head))
, m_name(move(name))
@@ -85,6 +86,7 @@ class Font : public RefCounted<Font> {
, m_glyf(move(glyf))
, m_cmap(move(cmap))
, m_os2(move(os2))
+ , m_kern(move(kern))
{
}
@@ -102,6 +104,7 @@ class Font : public RefCounted<Font> {
Glyf m_glyf;
Cmap m_cmap;
OS2 m_os2;
+ Optional<Kern> m_kern;
};
class ScaledFont : public Gfx::Font {
@@ -129,6 +132,7 @@ class ScaledFont : public Gfx::Font {
virtual bool contains_glyph(u32 code_point) const override { return m_font->glyph_id_for_code_point(code_point) > 0; }
virtual u8 glyph_width(u32 code_point) const override;
virtual int glyph_or_emoji_width(u32 code_point) const override;
+ virtual i32 glyphs_horizontal_kerning(u32 left_code_point, u32 right_code_point) const override;
virtual int preferred_line_height() const override { return metrics().height() + metrics().line_gap; }
virtual u8 glyph_height() const override { return m_point_height; }
virtual int x_height() const override { return m_point_height; } // FIXME: Read from font
@@ -142,7 +146,7 @@ class ScaledFont : public Gfx::Font {
virtual int width(Utf32View const&) const override;
virtual String name() const override { return String::formatted("{} {}", family(), variant()); }
virtual bool is_fixed_width() const override { return m_font->is_fixed_width(); }
- virtual u8 glyph_spacing() const override { return m_x_scale; } // FIXME: Read from font
+ virtual u8 glyph_spacing() const override { return 0; }
virtual size_t glyph_count() const override { return m_font->glyph_count(); }
virtual String family() const override { return m_font->family(); }
virtual String variant() const override { return m_font->variant(); }
diff --git a/Userland/Libraries/LibGfx/TrueTypeFont/Tables.h b/Userland/Libraries/LibGfx/TrueTypeFont/Tables.h
index 182e2493ca7f..73cbf998f915 100644
--- a/Userland/Libraries/LibGfx/TrueTypeFont/Tables.h
+++ b/Userland/Libraries/LibGfx/TrueTypeFont/Tables.h
@@ -1,11 +1,14 @@
/*
* Copyright (c) 2020, Srimanta Barua <[email protected]>
+ * Copyright (c) 2022, Jelle Raaijmakers <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
+#include <AK/Error.h>
+#include <AK/FixedArray.h>
#include <AK/Span.h>
#include <AK/String.h>
@@ -201,4 +204,27 @@ class Name {
ReadonlyBytes m_slice;
};
+class Kern {
+public:
+ static ErrorOr<Kern> from_slice(ReadonlyBytes);
+ i16 get_glyph_kerning(u16 left_glyph_id, u16 right_glyph_id) const;
+
+private:
+ enum Sizes : size_t {
+ SubtableHeader = 6,
+ Format0Entry = 6,
+ };
+
+ Kern(ReadonlyBytes slice, FixedArray<size_t> subtable_offsets)
+ : m_slice(slice)
+ , m_subtable_offsets(move(subtable_offsets))
+ {
+ }
+
+ static Optional<i16> read_glyph_kerning_format0(ReadonlyBytes slice, u16 left_glyph_id, u16 right_glyph_id);
+
+ ReadonlyBytes m_slice;
+ FixedArray<size_t> m_subtable_offsets;
+};
+
}
|
57f72f29827b1842c4130611a724971c362de03f
|
2020-04-02 18:55:08
|
Andreas Kling
|
js: Change wording from "Exception caught" to "Uncaught exception" :^)
| false
|
Change wording from "Exception caught" to "Uncaught exception" :^)
|
js
|
diff --git a/Userland/js.cpp b/Userland/js.cpp
index 44b3e3a03423..089ee322a69a 100644
--- a/Userland/js.cpp
+++ b/Userland/js.cpp
@@ -280,7 +280,7 @@ void repl(JS::Interpreter& interpreter)
auto result = interpreter.run(*program);
if (interpreter.exception()) {
- printf("Exception caught: ");
+ printf("Uncaught exception: ");
print(interpreter.exception()->value());
interpreter.clear_exception();
} else {
|
044be82567c90a977a571b6c5e4c72bacd572983
|
2022-03-16 00:30:09
|
Vrins
|
browser: Allow jumping to stylenames by typing in the inspector
| false
|
Allow jumping to stylenames by typing in the inspector
|
browser
|
diff --git a/Userland/Applications/Browser/InspectorWidget.cpp b/Userland/Applications/Browser/InspectorWidget.cpp
index 24daae993ac8..cdfd78a190c0 100644
--- a/Userland/Applications/Browser/InspectorWidget.cpp
+++ b/Userland/Applications/Browser/InspectorWidget.cpp
@@ -162,12 +162,15 @@ void InspectorWidget::load_style_json(String specified_values_json, String compu
{
m_selection_specified_values_json = specified_values_json;
m_style_table_view->set_model(Web::StylePropertiesModel::create(m_selection_specified_values_json.value().view()));
+ m_style_table_view->set_searchable(true);
m_selection_computed_values_json = computed_values_json;
m_computed_style_table_view->set_model(Web::StylePropertiesModel::create(m_selection_computed_values_json.value().view()));
+ m_computed_style_table_view->set_searchable(true);
m_selection_custom_properties_json = custom_properties_json;
m_custom_properties_table_view->set_model(Web::StylePropertiesModel::create(m_selection_custom_properties_json.value().view()));
+ m_custom_properties_table_view->set_searchable(true);
}
void InspectorWidget::update_node_box_model(Optional<String> node_box_sizing_json)
diff --git a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp
index 6c3bc474380f..fa69248bda9e 100644
--- a/Userland/Libraries/LibWeb/StylePropertiesModel.cpp
+++ b/Userland/Libraries/LibWeb/StylePropertiesModel.cpp
@@ -56,4 +56,21 @@ GUI::Variant StylePropertiesModel::data(GUI::ModelIndex const& index, GUI::Model
return {};
}
+Vector<GUI::ModelIndex> StylePropertiesModel::matches(StringView searching, unsigned flags, GUI::ModelIndex const& parent)
+{
+ if (m_values.is_empty())
+ return {};
+ Vector<GUI::ModelIndex> found_indices;
+ for (auto it = m_values.begin(); !it.is_end(); ++it) {
+ GUI::ModelIndex index = this->index(it.index(), Column::PropertyName, parent);
+ if (!string_matches(data(index, GUI::ModelRole::Display).as_string(), searching, flags))
+ continue;
+
+ found_indices.append(index);
+ if (flags & FirstMatchOnly)
+ break;
+ }
+ return found_indices;
+}
+
}
diff --git a/Userland/Libraries/LibWeb/StylePropertiesModel.h b/Userland/Libraries/LibWeb/StylePropertiesModel.h
index 974f403a750c..b4b1debd74a3 100644
--- a/Userland/Libraries/LibWeb/StylePropertiesModel.h
+++ b/Userland/Libraries/LibWeb/StylePropertiesModel.h
@@ -33,6 +33,8 @@ class StylePropertiesModel final : public GUI::Model {
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_searchable() const override { return true; }
+ virtual Vector<GUI::ModelIndex> matches(StringView, unsigned flags, GUI::ModelIndex const&) override;
private:
explicit StylePropertiesModel(JsonObject);
|
fa2579ffa999c0d20b31feb1223ccc08c1419be9
|
2022-11-18 21:00:29
|
Timothy Flynn
|
libweb: Implement most of WebDriver capability matching
| false
|
Implement most of WebDriver capability matching
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/WebDriver/Capabilities.cpp b/Userland/Libraries/LibWeb/WebDriver/Capabilities.cpp
index 38e0df66ed5f..f641157adaa4 100644
--- a/Userland/Libraries/LibWeb/WebDriver/Capabilities.cpp
+++ b/Userland/Libraries/LibWeb/WebDriver/Capabilities.cpp
@@ -4,10 +4,12 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <AK/Debug.h>
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
#include <AK/JsonValue.h>
#include <AK/Optional.h>
+#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/WebDriver/Capabilities.h>
#include <LibWeb/WebDriver/TimeoutsConfiguration.h>
@@ -176,6 +178,115 @@ static ErrorOr<JsonObject, Error> merge_capabilities(JsonObject const& primary,
return result;
}
+static bool matches_browser_version(StringView requested_version, StringView required_version)
+{
+ // FIXME: Handle relative (>, >=, <. <=) comparisons. For now, require an exact match.
+ return requested_version == required_version;
+}
+
+static bool matches_platform_name(StringView requested_platform_name, StringView required_platform_name)
+{
+ if (requested_platform_name == required_platform_name)
+ return true;
+
+ // The following platform names are in common usage with well-understood semantics and, when matching capabilities, greatest interoperability can be achieved by honoring them as valid synonyms for well-known Operating Systems:
+ // "linux" Any server or desktop system based upon the Linux kernel.
+ // "mac" Any version of Apple’s macOS.
+ // "windows" Any version of Microsoft Windows, including desktop and mobile versions.
+ // This list is not exhaustive.
+
+ // NOTE: Of the synonyms listed in the spec, the only one that differs for us is macOS.
+ // Further, we are allowed to handle synonyms for SerenityOS.
+ if (requested_platform_name == "mac"sv && required_platform_name == "macos"sv)
+ return true;
+ if (requested_platform_name == "serenity"sv && required_platform_name == "serenityos"sv)
+ return true;
+ return false;
+}
+
+// https://w3c.github.io/webdriver/#dfn-matching-capabilities
+static JsonValue match_capabilities(JsonObject const& capabilities)
+{
+ static auto browser_name = StringView { BROWSER_NAME, strlen(BROWSER_NAME) }.to_lowercase_string();
+ static auto platform_name = StringView { OS_STRING, strlen(OS_STRING) }.to_lowercase_string();
+
+ // 1. Let matched capabilities be a JSON Object with the following entries:
+ JsonObject matched_capabilities;
+ // "browserName"
+ // ASCII Lowercase name of the user agent as a string.
+ matched_capabilities.set("browserName"sv, browser_name);
+ // "browserVersion"
+ // The user agent version, as a string.
+ matched_capabilities.set("browserVersion"sv, BROWSER_VERSION);
+ // "platformName"
+ // ASCII Lowercase name of the current platform as a string.
+ matched_capabilities.set("platformName"sv, platform_name);
+ // "acceptInsecureCerts"
+ // Boolean initially set to false, indicating the session will not implicitly trust untrusted or self-signed TLS certificates on navigation.
+ matched_capabilities.set("acceptInsecureCerts"sv, false);
+ // "strictFileInteractability"
+ // Boolean initially set to false, indicating that interactability checks will be applied to <input type=file>.
+ matched_capabilities.set("strictFileInteractability"sv, false);
+ // "setWindowRect"
+ // Boolean indicating whether the remote end supports all of the resizing and positioning commands.
+ matched_capabilities.set("setWindowRect"sv, true);
+
+ // 2. Optionally add extension capabilities as entries to matched capabilities. The values of these may be elided, and there is no requirement that all extension capabilities be added.
+
+ // 3. For each name and value corresponding to capability’s own properties:
+ auto result = capabilities.try_for_each_member([&](auto const& name, auto const& value) -> ErrorOr<void> {
+ // a. Let match value equal value.
+
+ // b. Run the substeps of the first matching name:
+ // -> "browserName"
+ if (name == "browserName"sv) {
+ // If value is not a string equal to the "browserName" entry in matched capabilities, return success with data null.
+ if (value.as_string() != matched_capabilities.get(name).as_string())
+ return AK::Error::from_string_view("browserName"sv);
+ }
+ // -> "browserVersion"
+ else if (name == "browserVersion"sv) {
+ // Compare value to the "browserVersion" entry in matched capabilities using an implementation-defined comparison algorithm. The comparison is to accept a value that places constraints on the version using the "<", "<=", ">", and ">=" operators.
+ // If the two values do not match, return success with data null.
+ if (!matches_browser_version(value.as_string(), matched_capabilities.get(name).as_string()))
+ return AK::Error::from_string_view("browserVersion"sv);
+ }
+ // -> "platformName"
+ else if (name == "platformName"sv) {
+ // If value is not a string equal to the "platformName" entry in matched capabilities, return success with data null.
+ if (!matches_platform_name(value.as_string(), matched_capabilities.get(name).as_string()))
+ return AK::Error::from_string_view("platformName"sv);
+ }
+ // -> "acceptInsecureCerts"
+ else if (name == "acceptInsecureCerts"sv) {
+ // If value is true and the endpoint node does not support insecure TLS certificates, return success with data null.
+ if (value.as_bool())
+ return AK::Error::from_string_view("acceptInsecureCerts"sv);
+ }
+ // -> "proxy"
+ else if (name == "proxy"sv) {
+ // FIXME: If the endpoint node does not allow the proxy it uses to be configured, or if the proxy configuration defined in value is not one that passes the endpoint node’s implementation-specific validity checks, return success with data null.
+ }
+ // -> Otherwise
+ else {
+ // FIXME: If name is the name of an additional WebDriver capability which defines a matched capability serialization algorithm, let match value be the result of running the matched capability serialization algorithm for capability name with argument value.
+ // FIXME: Otherwise, if name is the key of an extension capability, let match value be the result of trying implementation-specific steps to match on name with value. If the match is not successful, return success with data null.
+ }
+
+ // c. Set a property on matched capabilities with name name and value match value.
+ matched_capabilities.set(name, value);
+ return {};
+ });
+
+ if (result.is_error()) {
+ dbgln_if(WEBDRIVER_DEBUG, "Failed to match capability: {}", result.error());
+ return JsonValue {};
+ }
+
+ // 4. Return success with data matched capabilities.
+ return matched_capabilities;
+}
+
// https://w3c.github.io/webdriver/#dfn-capabilities-processing
Response process_capabilities(JsonValue const& parameters)
{
@@ -241,14 +352,18 @@ Response process_capabilities(JsonValue const& parameters)
return {};
}));
- // FIXME: 8. For each capabilities corresponding to an indexed property in merged capabilities:
- // FIXME: a. Let matched capabilities be the result of trying to match capabilities with capabilities as an argument.
- // FIXME: b. If matched capabilities is not null, return success with data matched capabilities.
+ // 8. For each capabilities corresponding to an indexed property in merged capabilities:
+ for (auto const& capabilities : merged_capabilities.values()) {
+ // a. Let matched capabilities be the result of trying to match capabilities with capabilities as an argument.
+ auto matched_capabilities = match_capabilities(capabilities.as_object());
- // For now, we just assume the first validated capabilties object is a match.
- return merged_capabilities.take(0);
+ // b. If matched capabilities is not null, return success with data matched capabilities.
+ if (!matched_capabilities.is_null())
+ return matched_capabilities;
+ }
// 9. Return success with data null.
+ return JsonValue {};
}
}
|
ccdfb077d8fd5802b5263a6e3d26cfbfedea9a34
|
2020-03-26 12:31:45
|
Sergey Bugaev
|
userland: Implement JS REPL
| false
|
Implement JS REPL
|
userland
|
diff --git a/Userland/js.cpp b/Userland/js.cpp
index 583940b67c55..c3db8206b5f8 100644
--- a/Userland/js.cpp
+++ b/Userland/js.cpp
@@ -26,6 +26,7 @@
#include <AK/ByteBuffer.h>
#include <AK/NonnullOwnPtr.h>
+#include <AK/StringBuilder.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibJS/AST.h>
@@ -36,11 +37,79 @@
#include <LibJS/Runtime/Value.h>
#include <stdio.h>
-#define PROGRAM 6
+bool dump_ast = false;
+
+String read_next_piece()
+{
+ StringBuilder piece;
+ int level = 0;
+
+ do {
+ if (level == 0)
+ fprintf(stderr, "> ");
+ else
+ fprintf(stderr, ".%*c", 4 * level + 1, ' ');
+
+ char* line = nullptr;
+ size_t allocated_size = 0;
+ ssize_t nread = getline(&line, &allocated_size, stdin);
+ if (nread < 0) {
+ if (errno == ESUCCESS) {
+ // Explicit EOF; stop reading. Print a newline though, to make
+ // the next prompt (or the shell prompt) appear on the next
+ // line.
+ fprintf(stderr, "\n");
+ break;
+ } else {
+ perror("getline");
+ exit(1);
+ }
+ }
+
+ piece.append(line);
+ auto lexer = JS::Lexer(line);
+
+ for (JS::Token token = lexer.next(); token.type() != JS::TokenType::Eof; token = lexer.next()) {
+ switch (token.type()) {
+ case JS::TokenType::BracketOpen:
+ case JS::TokenType::CurlyOpen:
+ case JS::TokenType::ParenOpen:
+ level++;
+ break;
+ case JS::TokenType::BracketClose:
+ case JS::TokenType::CurlyClose:
+ case JS::TokenType::ParenClose:
+ level--;
+ break;
+ default:
+ break;
+ }
+ }
+
+ free(line);
+ } while (level > 0);
+
+ return piece.to_string();
+}
+
+void repl(JS::Interpreter& interpreter)
+{
+ while (true) {
+ String piece = read_next_piece();
+ if (piece.is_empty())
+ break;
+
+ auto program = JS::Parser(JS::Lexer(piece)).parse_program();
+ if (dump_ast)
+ program->dump(0);
+
+ auto result = interpreter.run(*program);
+ printf("%s\n", result.to_string().characters());
+ }
+}
int main(int argc, char** argv)
{
- bool dump_ast = false;
bool gc_on_every_allocation = false;
bool print_last_result = false;
const char* script_path = nullptr;
@@ -49,40 +118,43 @@ int main(int argc, char** argv)
args_parser.add_option(dump_ast, "Dump the AST", "ast-dump", 'A');
args_parser.add_option(print_last_result, "Print last result", "print-last-result", 'l');
args_parser.add_option(gc_on_every_allocation, "GC on every allocation", "gc-on-every-allocation", 'g');
- args_parser.add_positional_argument(script_path, "Path to script file", "script");
+ args_parser.add_positional_argument(script_path, "Path to script file", "script", Core::ArgsParser::Required::No);
args_parser.parse(argc, argv);
- 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());
- return 1;
- }
- auto file_contents = file->read_all();
-
- StringView source;
- if (file_contents.size() >= 2 && file_contents[0] == '#' && file_contents[1] == '!') {
- size_t i = 0;
- for (i = 2; i < file_contents.size(); ++i) {
- if (file_contents[i] == '\n')
- break;
- }
- source = StringView((const char*)file_contents.data() + i, file_contents.size() - i);
- } else {
- source = file_contents;
- }
-
JS::Interpreter interpreter;
interpreter.heap().set_should_collect_on_every_allocation(gc_on_every_allocation);
- auto program = JS::Parser(JS::Lexer(source)).parse_program();
+ if (script_path == nullptr) {
+ repl(interpreter);
+ } else {
+ 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());
+ return 1;
+ }
+ auto file_contents = file->read_all();
+
+ StringView source;
+ if (file_contents.size() >= 2 && file_contents[0] == '#' && file_contents[1] == '!') {
+ size_t i = 0;
+ for (i = 2; i < file_contents.size(); ++i) {
+ if (file_contents[i] == '\n')
+ break;
+ }
+ source = StringView((const char*)file_contents.data() + i, file_contents.size() - i);
+ } else {
+ source = file_contents;
+ }
+ auto program = JS::Parser(JS::Lexer(source)).parse_program();
- if (dump_ast)
- program->dump(0);
+ if (dump_ast)
+ program->dump(0);
- auto result = interpreter.run(*program);
+ auto result = interpreter.run(*program);
- if (print_last_result)
- printf("%s\n", result.to_string().characters());
+ if (print_last_result)
+ printf("%s\n", result.to_string().characters());
+ }
return 0;
}
|
809ffa56d7fff27e0a0eb4484b803c4f3a90e150
|
2019-02-20 16:58:41
|
Andreas Kling
|
kernel: Reduce code duplication in exception handlers.
| false
|
Reduce code duplication in exception handlers.
|
kernel
|
diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h
index d4a03a95d51c..0d952e7f64d6 100644
--- a/AK/StdLibExtras.h
+++ b/AK/StdLibExtras.h
@@ -171,6 +171,16 @@ template<class T> struct RemovePointer<T* const> { typedef T Type; };
template<class T> struct RemovePointer<T* volatile> { typedef T Type; };
template<class T> struct RemovePointer<T* const volatile> { typedef T Type; };
+template<typename T, typename U>
+struct IsSame {
+ enum { value = 0 };
+};
+
+template<typename T>
+struct IsSame<T, T> {
+ enum { value = 1 };
+};
+
}
using AK::min;
@@ -180,4 +190,4 @@ using AK::forward;
using AK::exchange;
using AK::swap;
using AK::ceil_div;
-
+using AK::IsSame;
diff --git a/Kernel/i386.cpp b/Kernel/i386.cpp
index 9cb38f1921e5..33fabb49e7f8 100644
--- a/Kernel/i386.cpp
+++ b/Kernel/i386.cpp
@@ -121,12 +121,9 @@ asm( \
" iret\n" \
);
-// 6: Invalid Opcode
-EH_ENTRY_NO_CODE(6);
-void exception_6_handler(RegisterDump& regs)
+template<typename DumpType>
+static void dump(const DumpType& regs)
{
- kprintf("%s invalid opcode: %u(%s)\n", current->is_ring0() ? "Kernel" : "Process", current->pid(), current->name().characters());
-
word ss;
dword esp;
if (current->is_ring0()) {
@@ -137,11 +134,37 @@ void exception_6_handler(RegisterDump& regs)
esp = regs.esp_if_crossRing;
}
+ if constexpr (IsSame<DumpType, RegisterDumpWithExceptionCode>::value) {
+ kprintf("exception code: %w\n", regs.exception_code);
+ }
kprintf("pc=%w:%x ds=%w es=%w fs=%w gs=%w\n", regs.cs, regs.eip, regs.ds, regs.es, regs.fs, regs.gs);
kprintf("stk=%w:%x\n", ss, esp);
kprintf("eax=%x ebx=%x ecx=%x edx=%x\n", regs.eax, regs.ebx, regs.ecx, regs.edx);
kprintf("ebp=%x esp=%x esi=%x edi=%x\n", regs.ebp, esp, regs.esi, regs.edi);
+ if (current->validate_read((void*)regs.eip, 8)) {
+ byte* codeptr = (byte*)regs.eip;
+ kprintf("code: %b %b %b %b %b %b %b %b\n",
+ codeptr[0],
+ codeptr[1],
+ codeptr[2],
+ codeptr[3],
+ codeptr[4],
+ codeptr[5],
+ codeptr[6],
+ codeptr[7]);
+ }
+}
+
+
+// 6: Invalid Opcode
+EH_ENTRY_NO_CODE(6);
+void exception_6_handler(RegisterDump& regs)
+{
+ kprintf("%s invalid opcode: %u(%s)\n", current->is_ring0() ? "Kernel" : "Process", current->pid(), current->name().characters());
+
+ dump(regs);
+
if (current->is_ring0()) {
kprintf("Oh shit, we've crashed in ring 0 :(\n");
hang();
@@ -176,21 +199,7 @@ void exception_7_handler(RegisterDump& regs)
#ifdef FPU_EXCEPTION_DEBUG
kprintf("%s FPU not available exception: %u(%s)\n", current->is_ring0() ? "Kernel" : "Process", current->pid(), current->name().characters());
-
- word ss;
- dword esp;
- if (current->is_ring0()) {
- ss = regs.ds;
- esp = regs.esp;
- } else {
- ss = regs.ss_if_crossRing;
- esp = regs.esp_if_crossRing;
- }
-
- kprintf("pc=%w:%x ds=%w es=%w fs=%w gs=%w\n", regs.cs, regs.eip, regs.ds, regs.es, regs.fs, regs.gs);
- kprintf("stk=%w:%x\n", ss, esp);
- kprintf("eax=%x ebx=%x ecx=%x edx=%x\n", regs.eax, regs.ebx, regs.ecx, regs.edx);
- kprintf("ebp=%x esp=%x esi=%x edi=%x\n", regs.ebp, esp, regs.esi, regs.edi);
+ dump(regs);
#endif
}
@@ -201,20 +210,7 @@ void exception_0_handler(RegisterDump& regs)
{
kprintf("%s DIVIDE ERROR: %u(%s)\n", current->is_ring0() ? "Kernel" : "User", current->pid(), current->name().characters());
- word ss;
- dword esp;
- if (current->is_ring0()) {
- ss = regs.ds;
- esp = regs.esp;
- } else {
- ss = regs.ss_if_crossRing;
- esp = regs.esp_if_crossRing;
- }
-
- kprintf("pc=%w:%x ds=%w es=%w fs=%w gs=%w\n", regs.cs, regs.eip, regs.ds, regs.es, regs.fs, regs.gs);
- kprintf("stk=%w:%x\n", ss, esp);
- kprintf("eax=%x ebx=%x ecx=%x edx=%x\n", regs.eax, regs.ebx, regs.ecx, regs.edx);
- kprintf("ebp=%x esp=%x esi=%x edi=%x\n", regs.ebp, esp, regs.esi, regs.edi);
+ dump(regs);
if (current->is_ring0()) {
kprintf("Oh shit, we've crashed in ring 0 :(\n");
@@ -231,21 +227,7 @@ void exception_13_handler(RegisterDumpWithExceptionCode& regs)
{
kprintf("%s GPF: %u(%s)\n", current->is_ring0() ? "Kernel" : "User", current->pid(), current->name().characters());
- word ss;
- dword esp;
- if (current->is_ring0()) {
- ss = regs.ds;
- esp = regs.esp;
- } else {
- ss = regs.ss_if_crossRing;
- esp = regs.esp_if_crossRing;
- }
-
- kprintf("exception code: %w\n", regs.exception_code);
- kprintf("pc=%w:%x ds=%w es=%w fs=%w gs=%w\n", regs.cs, regs.eip, regs.ds, regs.es, regs.fs, regs.gs);
- kprintf("stk=%w:%x\n", ss, esp);
- kprintf("eax=%x ebx=%x ecx=%x edx=%x\n", regs.eax, regs.ebx, regs.ecx, regs.edx);
- kprintf("ebp=%x esp=%x esi=%x edi=%x\n", regs.ebp, esp, regs.esi, regs.edi);
+ dump(regs);
if (current->is_ring0()) {
kprintf("Oh shit, we've crashed in ring 0 :(\n");
@@ -278,40 +260,8 @@ void exception_14_handler(RegisterDumpWithExceptionCode& regs)
faultAddress);
#endif
- word ss;
- dword esp;
- if (current->is_ring0()) {
- ss = regs.ds;
- esp = regs.esp;
- } else {
- ss = regs.ss_if_crossRing;
- esp = regs.esp_if_crossRing;
- }
-
- auto dump_registers_and_code = [&] {
- dbgprintf("exception code: %w\n", regs.exception_code);
- dbgprintf("pc=%w:%x ds=%w es=%w fs=%w gs=%w\n", regs.cs, regs.eip, regs.ds, regs.es, regs.fs, regs.gs);
- dbgprintf("stk=%w:%x\n", ss, esp);
- dbgprintf("eax=%x ebx=%x ecx=%x edx=%x\n", regs.eax, regs.ebx, regs.ecx, regs.edx);
- dbgprintf("ebp=%x esp=%x esi=%x edi=%x\n", regs.ebp, esp, regs.esi, regs.edi);
-
- if (current->validate_read((void*)regs.eip, 8)) {
- byte* codeptr = (byte*)regs.eip;
- dbgprintf("code: %b %b %b %b %b %b %b %b\n",
- codeptr[0],
- codeptr[1],
- codeptr[2],
- codeptr[3],
- codeptr[4],
- codeptr[5],
- codeptr[6],
- codeptr[7]
- );
- }
- };
-
#ifdef PAGE_FAULT_DEBUG
- dump_registers_and_code();
+ dump(regs);
#endif
auto response = MM.handle_page_fault(PageFault(regs.exception_code, LinearAddress(faultAddress)));
@@ -322,7 +272,7 @@ void exception_14_handler(RegisterDumpWithExceptionCode& regs)
current->pid(),
regs.exception_code & 2 ? "write" : "read",
faultAddress);
- dump_registers_and_code();
+ dump(regs);
current->crash();
} else if (response == PageFaultResponse::Continue) {
#ifdef PAGE_FAULT_DEBUG
|
409333d80a05d9feec7cdcc3a1e53d874e29cb20
|
2023-05-21 15:29:19
|
Aliaksandr Kalenik
|
libweb: Implement more of spanning tracks sizing in GFC
| false
|
Implement more of spanning tracks sizing in GFC
|
libweb
|
diff --git a/Tests/LibWeb/Layout/expected/grid/row-span-2-maxcontent.txt b/Tests/LibWeb/Layout/expected/grid/row-span-2-maxcontent.txt
new file mode 100644
index 000000000000..c8fcf92aee12
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/row-span-2-maxcontent.txt
@@ -0,0 +1,105 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
+ BlockContainer <body> at (8,8) content-size 784x315.40625 children: not-inline
+ Box <div.grid-container> at (8,8) content-size 784x315.40625 [GFC] children: not-inline
+ BlockContainer <(anonymous)> at (8,8) content-size 0x0 [BFC] children: inline
+ TextNode <#text>
+ BlockContainer <div.grid-item.item-span-one-one> at (401.46875,8) content-size 392x131.296875 [BFC] children: inline
+ line 0 width: 319.171875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 1, length: 40, rect: [401.46875,8 319.171875x17.46875]
+ "In a sollicitudin augue. Sed ante augue,"
+ line 1 width: 335.125, height: 17.9375, bottom: 35.40625, baseline: 13.53125
+ frag 0 from TextNode start: 42, length: 42, rect: [401.46875,25 335.125x17.46875]
+ "rhoncus nec porttitor id, lacinia et nibh."
+ line 2 width: 378.625, height: 18.40625, bottom: 53.34375, baseline: 13.53125
+ frag 0 from TextNode start: 85, length: 48, rect: [401.46875,42 378.625x17.46875]
+ "Pellentesque diam libero, ultrices eget eleifend"
+ line 3 width: 182.8125, height: 17.875, bottom: 70.28125, baseline: 13.53125
+ frag 0 from TextNode start: 134, length: 22, rect: [401.46875,60 182.8125x17.46875]
+ "at, consequat ut orci."
+ TextNode <#text>
+ BlockContainer <(anonymous)> at (8,8) content-size 0x0 [BFC] children: inline
+ TextNode <#text>
+ BlockContainer <div.grid-item.item-span-one-two> at (401.46875,139.296875) content-size 392x184.109375 [BFC] children: inline
+ line 0 width: 359.15625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 1, length: 43, rect: [401.46875,139.296875 359.15625x17.46875]
+ "Suspendisse potenti. Pellentesque at varius"
+ line 1 width: 318.5625, height: 17.9375, bottom: 35.40625, baseline: 13.53125
+ frag 0 from TextNode start: 45, length: 41, rect: [401.46875,156.296875 318.5625x17.46875]
+ "lacus, sed sollicitudin leo. Pellentesque"
+ line 2 width: 377.640625, height: 18.40625, bottom: 53.34375, baseline: 13.53125
+ frag 0 from TextNode start: 87, length: 44, rect: [401.46875,173.296875 377.640625x17.46875]
+ "malesuada mi eget pellentesque tempor. Donec"
+ line 3 width: 378.03125, height: 17.875, bottom: 70.28125, baseline: 13.53125
+ frag 0 from TextNode start: 132, length: 47, rect: [401.46875,191.296875 378.03125x17.46875]
+ "egestas mauris est, ut lobortis nisi luctus at."
+ line 4 width: 345.953125, height: 18.34375, bottom: 88.21875, baseline: 13.53125
+ frag 0 from TextNode start: 180, length: 41, rect: [401.46875,208.296875 345.953125x17.46875]
+ "Vivamus eleifend, lorem vulputate maximus"
+ line 5 width: 312.765625, height: 17.8125, bottom: 105.15625, baseline: 13.53125
+ frag 0 from TextNode start: 222, length: 37, rect: [401.46875,226.296875 312.765625x17.46875]
+ "porta, nunc metus porttitor nibh, nec"
+ line 6 width: 242.921875, height: 18.28125, bottom: 123.09375, baseline: 13.53125
+ frag 0 from TextNode start: 260, length: 31, rect: [401.46875,243.296875 242.921875x17.46875]
+ "bibendum nulla lectus ut felis."
+ TextNode <#text>
+ BlockContainer <(anonymous)> at (8,8) content-size 0x0 [BFC] children: inline
+ TextNode <#text>
+ BlockContainer <div.grid-item.item-span-two> at (8,8) content-size 393.46875x315.40625 [BFC] children: inline
+ line 0 width: 337.6875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 1, length: 39, rect: [8,8 337.6875x17.46875]
+ "Lorem ipsum dolor sit amet, consectetur"
+ line 1 width: 376.34375, height: 17.9375, bottom: 35.40625, baseline: 13.53125
+ frag 0 from TextNode start: 41, length: 47, rect: [8,25 376.34375x17.46875]
+ "adipiscing elit. Sed vitae condimentum erat, ac"
+ line 2 width: 365.84375, height: 18.40625, bottom: 53.34375, baseline: 13.53125
+ frag 0 from TextNode start: 89, length: 45, rect: [8,42 365.84375x17.46875]
+ "posuere arcu. Aenean tincidunt mi ligula, vel"
+ line 3 width: 381.96875, height: 17.875, bottom: 70.28125, baseline: 13.53125
+ frag 0 from TextNode start: 135, length: 46, rect: [8,60 381.96875x17.46875]
+ "semper dolor aliquet at. Phasellus scelerisque"
+ line 4 width: 377.203125, height: 18.34375, bottom: 88.21875, baseline: 13.53125
+ frag 0 from TextNode start: 182, length: 45, rect: [8,77 377.203125x17.46875]
+ "dapibus diam sed rhoncus. Proin sed orci leo."
+ line 5 width: 375.390625, height: 17.8125, bottom: 105.15625, baseline: 13.53125
+ frag 0 from TextNode start: 228, length: 45, rect: [8,95 375.390625x17.46875]
+ "Praesent pellentesque mi eu nunc gravida, vel"
+ line 6 width: 383.53125, height: 18.28125, bottom: 123.09375, baseline: 13.53125
+ frag 0 from TextNode start: 274, length: 46, rect: [8,112 383.53125x17.46875]
+ "consectetur nulla malesuada. Sed pellentesque,"
+ line 7 width: 344.8125, height: 17.75, bottom: 140.03125, baseline: 13.53125
+ frag 0 from TextNode start: 321, length: 47, rect: [8,130 344.8125x17.46875]
+ "elit sit amet sollicitudin sollicitudin, lectus"
+ line 8 width: 374.703125, height: 18.21875, bottom: 157.96875, baseline: 13.53125
+ frag 0 from TextNode start: 369, length: 46, rect: [8,147 374.703125x17.46875]
+ "justo facilisis lacus, ac vehicula metus neque"
+ line 9 width: 384.125, height: 17.6875, bottom: 174.90625, baseline: 13.53125
+ frag 0 from TextNode start: 416, length: 45, rect: [8,165 384.125x17.46875]
+ "ac mi. In in augue et massa maximus venenatis"
+ line 10 width: 373.25, height: 18.15625, bottom: 192.84375, baseline: 13.53125
+ frag 0 from TextNode start: 462, length: 44, rect: [8,182 373.25x17.46875]
+ "auctor fermentum dui. Aliquam dictum finibus"
+ line 11 width: 288.203125, height: 17.625, bottom: 209.78125, baseline: 13.53125
+ frag 0 from TextNode start: 507, length: 35, rect: [8,200 288.203125x17.46875]
+ "urna, quis lacinia massa laoreet a."
+ line 12 width: 316.296875, height: 18.09375, bottom: 227.71875, baseline: 13.53125
+ frag 0 from TextNode start: 543, length: 36, rect: [8,217 316.296875x17.46875]
+ "Suspendisse elementum non lectus nec"
+ line 13 width: 388.78125, height: 17.5625, bottom: 244.65625, baseline: 13.53125
+ frag 0 from TextNode start: 580, length: 48, rect: [8,235 388.78125x17.46875]
+ "elementum. Quisque ultricies suscipit porttitor."
+ line 14 width: 373.828125, height: 18.03125, bottom: 262.59375, baseline: 13.53125
+ frag 0 from TextNode start: 629, length: 45, rect: [8,252 373.828125x17.46875]
+ "Sed non urna rutrum, mattis nulla at, feugiat"
+ line 15 width: 368.75, height: 17.5, bottom: 279.53125, baseline: 13.53125
+ frag 0 from TextNode start: 675, length: 48, rect: [8,270 368.75x17.46875]
+ "erat. Duis orci elit, vehicula sed blandit eget,"
+ line 16 width: 390.625, height: 17.96875, bottom: 297.46875, baseline: 13.53125
+ frag 0 from TextNode start: 724, length: 46, rect: [8,287 390.625x17.46875]
+ "auctor in arcu. Ut cursus magna sit amet nulla"
+ line 17 width: 294.90625, height: 18.4375, bottom: 315.40625, baseline: 13.53125
+ frag 0 from TextNode start: 771, length: 36, rect: [8,304 294.90625x17.46875]
+ "cursus, vitae gravida mauris dictum."
+ TextNode <#text>
+ BlockContainer <(anonymous)> at (8,8) content-size 0x0 [BFC] children: inline
+ TextNode <#text>
diff --git a/Tests/LibWeb/Layout/expected/grid/row-span-2-mincontent.txt b/Tests/LibWeb/Layout/expected/grid/row-span-2-mincontent.txt
new file mode 100644
index 000000000000..40e0c2cac953
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/grid/row-span-2-mincontent.txt
@@ -0,0 +1,186 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
+ BlockContainer <body> at (8,8) content-size 784x560.0625 children: not-inline
+ Box <div.grid-container> at (8,8) content-size 784x560.0625 [GFC] children: not-inline
+ BlockContainer <(anonymous)> at (8,8) content-size 0x0 [BFC] children: inline
+ TextNode <#text>
+ BlockContainer <div.grid-item.item-span-one-one> at (108.640625,8) content-size 101.515625x244.65625 [BFC] children: inline
+ line 0 width: 31.546875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 1, length: 4, rect: [108.640625,8 31.546875x17.46875]
+ "In a"
+ line 1 width: 84.84375, height: 17.9375, bottom: 35.40625, baseline: 13.53125
+ frag 0 from TextNode start: 6, length: 12, rect: [108.640625,25 84.84375x17.46875]
+ "sollicitudin"
+ line 2 width: 86.046875, height: 18.40625, bottom: 53.34375, baseline: 13.53125
+ frag 0 from TextNode start: 19, length: 10, rect: [108.640625,42 86.046875x17.46875]
+ "augue. Sed"
+ line 3 width: 92.734375, height: 17.875, bottom: 70.28125, baseline: 13.53125
+ frag 0 from TextNode start: 30, length: 11, rect: [108.640625,60 92.734375x17.46875]
+ "ante augue,"
+ line 4 width: 101.3125, height: 18.34375, bottom: 88.21875, baseline: 13.53125
+ frag 0 from TextNode start: 42, length: 11, rect: [108.640625,77 101.3125x17.46875]
+ "rhoncus nec"
+ line 5 width: 98.40625, height: 17.8125, bottom: 105.15625, baseline: 13.53125
+ frag 0 from TextNode start: 54, length: 13, rect: [108.640625,95 98.40625x17.46875]
+ "porttitor id,"
+ line 6 width: 74.125, height: 18.28125, bottom: 123.09375, baseline: 13.53125
+ frag 0 from TextNode start: 68, length: 10, rect: [108.640625,112 74.125x17.46875]
+ "lacinia et"
+ line 7 width: 37.28125, height: 17.75, bottom: 140.03125, baseline: 13.53125
+ frag 0 from TextNode start: 79, length: 5, rect: [108.640625,130 37.28125x17.46875]
+ "nibh."
+ line 8 width: 101.515625, height: 18.21875, bottom: 157.96875, baseline: 13.53125
+ frag 0 from TextNode start: 85, length: 12, rect: [108.640625,147 101.515625x17.46875]
+ "Pellentesque"
+ line 9 width: 93.1875, height: 17.6875, bottom: 174.90625, baseline: 13.53125
+ frag 0 from TextNode start: 98, length: 12, rect: [108.640625,165 93.1875x17.46875]
+ "diam libero,"
+ line 10 width: 101.0625, height: 18.15625, bottom: 192.84375, baseline: 13.53125
+ frag 0 from TextNode start: 111, length: 13, rect: [108.640625,182 101.0625x17.46875]
+ "ultrices eget"
+ line 11 width: 88.109375, height: 17.625, bottom: 209.78125, baseline: 13.53125
+ frag 0 from TextNode start: 125, length: 12, rect: [108.640625,200 88.109375x17.46875]
+ "eleifend at,"
+ line 12 width: 83.953125, height: 18.09375, bottom: 227.71875, baseline: 13.53125
+ frag 0 from TextNode start: 138, length: 9, rect: [108.640625,217 83.953125x17.46875]
+ "consequat"
+ line 13 width: 61.609375, height: 17.5625, bottom: 244.65625, baseline: 13.53125
+ frag 0 from TextNode start: 148, length: 8, rect: [108.640625,235 61.609375x17.46875]
+ "ut orci."
+ TextNode <#text>
+ BlockContainer <(anonymous)> at (8,8) content-size 0x0 [BFC] children: inline
+ TextNode <#text>
+ BlockContainer <div.grid-item.item-span-one-two> at (108.640625,252.65625) content-size 101.515625x315.40625 [BFC] children: inline
+ line 0 width: 98.65625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 1, length: 11, rect: [108.640625,252.65625 98.65625x17.46875]
+ "Suspendisse"
+ line 1 width: 60.734375, height: 17.9375, bottom: 35.40625, baseline: 13.53125
+ frag 0 from TextNode start: 13, length: 8, rect: [108.640625,269.65625 60.734375x17.46875]
+ "potenti."
+ line 2 width: 101.515625, height: 18.40625, bottom: 53.34375, baseline: 13.53125
+ frag 0 from TextNode start: 22, length: 12, rect: [108.640625,286.65625 101.515625x17.46875]
+ "Pellentesque"
+ line 3 width: 74.25, height: 17.875, bottom: 70.28125, baseline: 13.53125
+ frag 0 from TextNode start: 35, length: 9, rect: [108.640625,304.65625 74.25x17.46875]
+ "at varius"
+ line 4 width: 80.546875, height: 18.34375, bottom: 88.21875, baseline: 13.53125
+ frag 0 from TextNode start: 45, length: 10, rect: [108.640625,321.65625 80.546875x17.46875]
+ "lacus, sed"
+ line 5 width: 84.84375, height: 17.8125, bottom: 105.15625, baseline: 13.53125
+ frag 0 from TextNode start: 56, length: 12, rect: [108.640625,339.65625 84.84375x17.46875]
+ "sollicitudin"
+ line 6 width: 27.65625, height: 18.28125, bottom: 123.09375, baseline: 13.53125
+ frag 0 from TextNode start: 69, length: 4, rect: [108.640625,356.65625 27.65625x17.46875]
+ "leo."
+ line 7 width: 101.515625, height: 17.75, bottom: 140.03125, baseline: 13.53125
+ frag 0 from TextNode start: 74, length: 12, rect: [108.640625,374.65625 101.515625x17.46875]
+ "Pellentesque"
+ line 8 width: 80.15625, height: 18.21875, bottom: 157.96875, baseline: 13.53125
+ frag 0 from TextNode start: 87, length: 9, rect: [108.640625,391.65625 80.15625x17.46875]
+ "malesuada"
+ line 9 width: 56.625, height: 17.6875, bottom: 174.90625, baseline: 13.53125
+ frag 0 from TextNode start: 97, length: 7, rect: [108.640625,409.65625 56.625x17.46875]
+ "mi eget"
+ line 10 width: 99.40625, height: 18.15625, bottom: 192.84375, baseline: 13.53125
+ frag 0 from TextNode start: 105, length: 12, rect: [108.640625,426.65625 99.40625x17.46875]
+ "pellentesque"
+ line 11 width: 60.734375, height: 17.625, bottom: 209.78125, baseline: 13.53125
+ frag 0 from TextNode start: 118, length: 7, rect: [108.640625,444.65625 60.734375x17.46875]
+ "tempor."
+ line 12 width: 48.71875, height: 18.09375, bottom: 227.71875, baseline: 13.53125
+ frag 0 from TextNode start: 126, length: 5, rect: [108.640625,461.65625 48.71875x17.46875]
+ "Donec"
+ line 13 width: 59.890625, height: 17.5625, bottom: 244.65625, baseline: 13.53125
+ frag 0 from TextNode start: 132, length: 7, rect: [108.640625,479.65625 59.890625x17.46875]
+ "egestas"
+ line 14 width: 92.015625, height: 18.03125, bottom: 262.59375, baseline: 13.53125
+ frag 0 from TextNode start: 140, length: 11, rect: [108.640625,496.65625 92.015625x17.46875]
+ "mauris est,"
+ line 15 width: 88.640625, height: 17.5, bottom: 279.53125, baseline: 13.53125
+ frag 0 from TextNode start: 152, length: 11, rect: [108.640625,514.65625 88.640625x17.46875]
+ "ut lobortis"
+ line 16 width: 84.9375, height: 17.96875, bottom: 297.46875, baseline: 13.53125
+ frag 0 from TextNode start: 164, length: 11, rect: [108.640625,531.65625 84.9375x17.46875]
+ "nisi luctus"
+ line 17 width: 20.546875, height: 18.4375, bottom: 315.40625, baseline: 13.53125
+ frag 0 from TextNode start: 176, length: 3, rect: [108.640625,548.65625 20.546875x17.46875]
+ "at."
+ TextNode <#text>
+ BlockContainer <(anonymous)> at (8,8) content-size 0x0 [BFC] children: inline
+ TextNode <#text>
+ BlockContainer <div.grid-item.item-span-two> at (8,8) content-size 100.640625x560.0625 [BFC] children: inline
+ line 0 width: 50.96875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 1, length: 5, rect: [8,8 50.96875x17.46875]
+ "Lorem"
+ line 1 width: 94.9375, height: 17.9375, bottom: 35.40625, baseline: 13.53125
+ frag 0 from TextNode start: 7, length: 11, rect: [8,25 94.9375x17.46875]
+ "ipsum dolor"
+ line 2 width: 70.9375, height: 18.40625, bottom: 53.34375, baseline: 13.53125
+ frag 0 from TextNode start: 19, length: 9, rect: [8,42 70.9375x17.46875]
+ "sit amet,"
+ line 3 width: 96.84375, height: 17.875, bottom: 70.28125, baseline: 13.53125
+ frag 0 from TextNode start: 29, length: 11, rect: [8,60 96.84375x17.46875]
+ "consectetur"
+ line 4 width: 75.71875, height: 18.34375, bottom: 88.21875, baseline: 13.53125
+ frag 0 from TextNode start: 41, length: 10, rect: [8,77 75.71875x17.46875]
+ "adipiscing"
+ line 5 width: 65.265625, height: 17.8125, bottom: 105.15625, baseline: 13.53125
+ frag 0 from TextNode start: 52, length: 9, rect: [8,95 65.265625x17.46875]
+ "elit. Sed"
+ line 6 width: 37.6875, height: 18.28125, bottom: 123.09375, baseline: 13.53125
+ frag 0 from TextNode start: 62, length: 5, rect: [8,112 37.6875x17.46875]
+ "vitae"
+ line 7 width: 100.640625, height: 17.75, bottom: 140.03125, baseline: 13.53125
+ frag 0 from TextNode start: 68, length: 11, rect: [8,130 100.640625x17.46875]
+ "condimentum"
+ line 8 width: 65.03125, height: 18.21875, bottom: 157.96875, baseline: 13.53125
+ frag 0 from TextNode start: 80, length: 8, rect: [8,147 65.03125x17.46875]
+ "erat, ac"
+ line 9 width: 65.15625, height: 17.6875, bottom: 174.90625, baseline: 13.53125
+ frag 0 from TextNode start: 89, length: 7, rect: [8,165 65.15625x17.46875]
+ "posuere"
+ line 10 width: 41.171875, height: 18.15625, bottom: 192.84375, baseline: 13.53125
+ frag 0 from TextNode start: 97, length: 5, rect: [8,182 41.171875x17.46875]
+ "arcu."
+ line 11 width: 60.265625, height: 17.625, bottom: 209.78125, baseline: 13.53125
+ frag 0 from TextNode start: 103, length: 6, rect: [8,200 60.265625x17.46875]
+ "Aenean"
+ line 12 width: 93.34375, height: 18.09375, bottom: 227.71875, baseline: 13.53125
+ frag 0 from TextNode start: 110, length: 12, rect: [8,217 93.34375x17.46875]
+ "tincidunt mi"
+ line 13 width: 73.90625, height: 17.5625, bottom: 244.65625, baseline: 13.53125
+ frag 0 from TextNode start: 123, length: 11, rect: [8,235 73.90625x17.46875]
+ "ligula, vel"
+ line 14 width: 57.234375, height: 18.03125, bottom: 262.59375, baseline: 13.53125
+ frag 0 from TextNode start: 135, length: 6, rect: [8,252 57.234375x17.46875]
+ "semper"
+ line 15 width: 41.640625, height: 17.5, bottom: 279.53125, baseline: 13.53125
+ frag 0 from TextNode start: 142, length: 5, rect: [8,270 41.640625x17.46875]
+ "dolor"
+ line 16 width: 83.09375, height: 17.96875, bottom: 297.46875, baseline: 13.53125
+ frag 0 from TextNode start: 148, length: 11, rect: [8,287 83.09375x17.46875]
+ "aliquet at."
+ line 17 width: 75.8125, height: 18.4375, bottom: 315.40625, baseline: 13.53125
+ frag 0 from TextNode start: 160, length: 9, rect: [8,304 75.8125x17.46875]
+ "Phasellus"
+ line 18 width: 92.1875, height: 17.90625, bottom: 332.34375, baseline: 13.53125
+ frag 0 from TextNode start: 170, length: 11, rect: [8,322 92.1875x17.46875]
+ "scelerisque"
+ line 19 width: 59.765625, height: 18.375, bottom: 350.28125, baseline: 13.53125
+ frag 0 from TextNode start: 182, length: 7, rect: [8,339 59.765625x17.46875]
+ "dapibus"
+ line 20 width: 67.890625, height: 17.84375, bottom: 367.21875, baseline: 13.53125
+ frag 0 from TextNode start: 190, length: 8, rect: [8,357 67.890625x17.46875]
+ "diam sed"
+ line 21 width: 70.4375, height: 18.3125, bottom: 385.15625, baseline: 13.53125
+ frag 0 from TextNode start: 199, length: 8, rect: [8,374 70.4375x17.46875]
+ "rhoncus."
+ line 22 width: 78.8125, height: 17.78125, bottom: 402.09375, baseline: 13.53125
+ frag 0 from TextNode start: 208, length: 9, rect: [8,392 78.8125x17.46875]
+ "Proin sed"
+ line 23 width: 68.296875, height: 18.25, bottom: 420.03125, baseline: 13.53125
+ frag 0 from TextNode start: 218, length: 9, rect: [8,409 68.296875x17.46875]
+ "orci leo."
+ TextNode <#text>
+ BlockContainer <(anonymous)> at (8,8) content-size 0x0 [BFC] children: inline
+ TextNode <#text>
diff --git a/Tests/LibWeb/Layout/input/grid/row-span-2-maxcontent.html b/Tests/LibWeb/Layout/input/grid/row-span-2-maxcontent.html
new file mode 100644
index 000000000000..b564ca8e4290
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/row-span-2-maxcontent.html
@@ -0,0 +1,53 @@
+<style>
+.grid-container {
+ display: grid;
+ grid-template-columns: auto auto;
+ grid-template-rows: max-content max-content;
+}
+
+.item-span-one-one {
+ background-color: lightpink;
+ grid-row: 1 / span 1;
+ grid-column: 2;
+}
+
+.item-span-one-two {
+ background-color: lightgreen;
+ grid-row: 2 / span 1;
+ grid-column: 2;
+}
+
+.item-span-two {
+ background-color: lightskyblue;
+ grid-row: 1 / span 2;
+ grid-column: 1;
+}
+</style>
+<div class="grid-container">
+<div class="grid-item item-span-one-one">
+In a sollicitudin augue. Sed ante augue, rhoncus nec porttitor id,
+lacinia et nibh. Pellentesque diam libero, ultrices eget eleifend at,
+consequat ut orci.
+</div>
+<div class="grid-item item-span-one-two">
+Suspendisse potenti. Pellentesque at varius lacus, sed sollicitudin leo.
+Pellentesque malesuada mi eget pellentesque tempor. Donec egestas mauris
+est, ut lobortis nisi luctus at. Vivamus eleifend, lorem vulputate
+maximus porta, nunc metus porttitor nibh, nec bibendum nulla lectus ut
+felis.
+</div>
+<div class="grid-item item-span-two">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae
+condimentum erat, ac posuere arcu. Aenean tincidunt mi ligula, vel
+semper dolor aliquet at. Phasellus scelerisque dapibus diam sed rhoncus.
+Proin sed orci leo. Praesent pellentesque mi eu nunc gravida, vel
+consectetur nulla malesuada. Sed pellentesque, elit sit amet
+sollicitudin sollicitudin, lectus justo facilisis lacus, ac vehicula
+metus neque ac mi. In in augue et massa maximus venenatis auctor
+fermentum dui. Aliquam dictum finibus urna, quis lacinia massa laoreet
+a. Suspendisse elementum non lectus nec elementum. Quisque ultricies
+suscipit porttitor. Sed non urna rutrum, mattis nulla at, feugiat erat.
+Duis orci elit, vehicula sed blandit eget, auctor in arcu. Ut cursus
+magna sit amet nulla cursus, vitae gravida mauris dictum.
+</div>
+</div>
\ No newline at end of file
diff --git a/Tests/LibWeb/Layout/input/grid/row-span-2-mincontent.html b/Tests/LibWeb/Layout/input/grid/row-span-2-mincontent.html
new file mode 100644
index 000000000000..c4e9d67f0d82
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/grid/row-span-2-mincontent.html
@@ -0,0 +1,43 @@
+<style>
+.grid-container {
+ display: grid;
+ grid-template-columns: min-content min-content;
+ grid-template-rows: min-content min-content;
+}
+
+.item-span-one-one {
+ background-color: lightpink;
+ grid-row: 1 / span 1;
+ grid-column: 2;
+}
+
+.item-span-one-two {
+ background-color: lightgreen;
+ grid-row: 2 / span 1;
+ grid-column: 2;
+}
+
+.item-span-two {
+ background-color: lightskyblue;
+ grid-row: 1 / span 2;
+ grid-column: 1;
+}
+</style>
+<div class="grid-container">
+<div class="grid-item item-span-one-one">
+In a sollicitudin augue. Sed ante augue, rhoncus nec porttitor id,
+lacinia et nibh. Pellentesque diam libero, ultrices eget eleifend at,
+consequat ut orci.
+</div>
+<div class="grid-item item-span-one-two">
+Suspendisse potenti. Pellentesque at varius lacus, sed sollicitudin leo.
+Pellentesque malesuada mi eget pellentesque tempor. Donec egestas mauris
+est, ut lobortis nisi luctus at.
+</div>
+<div class="grid-item item-span-two">
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vitae
+condimentum erat, ac posuere arcu. Aenean tincidunt mi ligula, vel
+semper dolor aliquet at. Phasellus scelerisque dapibus diam sed rhoncus.
+Proin sed orci leo.
+</div>
+</div>
\ No newline at end of file
diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
index 3845f93c4922..97f13e788ec8 100644
--- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.cpp
@@ -847,7 +847,7 @@ void GridFormattingContext::resolve_intrinsic_track_sizes(AvailableSpace const&
for (auto& item : m_grid_items)
max_item_span = max(item.span(dimension), max_item_span);
for (size_t span = 2; span <= max_item_span; span++) {
- increase_sizes_to_accommodate_spanning_items_crossing_content_sized_tracks(dimension, 2);
+ increase_sizes_to_accommodate_spanning_items_crossing_content_sized_tracks(available_space, dimension, 2);
}
// 4. Increase sizes to accommodate spanning items crossing flexible tracks: Next, repeat the previous
@@ -862,17 +862,12 @@ void GridFormattingContext::resolve_intrinsic_track_sizes(AvailableSpace const&
track.growth_limit = track.base_size;
}
}
-
- for (auto& track : tracks_and_gaps)
- track.has_definite_base_size = true;
}
-void GridFormattingContext::distribute_extra_space_across_spanned_tracks(CSSPixels item_size_contribution, Vector<TemporaryTrack&>& spanned_tracks)
+void GridFormattingContext::distribute_extra_space_across_spanned_tracks_base_size(CSSPixels item_size_contribution, Vector<TemporaryTrack&>& spanned_tracks)
{
- for (auto& track : spanned_tracks) {
- track.planned_increase = 0;
+ for (auto& track : spanned_tracks)
track.item_incurred_increase = 0;
- }
// 1. Find the space to distribute:
CSSPixels spanned_tracks_sizes_sum = 0;
@@ -884,8 +879,10 @@ void GridFormattingContext::distribute_extra_space_across_spanned_tracks(CSSPixe
auto extra_space = max(CSSPixels(0), item_size_contribution - spanned_tracks_sizes_sum);
// 2. Distribute space up to limits:
- while (extra_space > 0) {
- auto all_frozen = all_of(spanned_tracks, [](auto const& track) { return track.frozen; });
+ // FIXME: If a fixed-point type were used to represent CSS pixels, it would be possible to compare with 0
+ // instead of epsilon.
+ while (extra_space > NumericLimits<float>().epsilon()) {
+ auto all_frozen = all_of(spanned_tracks, [](auto const& track) { return track.base_size_frozen; });
if (all_frozen)
break;
@@ -894,11 +891,11 @@ void GridFormattingContext::distribute_extra_space_across_spanned_tracks(CSSPixe
// increase reaches its limit
CSSPixels increase_per_track = extra_space / spanned_tracks.size();
for (auto& track : spanned_tracks) {
- if (track.frozen)
+ if (track.base_size_frozen)
continue;
if (increase_per_track >= track.growth_limit) {
- track.frozen = true;
+ track.base_size_frozen = true;
track.item_incurred_increase = track.growth_limit;
extra_space -= track.growth_limit;
} else {
@@ -918,8 +915,68 @@ void GridFormattingContext::distribute_extra_space_across_spanned_tracks(CSSPixe
}
}
-void GridFormattingContext::increase_sizes_to_accommodate_spanning_items_crossing_content_sized_tracks(GridDimension const dimension, size_t span)
+void GridFormattingContext::distribute_extra_space_across_spanned_tracks_growth_limit(CSSPixels item_size_contribution, Vector<TemporaryTrack&>& spanned_tracks)
+{
+ for (auto& track : spanned_tracks)
+ track.item_incurred_increase = 0;
+
+ // 1. Find the space to distribute:
+ CSSPixels spanned_tracks_sizes_sum = 0;
+ for (auto& track : spanned_tracks) {
+ if (track.growth_limit != INFINITY) {
+ spanned_tracks_sizes_sum += track.growth_limit;
+ } else {
+ spanned_tracks_sizes_sum += track.base_size;
+ }
+ }
+
+ // Subtract the corresponding size of every spanned track from the item’s size contribution to find the item’s
+ // remaining size contribution.
+ auto extra_space = max(CSSPixels(0), item_size_contribution - spanned_tracks_sizes_sum);
+
+ // 2. Distribute space up to limits:
+ // FIXME: If a fixed-point type were used to represent CSS pixels, it would be possible to compare with 0
+ // instead of epsilon.
+ while (extra_space > NumericLimits<float>().epsilon()) {
+ auto all_frozen = all_of(spanned_tracks, [](auto const& track) { return track.growth_limit_frozen; });
+ if (all_frozen)
+ break;
+
+ // Find the item-incurred increase for each spanned track with an affected size by: distributing the space
+ // equally among such tracks, freezing a track’s item-incurred increase as its affected size + item-incurred
+ // increase reaches its limit
+ CSSPixels increase_per_track = extra_space / spanned_tracks.size();
+ for (auto& track : spanned_tracks) {
+ if (track.growth_limit_frozen)
+ continue;
+
+ // For growth limits, the limit is infinity if it is marked as infinitely growable, and equal to the
+ // growth limit otherwise.
+ auto limit = track.infinitely_growable ? INFINITY : track.growth_limit;
+ if (increase_per_track >= limit) {
+ track.growth_limit_frozen = true;
+ track.item_incurred_increase = limit;
+ extra_space -= limit;
+ } else {
+ track.item_incurred_increase += increase_per_track;
+ extra_space -= increase_per_track;
+ }
+ }
+ }
+
+ // FIXME: 3. Distribute space beyond limits
+
+ // 4. For each affected track, if the track’s item-incurred increase is larger than the track’s planned increase
+ // set the track’s planned increase to that value.
+ for (auto& track : spanned_tracks) {
+ if (track.item_incurred_increase > track.planned_increase)
+ track.planned_increase = track.item_incurred_increase;
+ }
+}
+
+void GridFormattingContext::increase_sizes_to_accommodate_spanning_items_crossing_content_sized_tracks(AvailableSpace const& available_space, GridDimension const dimension, size_t span)
{
+ auto& available_size = dimension == GridDimension::Column ? available_space.width : available_space.height;
auto& tracks = dimension == GridDimension::Column ? m_grid_columns : m_grid_rows;
for (auto& item : m_grid_items) {
auto const item_span = item.span(dimension);
@@ -944,11 +1001,51 @@ void GridFormattingContext::increase_sizes_to_accommodate_spanning_items_crossin
if (track.min_track_sizing_function.is_intrinsic_track_sizing())
intrinsic_minimum_spanned_tracks.append(track);
}
- auto item_minimum_contribution = calculate_minimum_contribution(item, dimension);
- distribute_extra_space_across_spanned_tracks(item_minimum_contribution, intrinsic_minimum_spanned_tracks);
+ auto item_size_contribution = [&] {
+ // If the grid container is being sized under a min- or max-content constraint, use the items’ limited
+ // min-content contributions in place of their minimum contributions here.
+ if (available_size.is_intrinsic_sizing_constraint())
+ return calculate_limited_min_content_contribution(item, dimension);
+ return calculate_minimum_contribution(item, dimension);
+ }();
+ distribute_extra_space_across_spanned_tracks_base_size(item_size_contribution, intrinsic_minimum_spanned_tracks);
+ for (auto& track : spanned_tracks) {
+ track.base_size += track.planned_increase;
+ track.planned_increase = 0;
+ }
+ // 2. For content-based minimums: Next continue to increase the base size of tracks with a min track
+ // sizing function of min-content or max-content by distributing extra space as needed to account for
+ // these items' min-content contributions.
+ Vector<TemporaryTrack&> content_based_minimum_tracks;
+ for (auto& track : spanned_tracks) {
+ if (track.min_track_sizing_function.is_min_content() || track.min_track_sizing_function.is_max_content()) {
+ content_based_minimum_tracks.append(track);
+ }
+ }
+ auto item_min_content_contribution = calculate_min_content_contribution(item, dimension);
+ distribute_extra_space_across_spanned_tracks_base_size(item_min_content_contribution, content_based_minimum_tracks);
for (auto& track : spanned_tracks) {
track.base_size += track.planned_increase;
+ track.planned_increase = 0;
+ }
+
+ // 3. For max-content minimums: Next, if the grid container is being sized under a max-content constraint,
+ // continue to increase the base size of tracks with a min track sizing function of auto or max-content by
+ // distributing extra space as needed to account for these items' limited max-content contributions.
+ if (available_size.is_max_content()) {
+ Vector<TemporaryTrack&> max_content_minimum_tracks;
+ for (auto& track : spanned_tracks) {
+ if (track.min_track_sizing_function.is_auto() || track.min_track_sizing_function.is_max_content()) {
+ max_content_minimum_tracks.append(track);
+ }
+ }
+ auto item_limited_max_content_contribution = calculate_limited_max_content_contribution(item, dimension);
+ distribute_extra_space_across_spanned_tracks_base_size(item_limited_max_content_contribution, max_content_minimum_tracks);
+ for (auto& track : spanned_tracks) {
+ track.base_size += track.planned_increase;
+ track.planned_increase = 0;
+ }
}
// 4. If at this point any track’s growth limit is now less than its base size, increase its growth limit to
@@ -957,6 +1054,49 @@ void GridFormattingContext::increase_sizes_to_accommodate_spanning_items_crossin
if (track.growth_limit < track.base_size)
track.growth_limit = track.base_size;
}
+
+ // 5. For intrinsic maximums: Next increase the growth limit of tracks with an intrinsic max track sizing
+ Vector<TemporaryTrack&> intrinsic_maximum_tracks;
+ for (auto& track : spanned_tracks) {
+ if (track.max_track_sizing_function.is_intrinsic_track_sizing()) {
+ intrinsic_maximum_tracks.append(track);
+ }
+ }
+ distribute_extra_space_across_spanned_tracks_growth_limit(item_min_content_contribution, intrinsic_maximum_tracks);
+ for (auto& track : spanned_tracks) {
+ if (track.growth_limit == INFINITY) {
+ // If the affected size is an infinite growth limit, set it to the track’s base size plus the planned increase.
+ track.growth_limit = track.base_size + track.planned_increase;
+ // Mark any tracks whose growth limit changed from infinite to finite in this step as infinitely growable
+ // for the next step.
+ track.infinitely_growable = true;
+ } else {
+ track.growth_limit += track.planned_increase;
+ }
+ track.planned_increase = 0;
+ }
+
+ // 6. For max-content maximums: Lastly continue to increase the growth limit of tracks with a max track
+ // sizing function of max-content by distributing extra space as needed to account for these items' max-
+ // content contributions.
+ Vector<TemporaryTrack&> max_content_maximum_tracks;
+ for (auto& track : spanned_tracks) {
+ if (track.max_track_sizing_function.is_max_content() || track.max_track_sizing_function.is_auto()) {
+ max_content_maximum_tracks.append(track);
+ }
+ }
+
+ auto item_max_content_contribution = calculate_max_content_contribution(item, dimension);
+ distribute_extra_space_across_spanned_tracks_growth_limit(item_max_content_contribution, max_content_maximum_tracks);
+ for (auto& track : spanned_tracks) {
+ if (track.growth_limit == INFINITY) {
+ // If the affected size is an infinite growth limit, set it to the track’s base size plus the planned increase.
+ track.growth_limit = track.base_size + track.planned_increase;
+ } else {
+ track.growth_limit += track.planned_increase;
+ }
+ track.planned_increase = 0;
+ }
}
}
@@ -983,7 +1123,7 @@ void GridFormattingContext::increase_sizes_to_accommodate_spanning_items_crossin
spanned_flexible_tracks.append(track);
}
auto item_minimum_contribution = automatic_minimum_size(item, dimension);
- distribute_extra_space_across_spanned_tracks(item_minimum_contribution, spanned_flexible_tracks);
+ distribute_extra_space_across_spanned_tracks_base_size(item_minimum_contribution, spanned_flexible_tracks);
for (auto& track : spanned_tracks) {
track.base_size += track.planned_increase;
diff --git a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.h b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.h
index 9e83854c8910..6d9502259088 100644
--- a/Userland/Libraries/LibWeb/Layout/GridFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/GridFormattingContext.h
@@ -104,13 +104,18 @@ class GridFormattingContext final : public FormattingContext {
struct TemporaryTrack {
CSS::GridSize min_track_sizing_function;
CSS::GridSize max_track_sizing_function;
+
CSSPixels base_size { 0 };
- bool has_definite_base_size { false };
+ bool base_size_frozen { false };
+
CSSPixels growth_limit { 0 };
+ bool growth_limit_frozen { false };
+ bool infinitely_growable { false };
+
CSSPixels space_to_distribute { 0 };
CSSPixels planned_increase { 0 };
CSSPixels item_incurred_increase { 0 };
- bool frozen { false };
+
bool is_gap { false };
TemporaryTrack(CSS::GridSize min_track_sizing_function, CSS::GridSize max_track_sizing_function)
@@ -216,8 +221,9 @@ class GridFormattingContext final : public FormattingContext {
void initialize_track_sizes(AvailableSpace const&, GridDimension const);
void resolve_intrinsic_track_sizes(AvailableSpace const&, GridDimension const);
- void distribute_extra_space_across_spanned_tracks(CSSPixels item_size_contribution, Vector<TemporaryTrack&>& spanned_tracks);
- void increase_sizes_to_accommodate_spanning_items_crossing_content_sized_tracks(GridDimension const, size_t span);
+ void distribute_extra_space_across_spanned_tracks_base_size(CSSPixels item_size_contribution, Vector<TemporaryTrack&>& spanned_tracks);
+ void distribute_extra_space_across_spanned_tracks_growth_limit(CSSPixels item_size_contribution, Vector<TemporaryTrack&>& spanned_tracks);
+ void increase_sizes_to_accommodate_spanning_items_crossing_content_sized_tracks(AvailableSpace const&, GridDimension const, size_t span);
void increase_sizes_to_accommodate_spanning_items_crossing_flexible_tracks(GridDimension const);
void maximize_tracks(AvailableSpace const&, GridDimension const);
void expand_flexible_tracks(AvailableSpace const&, GridDimension const);
|
fd5eb79d1959cbd4b43f624e3e0779e5dd5e0f17
|
2019-12-10 01:35:44
|
Andreas Kling
|
libgui: Make GMenu inherit from CObject
| false
|
Make GMenu inherit from CObject
|
libgui
|
diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp
index 5f3c463aa01c..b60252544d21 100644
--- a/Applications/Browser/main.cpp
+++ b/Applications/Browser/main.cpp
@@ -126,7 +126,7 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("Browser");
+ auto app_menu = GMenu::construct("Browser");
app_menu->add_action(GCommonActions::make_quit_action([&](auto&) {
app.quit();
}));
@@ -135,7 +135,7 @@ int main(int argc, char** argv)
RefPtr<GWindow> dom_inspector_window;
RefPtr<GTreeView> dom_tree_view;
- auto inspect_menu = make<GMenu>("Inspect");
+ auto inspect_menu = GMenu::construct("Inspect");
inspect_menu->add_action(GAction::create("View source", { Mod_Ctrl, Key_U }, [&](auto&) {
String filename_to_open;
char tmp_filename[] = "/tmp/view-source.XXXXXX";
@@ -176,7 +176,7 @@ int main(int argc, char** argv)
}));
menubar->add_menu(move(inspect_menu));
- auto debug_menu = make<GMenu>("Debug");
+ auto debug_menu = GMenu::construct("Debug");
debug_menu->add_action(GAction::create("Dump DOM tree", [&](auto&) {
dump_tree(*html_widget->document());
}));
@@ -199,7 +199,7 @@ int main(int argc, char** argv)
debug_menu->add_action(line_box_borders_action);
menubar->add_menu(move(debug_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("Browser", GraphicsBitmap::load_from_file("/res/icons/32x32/filetype-html.png"), window);
}));
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp
index ff84f6a7be16..ccbd71e0133a 100644
--- a/Applications/FileManager/main.cpp
+++ b/Applications/FileManager/main.cpp
@@ -322,7 +322,7 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("File Manager");
+ auto app_menu = GMenu::construct("File Manager");
app_menu->add_action(mkdir_action);
app_menu->add_action(copy_action);
app_menu->add_action(paste_action);
@@ -333,19 +333,19 @@ int main(int argc, char** argv)
}));
menubar->add_menu(move(app_menu));
- auto view_menu = make<GMenu>("View");
+ auto view_menu = GMenu::construct("View");
view_menu->add_action(*view_as_icons_action);
view_menu->add_action(*view_as_table_action);
menubar->add_menu(move(view_menu));
- auto go_menu = make<GMenu>("Go");
+ auto go_menu = GMenu::construct("Go");
go_menu->add_action(go_back_action);
go_menu->add_action(go_forward_action);
go_menu->add_action(open_parent_directory_action);
go_menu->add_action(go_home_action);
menubar->add_menu(move(go_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [](const GAction&) {
dbgprintf("FIXME: Implement Help/About\n");
}));
@@ -412,14 +412,14 @@ int main(int argc, char** argv)
}
});
- auto directory_context_menu = make<GMenu>();
+ auto directory_context_menu = GMenu::construct();
directory_context_menu->add_action(copy_action);
directory_context_menu->add_action(paste_action);
directory_context_menu->add_action(delete_action);
directory_context_menu->add_separator();
directory_context_menu->add_action(properties_action);
- auto file_context_menu = make<GMenu>();
+ auto file_context_menu = GMenu::construct();
file_context_menu->add_action(copy_action);
file_context_menu->add_action(paste_action);
file_context_menu->add_action(delete_action);
@@ -428,7 +428,7 @@ int main(int argc, char** argv)
file_context_menu->add_separator();
file_context_menu->add_action(properties_action);
- auto directory_view_context_menu = make<GMenu>();
+ auto directory_view_context_menu = GMenu::construct();
directory_view_context_menu->add_action(mkdir_action);
directory_view->on_context_menu_request = [&](const GAbstractView&, const GModelIndex& index, const GContextMenuEvent& event) {
diff --git a/Applications/Help/main.cpp b/Applications/Help/main.cpp
index 391bb7340143..e89625d211d2 100644
--- a/Applications/Help/main.cpp
+++ b/Applications/Help/main.cpp
@@ -129,7 +129,7 @@ int main(int argc, char* argv[])
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("Help");
+ auto app_menu = GMenu::construct("Help");
app_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("Help", load_png("/res/icons/16x16/book.png"), window);
}));
@@ -139,7 +139,7 @@ int main(int argc, char* argv[])
}));
menubar->add_menu(move(app_menu));
- auto go_menu = make<GMenu>("Go");
+ auto go_menu = GMenu::construct("Go");
go_menu->add_action(*go_back_action);
go_menu->add_action(*go_forward_action);
menubar->add_menu(move(go_menu));
diff --git a/Applications/HexEditor/HexEditorWidget.cpp b/Applications/HexEditor/HexEditorWidget.cpp
index ec4ff7d23e93..f38213a2c041 100644
--- a/Applications/HexEditor/HexEditorWidget.cpp
+++ b/Applications/HexEditor/HexEditorWidget.cpp
@@ -106,7 +106,7 @@ HexEditorWidget::HexEditorWidget()
});
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("Hex Editor");
+ auto app_menu = GMenu::construct("Hex Editor");
app_menu->add_action(*m_new_action);
app_menu->add_action(*m_open_action);
app_menu->add_action(*m_save_action);
@@ -119,7 +119,7 @@ HexEditorWidget::HexEditorWidget()
}));
menubar->add_menu(move(app_menu));
- auto bytes_per_row_menu = make<GMenu>("Bytes Per Row");
+ auto bytes_per_row_menu = GMenu::construct("Bytes Per Row");
for (int i = 8; i <= 32; i += 8) {
bytes_per_row_menu->add_action(GAction::create(String::number(i), [this, i](auto&) {
m_editor->set_bytes_per_row(i);
@@ -146,7 +146,7 @@ HexEditorWidget::HexEditorWidget()
}
});
- auto edit_menu = make<GMenu>("Edit");
+ auto edit_menu = GMenu::construct("Edit");
edit_menu->add_action(GAction::create("Fill selection...", [&](const GAction&) {
auto input_box = GInputBox::construct("Fill byte (hex):", "Fill Selection", this);
if (input_box->exec() == GInputBox::ExecOK && !input_box->text_value().is_empty()) {
@@ -170,11 +170,11 @@ HexEditorWidget::HexEditorWidget()
}));
menubar->add_menu(move(edit_menu));
- auto view_menu = make<GMenu>("View");
+ auto view_menu = GMenu::construct("View");
view_menu->add_submenu(move(bytes_per_row_menu));
menubar->add_menu(move(view_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("Hex Editor", load_png("/res/icons/32x32/app-hexeditor.png"), window());
}));
diff --git a/Applications/IRCClient/IRCAppWindow.cpp b/Applications/IRCClient/IRCAppWindow.cpp
index 35da44f912bc..a2671b50b3d4 100644
--- a/Applications/IRCClient/IRCAppWindow.cpp
+++ b/Applications/IRCClient/IRCAppWindow.cpp
@@ -123,7 +123,7 @@ void IRCAppWindow::setup_actions()
void IRCAppWindow::setup_menus()
{
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("IRC Client");
+ auto app_menu = GMenu::construct("IRC Client");
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
dbgprintf("Terminal: Quit menu activated!\n");
GApplication::the().quit(0);
@@ -131,7 +131,7 @@ void IRCAppWindow::setup_menus()
}));
menubar->add_menu(move(app_menu));
- auto server_menu = make<GMenu>("Server");
+ auto server_menu = GMenu::construct("Server");
server_menu->add_action(*m_change_nick_action);
server_menu->add_separator();
server_menu->add_action(*m_join_action);
@@ -142,7 +142,7 @@ void IRCAppWindow::setup_menus()
server_menu->add_action(*m_close_query_action);
menubar->add_menu(move(server_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [this](const GAction&) {
GAboutDialog::show("IRC Client", load_png("/res/icons/32x32/app-irc-client.png"), this);
}));
diff --git a/Applications/PaintBrush/EraseTool.cpp b/Applications/PaintBrush/EraseTool.cpp
index f9947edf6545..bc8324848784 100644
--- a/Applications/PaintBrush/EraseTool.cpp
+++ b/Applications/PaintBrush/EraseTool.cpp
@@ -48,7 +48,7 @@ void EraseTool::on_mousemove(GMouseEvent& event)
void EraseTool::on_contextmenu(GContextMenuEvent& event)
{
if (!m_context_menu) {
- m_context_menu = make<GMenu>();
+ m_context_menu = GMenu::construct();
NonnullRefPtr<GAction> eraser_color_toggler = GAction::create("Use secondary color", [&](GAction& action) {
bool toggled = !m_use_secondary_color;
diff --git a/Applications/PaintBrush/EraseTool.h b/Applications/PaintBrush/EraseTool.h
index b23844e0d764..d72f36841b2a 100644
--- a/Applications/PaintBrush/EraseTool.h
+++ b/Applications/PaintBrush/EraseTool.h
@@ -18,7 +18,7 @@ class EraseTool final : public Tool {
Color get_color() const;
virtual const char* class_name() const override { return "EraseTool"; }
Rect build_rect(const Point& pos, const Rect& widget_rect);
- OwnPtr<GMenu> m_context_menu;
+ RefPtr<GMenu> m_context_menu;
bool m_use_secondary_color { true };
int m_thickness { 1 };
diff --git a/Applications/PaintBrush/LineTool.cpp b/Applications/PaintBrush/LineTool.cpp
index e6c867ca32f4..03bc4761cda2 100644
--- a/Applications/PaintBrush/LineTool.cpp
+++ b/Applications/PaintBrush/LineTool.cpp
@@ -70,7 +70,7 @@ void LineTool::on_keydown(GKeyEvent& event)
void LineTool::on_contextmenu(GContextMenuEvent& event)
{
if (!m_context_menu) {
- m_context_menu = make<GMenu>();
+ m_context_menu = GMenu::construct();
m_context_menu->add_action(GAction::create("1", [this](auto&) {
m_thickness = 1;
}));
diff --git a/Applications/PaintBrush/LineTool.h b/Applications/PaintBrush/LineTool.h
index 4bfb589d280f..4c5920f54baa 100644
--- a/Applications/PaintBrush/LineTool.h
+++ b/Applications/PaintBrush/LineTool.h
@@ -23,6 +23,6 @@ class LineTool final : public Tool {
GMouseButton m_drawing_button { GMouseButton::None };
Point m_line_start_position;
Point m_line_end_position;
- OwnPtr<GMenu> m_context_menu;
+ RefPtr<GMenu> m_context_menu;
int m_thickness { 1 };
};
diff --git a/Applications/PaintBrush/PenTool.cpp b/Applications/PaintBrush/PenTool.cpp
index 33f1c300a18c..a9887bff2540 100644
--- a/Applications/PaintBrush/PenTool.cpp
+++ b/Applications/PaintBrush/PenTool.cpp
@@ -50,7 +50,7 @@ void PenTool::on_mousemove(GMouseEvent& event)
void PenTool::on_contextmenu(GContextMenuEvent& event)
{
if (!m_context_menu) {
- m_context_menu = make<GMenu>();
+ m_context_menu = GMenu::construct();
m_context_menu->add_action(GAction::create("1", [this](auto&) {
m_thickness = 1;
}));
diff --git a/Applications/PaintBrush/PenTool.h b/Applications/PaintBrush/PenTool.h
index 3020285e0978..686ebf9584bf 100644
--- a/Applications/PaintBrush/PenTool.h
+++ b/Applications/PaintBrush/PenTool.h
@@ -19,6 +19,6 @@ class PenTool final : public Tool {
virtual const char* class_name() const override { return "PenTool"; }
Point m_last_drawing_event_position { -1, -1 };
- OwnPtr<GMenu> m_context_menu;
+ RefPtr<GMenu> m_context_menu;
int m_thickness { 1 };
};
diff --git a/Applications/PaintBrush/SprayTool.cpp b/Applications/PaintBrush/SprayTool.cpp
index fb473fda0e60..6f359f8b4559 100644
--- a/Applications/PaintBrush/SprayTool.cpp
+++ b/Applications/PaintBrush/SprayTool.cpp
@@ -76,7 +76,7 @@ void SprayTool::on_mouseup(GMouseEvent&)
void SprayTool::on_contextmenu(GContextMenuEvent& event)
{
if (!m_context_menu) {
- m_context_menu = make<GMenu>();
+ m_context_menu = GMenu::construct();
m_context_menu->add_action(GAction::create("1", [this](auto&) {
m_thickness = 1;
}));
diff --git a/Applications/PaintBrush/SprayTool.h b/Applications/PaintBrush/SprayTool.h
index 7f75da7dcc97..efa2b170f483 100644
--- a/Applications/PaintBrush/SprayTool.h
+++ b/Applications/PaintBrush/SprayTool.h
@@ -22,6 +22,6 @@ class SprayTool final : public Tool {
RefPtr<CTimer> m_timer;
Point m_last_pos;
Color m_color;
- OwnPtr<GMenu> m_context_menu;
+ RefPtr<GMenu> m_context_menu;
int m_thickness { 1 };
};
diff --git a/Applications/PaintBrush/main.cpp b/Applications/PaintBrush/main.cpp
index 384a2b65d82c..571b7bf22484 100644
--- a/Applications/PaintBrush/main.cpp
+++ b/Applications/PaintBrush/main.cpp
@@ -39,7 +39,7 @@ int main(int argc, char** argv)
window->show();
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("PaintBrush");
+ auto app_menu = GMenu::construct("PaintBrush");
app_menu->add_action(GCommonActions::make_open_action([&](auto&) {
Optional<String> open_path = GFilePicker::get_open_filepath();
@@ -62,10 +62,10 @@ int main(int argc, char** argv)
menubar->add_menu(move(app_menu));
- auto edit_menu = make<GMenu>("Edit");
+ auto edit_menu = GMenu::construct("Edit");
menubar->add_menu(move(edit_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](auto&) {
GAboutDialog::show("PaintBrush", load_png("/res/icons/32x32/app-paintbrush.png"), window);
}));
diff --git a/Applications/Piano/main.cpp b/Applications/Piano/main.cpp
index 735ca214a4d3..15517403a38b 100644
--- a/Applications/Piano/main.cpp
+++ b/Applications/Piano/main.cpp
@@ -44,7 +44,7 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("Piano");
+ auto app_menu = GMenu::construct("Piano");
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
GApplication::the().quit(0);
return;
diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp
index e40c96b7803c..73bec79aac94 100644
--- a/Applications/QuickShow/main.cpp
+++ b/Applications/QuickShow/main.cpp
@@ -15,17 +15,17 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("QuickShow");
+ auto app_menu = GMenu::construct("QuickShow");
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
GApplication::the().quit(0);
return;
}));
menubar->add_menu(move(app_menu));
- auto file_menu = make<GMenu>("File");
+ auto file_menu = GMenu::construct("File");
menubar->add_menu(move(file_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [](const GAction&) {
dbgprintf("FIXME: Implement Help/About\n");
}));
diff --git a/Applications/SoundPlayer/main.cpp b/Applications/SoundPlayer/main.cpp
index 410b31fd8a69..51186c0f561c 100644
--- a/Applications/SoundPlayer/main.cpp
+++ b/Applications/SoundPlayer/main.cpp
@@ -24,7 +24,7 @@ int main(int argc, char** argv)
window->set_icon(GraphicsBitmap::load_from_file("/res/icons/16x16/app-sound-player.png"));
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("SoundPlayer");
+ auto app_menu = GMenu::construct("SoundPlayer");
auto player = SoundPlayerWidget::construct(window, audio_client);
if (argc > 1) {
@@ -51,7 +51,7 @@ int main(int argc, char** argv)
app.quit();
}));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [](auto&) {
GAboutDialog::show("SoundPlayer", GraphicsBitmap::load_from_file("/res/icons/32x32/app-sound-player.png"));
}));
diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp
index 4898fac21b83..c6c997b893ba 100644
--- a/Applications/SystemMonitor/main.cpp
+++ b/Applications/SystemMonitor/main.cpp
@@ -116,20 +116,20 @@ int main(int argc, char** argv)
window->set_main_widget(keeper);
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("System Monitor");
+ auto app_menu = GMenu::construct("System Monitor");
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
GApplication::the().quit(0);
return;
}));
menubar->add_menu(move(app_menu));
- auto process_menu = make<GMenu>("Process");
+ auto process_menu = GMenu::construct("Process");
process_menu->add_action(kill_action);
process_menu->add_action(stop_action);
process_menu->add_action(continue_action);
menubar->add_menu(move(process_menu));
- auto process_context_menu = make<GMenu>();
+ auto process_context_menu = GMenu::construct();
process_context_menu->add_action(kill_action);
process_context_menu->add_action(stop_action);
process_context_menu->add_action(continue_action);
@@ -138,7 +138,7 @@ int main(int argc, char** argv)
process_context_menu->popup(event.screen_position());
};
- auto frequency_menu = make<GMenu>("Frequency");
+ auto frequency_menu = GMenu::construct("Frequency");
frequency_menu->add_action(GAction::create("0.25 sec", [&](auto&) {
refresh_timer->restart(250);
}));
@@ -156,7 +156,7 @@ int main(int argc, char** argv)
}));
menubar->add_menu(move(frequency_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("SystemMonitor", load_png("/res/icons/32x32/app-system-monitor.png"), window);
}));
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp
index c1503ad1729d..17bd9dd2d033 100644
--- a/Applications/Terminal/main.cpp
+++ b/Applications/Terminal/main.cpp
@@ -195,7 +195,7 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("Terminal");
+ auto app_menu = GMenu::construct("Terminal");
app_menu->add_action(GAction::create("Open new terminal", { Mod_Ctrl | Mod_Shift, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/app-terminal.png"), [&](auto&) {
if (!fork()) {
execl("/bin/Terminal", "Terminal", nullptr);
@@ -221,12 +221,12 @@ int main(int argc, char** argv)
}));
menubar->add_menu(move(app_menu));
- auto edit_menu = make<GMenu>("Edit");
+ auto edit_menu = GMenu::construct("Edit");
edit_menu->add_action(terminal->copy_action());
edit_menu->add_action(terminal->paste_action());
menubar->add_menu(move(edit_menu));
- auto font_menu = make<GMenu>("Font");
+ auto font_menu = GMenu::construct("Font");
GFontDatabase::the().for_each_fixed_width_font([&](const StringView& font_name) {
font_menu->add_action(GAction::create(font_name, [&](const GAction& action) {
terminal->set_font(GFontDatabase::the().get_by_name(action.text()));
@@ -239,7 +239,7 @@ int main(int argc, char** argv)
});
menubar->add_menu(move(font_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("Terminal", load_png("/res/icons/32x32/app-terminal.png"), window);
}));
diff --git a/Applications/TextEditor/TextEditorWidget.cpp b/Applications/TextEditor/TextEditorWidget.cpp
index cc12a350f6fb..3a5beb999455 100644
--- a/Applications/TextEditor/TextEditorWidget.cpp
+++ b/Applications/TextEditor/TextEditorWidget.cpp
@@ -192,7 +192,7 @@ TextEditorWidget::TextEditorWidget()
m_line_wrapping_setting_action->set_checked(m_editor->is_line_wrapping_enabled());
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("Text Editor");
+ auto app_menu = GMenu::construct("Text Editor");
app_menu->add_action(*m_new_action);
app_menu->add_action(*m_open_action);
app_menu->add_action(*m_save_action);
@@ -205,7 +205,7 @@ TextEditorWidget::TextEditorWidget()
}));
menubar->add_menu(move(app_menu));
- auto edit_menu = make<GMenu>("Edit");
+ auto edit_menu = GMenu::construct("Edit");
edit_menu->add_action(m_editor->undo_action());
edit_menu->add_action(m_editor->redo_action());
edit_menu->add_separator();
@@ -219,7 +219,7 @@ TextEditorWidget::TextEditorWidget()
edit_menu->add_action(*m_find_previous_action);
menubar->add_menu(move(edit_menu));
- auto font_menu = make<GMenu>("Font");
+ auto font_menu = GMenu::construct("Font");
GFontDatabase::the().for_each_fixed_width_font([&](const StringView& font_name) {
font_menu->add_action(GAction::create(font_name, [this](const GAction& action) {
m_editor->set_font(GFontDatabase::the().get_by_name(action.text()));
@@ -227,13 +227,13 @@ TextEditorWidget::TextEditorWidget()
}));
});
- auto view_menu = make<GMenu>("View");
+ auto view_menu = GMenu::construct("View");
view_menu->add_action(*m_line_wrapping_setting_action);
view_menu->add_separator();
view_menu->add_submenu(move(font_menu));
menubar->add_menu(move(view_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("TextEditor", load_png("/res/icons/32x32/app-texteditor.png"), window());
}));
diff --git a/DevTools/HackStudio/main.cpp b/DevTools/HackStudio/main.cpp
index eb5ff776e32c..69fe4fa327d2 100644
--- a/DevTools/HackStudio/main.cpp
+++ b/DevTools/HackStudio/main.cpp
@@ -348,19 +348,19 @@ int main(int argc, char** argv)
});
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("HackStudio");
+ auto app_menu = GMenu::construct("HackStudio");
app_menu->add_action(save_action);
app_menu->add_action(GCommonActions::make_quit_action([&](auto&) {
app.quit();
}));
menubar->add_menu(move(app_menu));
- auto project_menu = make<GMenu>("Project");
+ auto project_menu = GMenu::construct("Project");
project_menu->add_action(new_action);
project_menu->add_action(add_existing_file_action);
menubar->add_menu(move(project_menu));
- auto edit_menu = make<GMenu>("Edit");
+ auto edit_menu = GMenu::construct("Edit");
edit_menu->add_action(GAction::create("Find in files...", { Mod_Ctrl | Mod_Shift, Key_F }, [&](auto&) {
reveal_action_tab(find_in_files_widget);
find_in_files_widget->focus_textbox_and_select_all();
@@ -391,13 +391,13 @@ int main(int argc, char** argv)
toolbar->add_action(run_action);
toolbar->add_action(stop_action);
- auto build_menu = make<GMenu>("Build");
+ auto build_menu = GMenu::construct("Build");
build_menu->add_action(build_action);
build_menu->add_action(run_action);
build_menu->add_action(stop_action);
menubar->add_menu(move(build_menu));
- auto view_menu = make<GMenu>("View");
+ auto view_menu = GMenu::construct("View");
view_menu->add_action(hide_action_tabs_action);
view_menu->add_action(open_locator_action);
view_menu->add_separator();
@@ -407,7 +407,7 @@ int main(int argc, char** argv)
auto small_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/app-hack-studio.png");
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](auto&) {
GAboutDialog::show("HackStudio", small_icon, g_window);
}));
diff --git a/DevTools/VisualBuilder/VBForm.cpp b/DevTools/VisualBuilder/VBForm.cpp
index cd0aad11def6..11a716fe05fe 100644
--- a/DevTools/VisualBuilder/VBForm.cpp
+++ b/DevTools/VisualBuilder/VBForm.cpp
@@ -28,7 +28,7 @@ VBForm::VBForm(const String& name, GWidget* parent)
set_background_color(Color::WarmGray);
set_greedy_for_hits(true);
- m_context_menu = make<GMenu>();
+ m_context_menu = GMenu::construct();
m_context_menu->add_action(GCommonActions::make_move_to_front_action([this](auto&) {
if (auto* widget = single_selected_widget())
widget->gwidget()->move_to_front();
diff --git a/DevTools/VisualBuilder/VBForm.h b/DevTools/VisualBuilder/VBForm.h
index a2c0a27f90fc..384b7509e8ef 100644
--- a/DevTools/VisualBuilder/VBForm.h
+++ b/DevTools/VisualBuilder/VBForm.h
@@ -61,5 +61,5 @@ class VBForm : public GWidget {
Point m_next_insertion_position;
Direction m_resize_direction { Direction::None };
Direction m_mouse_direction_type { Direction::None };
- OwnPtr<GMenu> m_context_menu;
+ RefPtr<GMenu> m_context_menu;
};
diff --git a/DevTools/VisualBuilder/main.cpp b/DevTools/VisualBuilder/main.cpp
index 3d96db1e510e..6647bae6fdc3 100644
--- a/DevTools/VisualBuilder/main.cpp
+++ b/DevTools/VisualBuilder/main.cpp
@@ -31,14 +31,14 @@ int main(int argc, char** argv)
};
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("Visual Builder");
+ auto app_menu = GMenu::construct("Visual Builder");
app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
GApplication::the().quit(0);
return;
}));
menubar->add_menu(move(app_menu));
- auto file_menu = make<GMenu>("File");
+ auto file_menu = GMenu::construct("File");
file_menu->add_action(GAction::create("Dump Form", [&](auto&) {
form1->dump();
}));
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
window->show();
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("Visual Builder", load_png("/res/icons/32x32/app-visual-builder.png"), window);
}));
diff --git a/Games/Minesweeper/main.cpp b/Games/Minesweeper/main.cpp
index 05ff8cc8bb12..80f4ad71c69f 100644
--- a/Games/Minesweeper/main.cpp
+++ b/Games/Minesweeper/main.cpp
@@ -46,7 +46,7 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("Minesweeper");
+ auto app_menu = GMenu::construct("Minesweeper");
app_menu->add_action(GAction::create("New game", { Mod_None, Key_F2 }, [&](const GAction&) {
field->reset();
@@ -73,7 +73,7 @@ int main(int argc, char** argv)
}));
menubar->add_menu(move(app_menu));
- auto difficulty_menu = make<GMenu>("Difficulty");
+ auto difficulty_menu = GMenu::construct("Difficulty");
difficulty_menu->add_action(GAction::create("Beginner", { Mod_Ctrl, Key_B }, [&](const GAction&) {
field->set_field_size(9, 9, 10);
}));
@@ -88,7 +88,7 @@ int main(int argc, char** argv)
}));
menubar->add_menu(move(difficulty_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [](const GAction&) {
dbgprintf("FIXME: Implement Help/About\n");
}));
diff --git a/Games/Snake/main.cpp b/Games/Snake/main.cpp
index 2000cc2aa4bb..e5b75c86b3b2 100644
--- a/Games/Snake/main.cpp
+++ b/Games/Snake/main.cpp
@@ -23,7 +23,7 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("Snake");
+ auto app_menu = GMenu::construct("Snake");
app_menu->add_action(GAction::create("New game", { Mod_None, Key_F2 }, [&](const GAction&) {
game->reset();
@@ -34,7 +34,7 @@ int main(int argc, char** argv)
menubar->add_menu(move(app_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [](const GAction&) {
dbgprintf("FIXME: Implement Help/About\n");
}));
diff --git a/Libraries/LibGUI/GMenu.cpp b/Libraries/LibGUI/GMenu.cpp
index de660678ab6c..401b3672dbbc 100644
--- a/Libraries/LibGUI/GMenu.cpp
+++ b/Libraries/LibGUI/GMenu.cpp
@@ -39,7 +39,7 @@ void GMenu::add_action(NonnullRefPtr<GAction> action)
#endif
}
-void GMenu::add_submenu(NonnullOwnPtr<GMenu> submenu)
+void GMenu::add_submenu(NonnullRefPtr<GMenu> submenu)
{
m_items.append(make<GMenuItem>(m_menu_id, move(submenu)));
}
diff --git a/Libraries/LibGUI/GMenu.h b/Libraries/LibGUI/GMenu.h
index a4fadcf13240..d80153d14856 100644
--- a/Libraries/LibGUI/GMenu.h
+++ b/Libraries/LibGUI/GMenu.h
@@ -3,15 +3,17 @@
#include <AK/Function.h>
#include <AK/NonnullOwnPtrVector.h>
#include <AK/NonnullRefPtr.h>
+#include <LibCore/CObject.h>
#include <LibGUI/GMenuItem.h>
class GAction;
class Point;
-class GMenu {
+class GMenu final : public CObject {
+ C_OBJECT(GMenu)
public:
explicit GMenu(const StringView& name = "");
- ~GMenu();
+ virtual ~GMenu() override;
static GMenu* from_menu_id(int);
@@ -21,7 +23,7 @@ class GMenu {
void add_action(NonnullRefPtr<GAction>);
void add_separator();
- void add_submenu(NonnullOwnPtr<GMenu>);
+ void add_submenu(NonnullRefPtr<GMenu>);
void popup(const Point& screen_position);
void dismiss();
diff --git a/Libraries/LibGUI/GMenuBar.cpp b/Libraries/LibGUI/GMenuBar.cpp
index 1449b189bde9..8301bb638e26 100644
--- a/Libraries/LibGUI/GMenuBar.cpp
+++ b/Libraries/LibGUI/GMenuBar.cpp
@@ -10,7 +10,7 @@ GMenuBar::~GMenuBar()
unrealize_menubar();
}
-void GMenuBar::add_menu(NonnullOwnPtr<GMenu>&& menu)
+void GMenuBar::add_menu(NonnullRefPtr<GMenu> menu)
{
m_menus.append(move(menu));
}
diff --git a/Libraries/LibGUI/GMenuBar.h b/Libraries/LibGUI/GMenuBar.h
index 5802177cb90c..ca82b04144a9 100644
--- a/Libraries/LibGUI/GMenuBar.h
+++ b/Libraries/LibGUI/GMenuBar.h
@@ -11,7 +11,7 @@ class GMenuBar {
GMenuBar();
~GMenuBar();
- void add_menu(NonnullOwnPtr<GMenu>&&);
+ void add_menu(NonnullRefPtr<GMenu>);
void notify_added_to_application(Badge<GApplication>);
void notify_removed_from_application(Badge<GApplication>);
@@ -21,5 +21,5 @@ class GMenuBar {
void unrealize_menubar();
int m_menubar_id { -1 };
- NonnullOwnPtrVector<GMenu> m_menus;
+ NonnullRefPtrVector<GMenu> m_menus;
};
diff --git a/Libraries/LibGUI/GMenuItem.cpp b/Libraries/LibGUI/GMenuItem.cpp
index c77fedddfa23..fe5614bc164c 100644
--- a/Libraries/LibGUI/GMenuItem.cpp
+++ b/Libraries/LibGUI/GMenuItem.cpp
@@ -21,7 +21,7 @@ GMenuItem::GMenuItem(unsigned menu_id, NonnullRefPtr<GAction>&& action)
m_checked = m_action->is_checked();
}
-GMenuItem::GMenuItem(unsigned menu_id, NonnullOwnPtr<GMenu>&& submenu)
+GMenuItem::GMenuItem(unsigned menu_id, NonnullRefPtr<GMenu>&& submenu)
: m_type(Submenu)
, m_menu_id(menu_id)
, m_submenu(move(submenu))
diff --git a/Libraries/LibGUI/GMenuItem.h b/Libraries/LibGUI/GMenuItem.h
index 5b17b74c717e..7fdd26d24fdc 100644
--- a/Libraries/LibGUI/GMenuItem.h
+++ b/Libraries/LibGUI/GMenuItem.h
@@ -19,7 +19,7 @@ class GMenuItem {
GMenuItem(unsigned menu_id, Type);
GMenuItem(unsigned menu_id, NonnullRefPtr<GAction>&&);
- GMenuItem(unsigned menu_id, NonnullOwnPtr<GMenu>&&);
+ GMenuItem(unsigned menu_id, NonnullRefPtr<GMenu>&&);
~GMenuItem();
Type type() const { return m_type; }
@@ -53,5 +53,5 @@ class GMenuItem {
bool m_checkable { false };
bool m_checked { false };
RefPtr<GAction> m_action;
- OwnPtr<GMenu> m_submenu;
+ RefPtr<GMenu> m_submenu;
};
diff --git a/Libraries/LibGUI/GTableView.cpp b/Libraries/LibGUI/GTableView.cpp
index e9d3060e4e4f..a37d62025ae2 100644
--- a/Libraries/LibGUI/GTableView.cpp
+++ b/Libraries/LibGUI/GTableView.cpp
@@ -550,7 +550,7 @@ GMenu& GTableView::ensure_header_context_menu()
// or if the column count/names change.
if (!m_header_context_menu) {
ASSERT(model());
- m_header_context_menu = make<GMenu>();
+ m_header_context_menu = GMenu::construct();
for (int column = 0; column < model()->column_count(); ++column) {
auto& column_data = this->column_data(column);
diff --git a/Libraries/LibGUI/GTableView.h b/Libraries/LibGUI/GTableView.h
index e4e6845b3b92..89d9a62e7aed 100644
--- a/Libraries/LibGUI/GTableView.h
+++ b/Libraries/LibGUI/GTableView.h
@@ -98,5 +98,5 @@ class GTableView : public GAbstractView {
int m_hovered_column_header_index { -1 };
GMenu& ensure_header_context_menu();
- OwnPtr<GMenu> m_header_context_menu;
+ RefPtr<GMenu> m_header_context_menu;
};
diff --git a/Libraries/LibGUI/GTextEditor.cpp b/Libraries/LibGUI/GTextEditor.cpp
index 25bf3ff348f4..f9dad605028b 100644
--- a/Libraries/LibGUI/GTextEditor.cpp
+++ b/Libraries/LibGUI/GTextEditor.cpp
@@ -1180,7 +1180,7 @@ void GTextEditor::did_update_selection()
void GTextEditor::context_menu_event(GContextMenuEvent& event)
{
if (!m_context_menu) {
- m_context_menu = make<GMenu>();
+ m_context_menu = GMenu::construct();
m_context_menu->add_action(undo_action());
m_context_menu->add_action(redo_action());
m_context_menu->add_separator();
diff --git a/Libraries/LibGUI/GTextEditor.h b/Libraries/LibGUI/GTextEditor.h
index 202be7e84ba0..65219d1fc81f 100644
--- a/Libraries/LibGUI/GTextEditor.h
+++ b/Libraries/LibGUI/GTextEditor.h
@@ -196,7 +196,7 @@ class GTextEditor
size_t m_soft_tab_width { 4 };
int m_horizontal_content_padding { 2 };
GTextRange m_selection;
- OwnPtr<GMenu> m_context_menu;
+ RefPtr<GMenu> m_context_menu;
RefPtr<GAction> m_undo_action;
RefPtr<GAction> m_redo_action;
RefPtr<GAction> m_cut_action;
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp
index b9601231471b..db3bce94b287 100644
--- a/Libraries/LibVT/TerminalWidget.cpp
+++ b/Libraries/LibVT/TerminalWidget.cpp
@@ -648,7 +648,7 @@ void TerminalWidget::beep()
void TerminalWidget::context_menu_event(GContextMenuEvent& event)
{
if (!m_context_menu) {
- m_context_menu = make<GMenu>();
+ m_context_menu = GMenu::construct();
m_context_menu->add_action(copy_action());
m_context_menu->add_action(paste_action());
}
diff --git a/Libraries/LibVT/TerminalWidget.h b/Libraries/LibVT/TerminalWidget.h
index be6951701cea..6d5d22da6839 100644
--- a/Libraries/LibVT/TerminalWidget.h
+++ b/Libraries/LibVT/TerminalWidget.h
@@ -128,7 +128,7 @@ class TerminalWidget final : public GFrame
RefPtr<GAction> m_copy_action;
RefPtr<GAction> m_paste_action;
- OwnPtr<GMenu> m_context_menu;
+ RefPtr<GMenu> m_context_menu;
CElapsedTimer m_triple_click_timer;
};
diff --git a/Userland/html.cpp b/Userland/html.cpp
index 33562f42c3c2..9d2ddf3ae7a4 100644
--- a/Userland/html.cpp
+++ b/Userland/html.cpp
@@ -48,13 +48,13 @@ int main(int argc, char** argv)
auto menubar = make<GMenuBar>();
- auto app_menu = make<GMenu>("HTML");
+ auto app_menu = GMenu::construct("HTML");
app_menu->add_action(GCommonActions::make_quit_action([&](auto&) {
app.quit();
}));
menubar->add_menu(move(app_menu));
- auto help_menu = make<GMenu>("Help");
+ auto help_menu = GMenu::construct("Help");
help_menu->add_action(GAction::create("About", [&](const GAction&) {
GAboutDialog::show("HTML", GraphicsBitmap::load_from_file("/res/icons/32x32/filetype-html.png"), window);
}));
|
ad9f70dff95769f71564c246c4193ad5f3dd79d0
|
2025-03-07 06:55:31
|
Feng Yu
|
libweb: Clean up unused module script fetching algorithms
| false
|
Clean up unused module script fetching algorithms
|
libweb
|
diff --git a/Libraries/LibWeb/HTML/Scripting/Fetching.cpp b/Libraries/LibWeb/HTML/Scripting/Fetching.cpp
index c1ce4bfda09c..f19e34da0934 100644
--- a/Libraries/LibWeb/HTML/Scripting/Fetching.cpp
+++ b/Libraries/LibWeb/HTML/Scripting/Fetching.cpp
@@ -593,131 +593,6 @@ WebIDL::ExceptionOr<void> fetch_worklet_module_worker_script_graph(URL::URL cons
return {};
}
-// https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-script-graph-fetching-procedure
-void fetch_internal_module_script_graph(JS::Realm& realm, JS::ModuleRequest const& module_request, EnvironmentSettingsObject& fetch_client_settings_object, Fetch::Infrastructure::Request::Destination destination, ScriptFetchOptions const& options, Script& referring_script, HashTable<ModuleLocationTuple> const& visited_set, PerformTheFetchHook perform_fetch, OnFetchScriptComplete on_complete)
-{
- // 1. Let url be the result of resolving a module specifier given referringScript and moduleRequest.[[Specifier]].
- auto url = MUST(resolve_module_specifier(referring_script, module_request.module_specifier));
-
- // 2. Assert: the previous step never throws an exception, because resolving a module specifier must have been previously successful with these same two arguments.
- // NOTE: Handled by MUST above.
-
- // 3. Let moduleType be the result of running the module type from module request steps given moduleRequest.
- auto module_type = module_type_from_module_request(module_request);
-
- // 4. Assert: visited set contains (url, moduleType).
- VERIFY(visited_set.contains({ url, module_type }));
-
- // onSingleFetchComplete given result is the following algorithm:
- auto on_single_fetch_complete = create_on_fetch_script_complete(realm.heap(), [&realm, perform_fetch, on_complete, &fetch_client_settings_object, destination, visited_set](auto result) mutable {
- // 1. If result is null, run onComplete with null, and abort these steps.
- if (!result) {
- on_complete->function()(nullptr);
- return;
- }
-
- // 2. Fetch the descendants of result given fetch client settings object, destination, visited set, and with onComplete. If performFetch was given, pass it along as well.
- auto& module_script = as<JavaScriptModuleScript>(*result);
- fetch_descendants_of_a_module_script(realm, module_script, fetch_client_settings_object, destination, visited_set, perform_fetch, on_complete);
- });
-
- // 5. Fetch a single module script given url, fetch client settings object, destination, options, referringScript's settings object's realm,
- // referringScript's base URL, moduleRequest, false, and onSingleFetchComplete as defined below. If performFetch was given, pass it along as well.
- fetch_single_module_script(realm, url, fetch_client_settings_object, destination, options, referring_script.realm(), referring_script.base_url().value(), module_request, TopLevelModule::No, perform_fetch, on_single_fetch_complete);
-}
-
-// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-the-descendants-of-a-module-script
-void fetch_descendants_of_a_module_script(JS::Realm& realm, JavaScriptModuleScript& module_script, EnvironmentSettingsObject& fetch_client_settings_object, Fetch::Infrastructure::Request::Destination destination, HashTable<ModuleLocationTuple> visited_set, PerformTheFetchHook perform_fetch, OnFetchScriptComplete on_complete)
-{
- // 1. If module script's record is null, run onComplete with module script and return.
- if (!module_script.record()) {
- on_complete->function()(&module_script);
- return;
- }
-
- // 2. Let record be module script's record.
- auto const& record = module_script.record();
-
- // 3. If record is not a Cyclic Module Record, or if record.[[RequestedModules]] is empty, run onComplete with module script and return.
- // FIXME: Currently record is always a cyclic module.
- if (record->requested_modules().is_empty()) {
- on_complete->function()(&module_script);
- return;
- }
-
- // 4. Let moduleRequests be a new empty list.
- Vector<JS::ModuleRequest> module_requests;
-
- // 5. For each ModuleRequest Record requested of record.[[RequestedModules]],
- for (auto const& requested : record->requested_modules()) {
- // 1. Let url be the result of resolving a module specifier given module script and requested.[[Specifier]].
- auto url = MUST(resolve_module_specifier(module_script, requested.module_specifier));
-
- // 2. Assert: the previous step never throws an exception, because resolving a module specifier must have been previously successful with these same two arguments.
- // NOTE: Handled by MUST above.
-
- // 3. Let moduleType be the result of running the module type from module request steps given requested.
- auto module_type = module_type_from_module_request(requested);
-
- // 4. If visited set does not contain (url, moduleType), then:
- if (!visited_set.contains({ url, module_type })) {
- // 1. Append requested to moduleRequests.
- module_requests.append(requested);
-
- // 2. Append (url, moduleType) to visited set.
- visited_set.set({ url, module_type });
- }
- }
-
- // FIXME: 6. Let options be the descendant script fetch options for module script's fetch options.
- ScriptFetchOptions options;
-
- // FIXME: 7. Assert: options is not null, as module script is a JavaScript module script.
-
- // 8. Let pendingCount be the length of moduleRequests.
- auto pending_count = module_requests.size();
-
- // 9. If pendingCount is zero, run onComplete with module script.
- if (pending_count == 0) {
- on_complete->function()(&module_script);
- return;
- }
-
- // 10. Let failed be false.
- bool failed = false;
-
- // 11. For each moduleRequest in moduleRequests, perform the internal module script graph fetching procedure given moduleRequest,
- // fetch client settings object, destination, options, module script, visited set, and onInternalFetchingComplete as defined below.
- // If performFetch was given, pass it along as well.
- for (auto const& module_request : module_requests) {
- // onInternalFetchingComplete given result is the following algorithm:
- auto on_internal_fetching_complete = create_on_fetch_script_complete(realm.heap(), [failed, pending_count, &module_script, on_complete](auto result) mutable {
- // 1. If failed is true, then abort these steps.
- if (failed)
- return;
-
- // 2. If result is null, then set failed to true, run onComplete with null, and abort these steps.
- if (!result) {
- failed = true;
- on_complete->function()(nullptr);
- return;
- }
-
- // 3. Assert: pendingCount is greater than zero.
- VERIFY(pending_count > 0);
-
- // 4. Decrement pendingCount by one.
- --pending_count;
-
- // 5. If pendingCount is zero, run onComplete with module script.
- if (pending_count == 0)
- on_complete->function()(&module_script);
- });
-
- fetch_internal_module_script_graph(realm, module_request, fetch_client_settings_object, destination, options, module_script, visited_set, perform_fetch, on_internal_fetching_complete);
- }
-}
-
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-destination-from-module-type
Fetch::Infrastructure::Request::Destination fetch_destination_from_module_type(Fetch::Infrastructure::Request::Destination default_destination, ByteString const& module_type)
{
diff --git a/Libraries/LibWeb/HTML/Scripting/Fetching.h b/Libraries/LibWeb/HTML/Scripting/Fetching.h
index d972ff3534d4..6968d0e6efdc 100644
--- a/Libraries/LibWeb/HTML/Scripting/Fetching.h
+++ b/Libraries/LibWeb/HTML/Scripting/Fetching.h
@@ -93,12 +93,10 @@ WebIDL::ExceptionOr<void> fetch_classic_worker_script(URL::URL const&, Environme
WebIDL::ExceptionOr<GC::Ref<ClassicScript>> fetch_a_classic_worker_imported_script(URL::URL const&, HTML::EnvironmentSettingsObject&, PerformTheFetchHook = nullptr);
WebIDL::ExceptionOr<void> fetch_module_worker_script_graph(URL::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
WebIDL::ExceptionOr<void> fetch_worklet_module_worker_script_graph(URL::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, EnvironmentSettingsObject& settings_object, PerformTheFetchHook, OnFetchScriptComplete);
-void fetch_internal_module_script_graph(JS::Realm&, JS::ModuleRequest const& module_request, EnvironmentSettingsObject& fetch_client_settings_object, Fetch::Infrastructure::Request::Destination, ScriptFetchOptions const&, Script& referring_script, HashTable<ModuleLocationTuple> const& visited_set, PerformTheFetchHook, OnFetchScriptComplete on_complete);
void fetch_external_module_script_graph(JS::Realm&, URL::URL const&, EnvironmentSettingsObject& settings_object, ScriptFetchOptions const&, OnFetchScriptComplete on_complete);
void fetch_inline_module_script_graph(JS::Realm&, ByteString const& filename, ByteString const& source_text, URL::URL const& base_url, EnvironmentSettingsObject& settings_object, OnFetchScriptComplete on_complete);
void fetch_single_imported_module_script(JS::Realm&, URL::URL const&, EnvironmentSettingsObject& fetch_client, Fetch::Infrastructure::Request::Destination, ScriptFetchOptions const&, JS::Realm& module_map_realm, Fetch::Infrastructure::Request::ReferrerType, JS::ModuleRequest const&, PerformTheFetchHook, OnFetchScriptComplete on_complete);
-void fetch_descendants_of_a_module_script(JS::Realm&, JavaScriptModuleScript& module_script, EnvironmentSettingsObject& fetch_client_settings_object, Fetch::Infrastructure::Request::Destination, HashTable<ModuleLocationTuple> visited_set, PerformTheFetchHook, OnFetchScriptComplete callback);
void fetch_descendants_of_and_link_a_module_script(JS::Realm&, JavaScriptModuleScript&, EnvironmentSettingsObject&, Fetch::Infrastructure::Request::Destination, PerformTheFetchHook, OnFetchScriptComplete on_complete);
Fetch::Infrastructure::Request::Destination fetch_destination_from_module_type(Fetch::Infrastructure::Request::Destination, ByteString const&);
|
1defc4595b1994cbddd3d7bcec6a641ea416e206
|
2023-12-24 01:23:11
|
Shannon Booth
|
libweb: Make LiveNodeList store a NonnullGCPtr<Node const> root
| false
|
Make LiveNodeList store a NonnullGCPtr<Node const> root
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.h b/Userland/Libraries/LibWeb/DOM/HTMLCollection.h
index 803b9157db8e..c18dd7bc97dd 100644
--- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.h
+++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.h
@@ -55,6 +55,7 @@ class HTMLCollection : public Bindings::LegacyPlatformObject {
virtual void initialize(JS::Realm&) override;
JS::NonnullGCPtr<ParentNode> root() { return *m_root; }
+ JS::NonnullGCPtr<ParentNode const> root() const { return *m_root; }
private:
virtual void visit_edges(Cell::Visitor&) override;
diff --git a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp
index 47642e6f096a..42e4f2cf8ee2 100644
--- a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp
+++ b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.cpp
@@ -33,7 +33,7 @@ void HTMLFormControlsCollection::initialize(JS::Realm& realm)
}
// https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#dom-htmlformcontrolscollection-nameditem
-Variant<Empty, Element*, JS::Handle<RadioNodeList>> HTMLFormControlsCollection::named_item_or_radio_node_list(FlyString const& name)
+Variant<Empty, Element*, JS::Handle<RadioNodeList>> HTMLFormControlsCollection::named_item_or_radio_node_list(FlyString const& name) const
{
// 1. If name is the empty string, return null and stop the algorithm.
if (name.is_empty())
diff --git a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h
index aa20f0c540ae..aba67236f7c4 100644
--- a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h
+++ b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h
@@ -20,7 +20,7 @@ class HTMLFormControlsCollection : public HTMLCollection {
virtual ~HTMLFormControlsCollection() override;
- Variant<Empty, Element*, JS::Handle<RadioNodeList>> named_item_or_radio_node_list(FlyString const& name);
+ Variant<Empty, Element*, JS::Handle<RadioNodeList>> named_item_or_radio_node_list(FlyString const& name) const;
protected:
virtual void initialize(JS::Realm&) override;
diff --git a/Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp b/Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp
index 10b6169ab61a..c03ba4ec183c 100644
--- a/Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp
+++ b/Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp
@@ -14,12 +14,12 @@ namespace Web::DOM {
JS_DEFINE_ALLOCATOR(LiveNodeList);
-JS::NonnullGCPtr<NodeList> LiveNodeList::create(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter)
+JS::NonnullGCPtr<NodeList> LiveNodeList::create(JS::Realm& realm, Node const& root, Scope scope, Function<bool(Node const&)> filter)
{
return realm.heap().allocate<LiveNodeList>(realm, realm, root, scope, move(filter));
}
-LiveNodeList::LiveNodeList(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter)
+LiveNodeList::LiveNodeList(JS::Realm& realm, Node const& root, Scope scope, Function<bool(Node const&)> filter)
: NodeList(realm)
, m_root(root)
, m_filter(move(filter))
diff --git a/Userland/Libraries/LibWeb/DOM/LiveNodeList.h b/Userland/Libraries/LibWeb/DOM/LiveNodeList.h
index 99de8533f463..4084c16a5eba 100644
--- a/Userland/Libraries/LibWeb/DOM/LiveNodeList.h
+++ b/Userland/Libraries/LibWeb/DOM/LiveNodeList.h
@@ -24,7 +24,7 @@ class LiveNodeList : public NodeList {
Descendants,
};
- [[nodiscard]] static JS::NonnullGCPtr<NodeList> create(JS::Realm&, Node& root, Scope, Function<bool(Node const&)> filter);
+ [[nodiscard]] static JS::NonnullGCPtr<NodeList> create(JS::Realm&, Node const& root, Scope, Function<bool(Node const&)> filter);
virtual ~LiveNodeList() override;
virtual u32 length() const override;
@@ -33,7 +33,7 @@ class LiveNodeList : public NodeList {
virtual bool is_supported_property_index(u32) const override;
protected:
- LiveNodeList(JS::Realm&, Node& root, Scope, Function<bool(Node const&)> filter);
+ LiveNodeList(JS::Realm&, Node const& root, Scope, Function<bool(Node const&)> filter);
Node* first_matching(Function<bool(Node const&)> const& filter) const;
@@ -42,7 +42,7 @@ class LiveNodeList : public NodeList {
JS::MarkedVector<Node*> collection() const;
- JS::NonnullGCPtr<Node> m_root;
+ JS::NonnullGCPtr<Node const> m_root;
Function<bool(Node const&)> m_filter;
Scope m_scope { Scope::Descendants };
};
diff --git a/Userland/Libraries/LibWeb/DOM/RadioNodeList.cpp b/Userland/Libraries/LibWeb/DOM/RadioNodeList.cpp
index 56e29f996d82..24b563dab5a0 100644
--- a/Userland/Libraries/LibWeb/DOM/RadioNodeList.cpp
+++ b/Userland/Libraries/LibWeb/DOM/RadioNodeList.cpp
@@ -14,12 +14,12 @@ namespace Web::DOM {
JS_DEFINE_ALLOCATOR(RadioNodeList);
-JS::NonnullGCPtr<RadioNodeList> RadioNodeList::create(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter)
+JS::NonnullGCPtr<RadioNodeList> RadioNodeList::create(JS::Realm& realm, Node const& root, Scope scope, Function<bool(Node const&)> filter)
{
return realm.heap().allocate<RadioNodeList>(realm, realm, root, scope, move(filter));
}
-RadioNodeList::RadioNodeList(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter)
+RadioNodeList::RadioNodeList(JS::Realm& realm, Node const& root, Scope scope, Function<bool(Node const&)> filter)
: LiveNodeList(realm, root, scope, move(filter))
{
}
diff --git a/Userland/Libraries/LibWeb/DOM/RadioNodeList.h b/Userland/Libraries/LibWeb/DOM/RadioNodeList.h
index bcf1991b5f8a..ab7ecf548b4c 100644
--- a/Userland/Libraries/LibWeb/DOM/RadioNodeList.h
+++ b/Userland/Libraries/LibWeb/DOM/RadioNodeList.h
@@ -16,7 +16,7 @@ class RadioNodeList : public LiveNodeList {
JS_DECLARE_ALLOCATOR(RadioNodeList);
public:
- [[nodiscard]] static JS::NonnullGCPtr<RadioNodeList> create(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter);
+ [[nodiscard]] static JS::NonnullGCPtr<RadioNodeList> create(JS::Realm& realm, Node const& root, Scope scope, Function<bool(Node const&)> filter);
virtual ~RadioNodeList() override;
@@ -27,7 +27,7 @@ class RadioNodeList : public LiveNodeList {
virtual void initialize(JS::Realm&) override;
private:
- explicit RadioNodeList(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter);
+ explicit RadioNodeList(JS::Realm& realm, Node const& root, Scope scope, Function<bool(Node const&)> filter);
};
}
|
37d30d7b2b2b03c260bf35c4f649344dd24cc947
|
2019-08-16 20:09:56
|
Andreas Kling
|
meta: Add the script I use to refresh my Qt Creator project files
| false
|
Add the script I use to refresh my Qt Creator project files
|
meta
|
diff --git a/Meta/refresh-serenity-qtcreator.sh b/Meta/refresh-serenity-qtcreator.sh
new file mode 100755
index 000000000000..dda410061ebb
--- /dev/null
+++ b/Meta/refresh-serenity-qtcreator.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+cd $SERENITY_ROOT
+find . -name '*.ipc' -or -name '*.cpp' -or -name '*.h' -or -name '*.S' | grep -Fv Patches/ | grep -Fv Root/ | grep -Fv Ports/ | grep -Fv Toolchain/ > serenity.files
|
6d6ea1fffe44bf5a289439d34a558b0de5c1972f
|
2023-01-28 06:11:18
|
Linus Groh
|
libjs: Add spec comments to FinalizationRegistryPrototype
| false
|
Add spec comments to FinalizationRegistryPrototype
|
libjs
|
diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp
index 3ba8e98d1d3c..ef7fda2010be 100644
--- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp
+++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp
@@ -23,15 +23,25 @@ void FinalizationRegistry::add_finalization_record(Cell& target, Value held_valu
m_records.append({ &target, held_value, unregister_token });
}
+// Extracted from FinalizationRegistry.prototype.unregister ( unregisterToken )
bool FinalizationRegistry::remove_by_token(Cell& unregister_token)
{
+ // 4. Let removed be false.
auto removed = false;
+
+ // 5. For each Record { [[WeakRefTarget]], [[HeldValue]], [[UnregisterToken]] } cell of finalizationRegistry.[[Cells]], do
for (auto it = m_records.begin(); it != m_records.end(); ++it) {
+ // a. If cell.[[UnregisterToken]] is not empty and SameValue(cell.[[UnregisterToken]], unregisterToken) is true, then
if (it->unregister_token == &unregister_token) {
+ // i. Remove cell from finalizationRegistry.[[Cells]].
it.remove(m_records);
+
+ // ii. Set removed to true.
removed = true;
}
}
+
+ // 6. Return removed.
return removed;
}
diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp
index 03ad9f4bbdfe..057152aef2ee 100644
--- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp
@@ -32,50 +32,72 @@ void FinalizationRegistryPrototype::initialize(Realm& realm)
// @STAGE 2@ FinalizationRegistry.prototype.cleanupSome ( [ callback ] ), https://github.com/tc39/proposal-cleanup-some/blob/master/spec/finalization-registry.html
JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::cleanup_some)
{
+ auto callback = vm.argument(0);
+
+ // 1. Let finalizationRegistry be the this value.
+ // 2. Perform ? RequireInternalSlot(finalizationRegistry, [[Cells]]).
auto* finalization_registry = TRY(typed_this_object(vm));
- auto callback = vm.argument(0);
+ // 3. If callback is present and IsCallable(callback) is false, throw a TypeError exception.
if (vm.argument_count() > 0 && !callback.is_function())
return vm.throw_completion<TypeError>(ErrorType::NotAFunction, callback.to_string_without_side_effects());
// IMPLEMENTATION DEFINED: The specification for this function hasn't been updated to accommodate for JobCallback records.
// This just follows how the constructor immediately converts the callback to a JobCallback using HostMakeJobCallback.
+ // 4. Perform ? CleanupFinalizationRegistry(finalizationRegistry, callback).
TRY(finalization_registry->cleanup(callback.is_undefined() ? Optional<JobCallback> {} : vm.host_make_job_callback(callback.as_function())));
+ // 5. Return undefined.
return js_undefined();
}
// 26.2.3.2 FinalizationRegistry.prototype.register ( target, heldValue [ , unregisterToken ] ), https://tc39.es/ecma262/#sec-finalization-registry.prototype.register
JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::register_)
{
+ auto target = vm.argument(0);
+ auto held_value = vm.argument(1);
+ auto unregister_token = vm.argument(2);
+
+ // 1. Let finalizationRegistry be the this value.
+ // 2. Perform ? RequireInternalSlot(finalizationRegistry, [[Cells]]).
auto* finalization_registry = TRY(typed_this_object(vm));
- auto target = vm.argument(0);
+ // 3. If target is not an Object, throw a TypeError exception.
if (!can_be_held_weakly(target))
return vm.throw_completion<TypeError>(ErrorType::CannotBeHeldWeakly, target.to_string_without_side_effects());
- auto held_value = vm.argument(1);
+ // 4. If SameValue(target, heldValue) is true, throw a TypeError exception.
if (same_value(target, held_value))
return vm.throw_completion<TypeError>(ErrorType::FinalizationRegistrySameTargetAndValue);
- auto unregister_token = vm.argument(2);
+ // 5. If unregisterToken is not an Object, then
+ // a. If unregisterToken is not undefined, throw a TypeError exception.
+ // b. Set unregisterToken to empty.
if (!can_be_held_weakly(unregister_token) && !unregister_token.is_undefined())
return vm.throw_completion<TypeError>(ErrorType::CannotBeHeldWeakly, unregister_token.to_string_without_side_effects());
+ // 6. Let cell be the Record { [[WeakRefTarget]]: target, [[HeldValue]]: heldValue, [[UnregisterToken]]: unregisterToken }.
+ // 7. Append cell to finalizationRegistry.[[Cells]].
finalization_registry->add_finalization_record(target.as_cell(), held_value, unregister_token.is_undefined() ? nullptr : &unregister_token.as_cell());
+ // 8. Return undefined.
return js_undefined();
}
// 26.2.3.3 FinalizationRegistry.prototype.unregister ( unregisterToken ), https://tc39.es/ecma262/#sec-finalization-registry.prototype.unregister
JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::unregister)
{
+ auto unregister_token = vm.argument(0);
+
+ // 1. Let finalizationRegistry be the this value.
+ // 2. Perform ? RequireInternalSlot(finalizationRegistry, [[Cells]]).
auto* finalization_registry = TRY(typed_this_object(vm));
- auto unregister_token = vm.argument(0);
+ // 3. If unregisterToken is not an Object, throw a TypeError exception.
if (!can_be_held_weakly(unregister_token))
return vm.throw_completion<TypeError>(ErrorType::CannotBeHeldWeakly, unregister_token.to_string_without_side_effects());
+ // 4-6.
return Value(finalization_registry->remove_by_token(unregister_token.as_cell()));
}
|
d69a8a995894c50207dbdf86b6b501bb09d41b27
|
2021-01-23 02:44:30
|
asynts
|
everywhere: Replace a bundle of dbg with dbgln.
| false
|
Replace a bundle of dbg with dbgln.
|
everywhere
|
diff --git a/AK/Debug.h b/AK/Debug.h
index 3184aae2b684..2a17ed1b430d 100644
--- a/AK/Debug.h
+++ b/AK/Debug.h
@@ -351,3 +351,9 @@ constexpr bool debug_job = true;
#else
constexpr bool debug_job = false;
#endif
+
+#ifdef GIF_DEBUG
+constexpr bool debug_gif = true;
+#else
+constexpr bool debug_gif = false;
+#endif
diff --git a/Userland/Libraries/LibGfx/BMPLoader.cpp b/Userland/Libraries/LibGfx/BMPLoader.cpp
index 1031df93c332..b84bab5c0ae0 100644
--- a/Userland/Libraries/LibGfx/BMPLoader.cpp
+++ b/Userland/Libraries/LibGfx/BMPLoader.cpp
@@ -474,7 +474,7 @@ static bool decode_bmp_header(BMPLoadingContext& context)
u16 header = streamer.read_u16();
if (header != 0x4d42) {
- dbgln<debug_bmp>("BMP has invalid magic header number: {:04x}", header);
+ dbgln<debug_bmp>("BMP has invalid magic header number: {:#04x}", header);
context.state = BMPLoadingContext::State::Error;
return false;
}
@@ -490,8 +490,10 @@ static bool decode_bmp_header(BMPLoadingContext& context)
streamer.drop_bytes(4);
context.data_offset = streamer.read_u32();
- dbgln<debug_bmp>("BMP file size: {}", context.file_size);
- dbgln<debug_bmp>("BMP data offset: {}", context.data_offset);
+ if constexpr (debug_bmp) {
+ dbgln("BMP file size: {}", context.file_size);
+ dbgln("BMP data offset: {}", context.data_offset);
+ }
if (context.data_offset >= context.file_size) {
dbgln<debug_bmp>("BMP data offset is beyond file end?!");
@@ -547,9 +549,11 @@ static bool decode_bmp_core_dib(BMPLoadingContext& context, Streamer& streamer)
return false;
}
- dbgln<debug_bmp>("BMP width: {}", core.width);
- dbgln<debug_bmp>("BMP height: {}", core.height);
- dbgln<debug_bmp>("BMP bpp: {}", core.bpp);
+ if constexpr (debug_bmp) {
+ dbgln("BMP width: {}", core.width);
+ dbgln("BMP height: {}", core.height);
+ dbgln("BMP bits_per_pixel: {}", core.bpp);
+ }
return true;
}
@@ -594,9 +598,11 @@ static bool decode_bmp_osv2_dib(BMPLoadingContext& context, Streamer& streamer,
return false;
}
- dbgln<debug_bmp>("BMP width: {}", core.width);
- dbgln<debug_bmp>("BMP height: {}", core.height);
- dbgln<debug_bmp>("BMP bpp: {}", core.bpp);
+ if constexpr (debug_bmp) {
+ dbgln("BMP width: {}", core.width);
+ dbgln("BMP height: {}", core.height);
+ dbgln("BMP bits_per_pixel: {}", core.bpp);
+ }
if (short_variant)
return true;
@@ -632,12 +638,14 @@ static bool decode_bmp_osv2_dib(BMPLoadingContext& context, Streamer& streamer,
// ColorEncoding (4) + Identifier (4)
streamer.drop_bytes(8);
- dbgln<debug_bmp>("BMP compression: {}", info.compression);
- dbgln<debug_bmp>("BMP image size: {}", info.image_size);
- dbgln<debug_bmp>("BMP horizontal res: {}", info.horizontal_resolution);
- dbgln<debug_bmp>("BMP vertical res: {}", info.vertical_resolution);
- dbgln<debug_bmp>("BMP colors: {}", info.number_of_palette_colors);
- dbgln<debug_bmp>("BMP important colors: {}", info.number_of_important_palette_colors);
+ if constexpr (debug_bmp) {
+ dbgln("BMP compression: {}", info.compression);
+ dbgln("BMP image size: {}", info.image_size);
+ dbgln("BMP horizontal res: {}", info.horizontal_resolution);
+ dbgln("BMP vertical res: {}", info.vertical_resolution);
+ dbgln("BMP colors: {}", info.number_of_palette_colors);
+ dbgln("BMP important colors: {}", info.number_of_important_palette_colors);
+ }
return true;
}
@@ -670,12 +678,14 @@ static bool decode_bmp_info_dib(BMPLoadingContext& context, Streamer& streamer)
if (info.number_of_important_palette_colors == 0)
info.number_of_important_palette_colors = info.number_of_palette_colors;
- dbgln<debug_bmp>("BMP compression: {}", info.compression);
- dbgln<debug_bmp>("BMP image size: {}", info.image_size);
- dbgln<debug_bmp>("BMP horizontal resolution: {}", info.horizontal_resolution);
- dbgln<debug_bmp>("BMP vertical resolution: {}", info.vertical_resolution);
- dbgln<debug_bmp>("BMP palette colors: {}", info.number_of_palette_colors);
- dbgln<debug_bmp>("BMP important palette colors: {}", info.number_of_important_palette_colors);
+ if constexpr (debug_bmp) {
+ dbgln("BMP compression: {}", info.compression);
+ dbgln("BMP image size: {}", info.image_size);
+ dbgln("BMP horizontal res: {}", info.horizontal_resolution);
+ dbgln("BMP vertical res: {}", info.vertical_resolution);
+ dbgln("BMP colors: {}", info.number_of_palette_colors);
+ dbgln("BMP important colors: {}", info.number_of_important_palette_colors);
+ }
return true;
}
@@ -689,9 +699,11 @@ static bool decode_bmp_v2_dib(BMPLoadingContext& context, Streamer& streamer)
context.dib.info.masks.append(streamer.read_u32());
context.dib.info.masks.append(streamer.read_u32());
- dbgln<debug_bmp>("BMP red mask: {:08x}", context.dib.info.masks[0]);
- dbgln<debug_bmp>("BMP green mask: {:08x}", context.dib.info.masks[1]);
- dbgln<debug_bmp>("BMP blue mask: {:08x}", context.dib.info.masks[2]);
+ if constexpr (debug_bmp) {
+ dbgln("BMP red mask: {:#08x}", context.dib.info.masks[0]);
+ dbgln("BMP green mask: {:#08x}", context.dib.info.masks[1]);
+ dbgln("BMP blue mask: {:#08x}", context.dib.info.masks[2]);
+ }
return true;
}
@@ -707,12 +719,12 @@ static bool decode_bmp_v3_dib(BMPLoadingContext& context, Streamer& streamer)
// suite results.
if (context.dib.info.compression == Compression::ALPHABITFIELDS) {
context.dib.info.masks.append(streamer.read_u32());
- dbgln<debug_bmp>("BMP alpha mask: {:08x}", context.dib.info.masks[3]);
+ dbgln<debug_bmp>("BMP alpha mask: {:#08x}", context.dib.info.masks[3]);
} else if (context.dib_size() >= 56 && context.dib.core.bpp >= 16) {
auto mask = streamer.read_u32();
if ((context.dib.core.bpp == 32 && mask != 0) || context.dib.core.bpp == 16) {
context.dib.info.masks.append(mask);
- dbgln<debug_bmp>("BMP alpha mask: {:08x}", mask);
+ dbgln<debug_bmp>("BMP alpha mask: {:#08x}", mask);
}
} else {
streamer.drop_bytes(4);
@@ -733,11 +745,13 @@ static bool decode_bmp_v4_dib(BMPLoadingContext& context, Streamer& streamer)
v4.blue_endpoint = { streamer.read_i32(), streamer.read_i32(), streamer.read_i32() };
v4.gamma_endpoint = { streamer.read_u32(), streamer.read_u32(), streamer.read_u32() };
- dbgln<debug_bmp>("BMP color space: {}", v4.color_space);
- dbgln<debug_bmp>("BMP red endpoint: {}", v4.red_endpoint);
- dbgln<debug_bmp>("BMP green endpoint: {}", v4.green_endpoint);
- dbgln<debug_bmp>("BMP blue endpoint: {}", v4.blue_endpoint);
- dbgln<debug_bmp>("BMP gamma endpoint: {}", v4.gamma_endpoint);
+ if constexpr (debug_bmp) {
+ dbgln("BMP color space: {}", v4.color_space);
+ dbgln("BMP red endpoint: {}", v4.red_endpoint);
+ dbgln("BMP green endpoint: {}", v4.green_endpoint);
+ dbgln("BMP blue endpoint: {}", v4.blue_endpoint);
+ dbgln("BMP gamma endpoint: {}", v4.gamma_endpoint);
+ }
return true;
}
@@ -752,9 +766,11 @@ static bool decode_bmp_v5_dib(BMPLoadingContext& context, Streamer& streamer)
v5.profile_data = streamer.read_u32();
v5.profile_size = streamer.read_u32();
- dbgln<debug_bmp>("BMP intent: {}", v5.intent);
- dbgln<debug_bmp>("BMP profile data: {}", v5.profile_data);
- dbgln<debug_bmp>("BMP profile size: {}", v5.profile_size);
+ if constexpr (debug_bmp) {
+ dbgln("BMP intent: {}", v5.intent);
+ dbgln("BMP profile data: {}", v5.profile_data);
+ dbgln("BMP profile size: {}", v5.profile_size);
+ }
return true;
}
@@ -915,7 +931,7 @@ static bool uncompress_bmp_rle_data(BMPLoadingContext& context, ByteBuffer& buff
{
// RLE-compressed images cannot be stored top-down
if (context.dib.core.height < 0) {
- dbgln("BMP is top-down and RLE compressed");
+ dbgln<debug_bmp>("BMP is top-down and RLE compressed");
context.state = BMPLoadingContext::State::Error;
return false;
}
diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp
index d29c5969e37d..1e625986e9fc 100644
--- a/Userland/Libraries/LibGfx/GIFLoader.cpp
+++ b/Userland/Libraries/LibGfx/GIFLoader.cpp
@@ -26,6 +26,7 @@
#include <AK/Array.h>
#include <AK/ByteBuffer.h>
+#include <AK/Debug.h>
#include <AK/LexicalPath.h>
#include <AK/MappedFile.h>
#include <AK/MemoryStream.h>
@@ -36,8 +37,6 @@
#include <stdio.h>
#include <string.h>
-//#define GIF_DEBUG
-
namespace Gfx {
// Row strides and offsets for each interlace pass.
@@ -213,16 +212,16 @@ class LZWDecoder {
}
if (m_current_code > m_code_table.size()) {
-#ifdef GIF_DEBUG
- dbg() << "Corrupted LZW stream, invalid code: " << m_current_code << " at bit index: "
- << m_current_bit_index << ", code table size: " << m_code_table.size();
-#endif
+ dbgln<debug_gif>("Corrupted LZW stream, invalid code: {} at bit index {}, code table size: {}",
+ m_current_code,
+ m_current_bit_index,
+ m_code_table.size());
return {};
} else if (m_current_code == m_code_table.size() && m_output.is_empty()) {
-#ifdef GIF_DEBUG
- dbg() << "Corrupted LZW stream, valid new code but output buffer is empty: " << m_current_code
- << " at bit index: " << m_current_bit_index << ", code table size: " << m_code_table.size();
-#endif
+ dbgln<debug_gif>("Corrupted LZW stream, valid new code but output buffer is empty: {} at bit index {}, code table size: {}",
+ m_current_code,
+ m_current_bit_index,
+ m_code_table.size());
return {};
}
@@ -528,16 +527,12 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context)
if (extension_type == 0xFF) {
if (sub_block.size() != 14) {
-#ifdef GIF_DEBUG
- dbg() << "Unexpected application extension size: " << sub_block.size();
-#endif
+ dbgln<debug_gif>("Unexpected application extension size: {}", sub_block.size());
continue;
}
if (sub_block[11] != 1) {
-#ifdef GIF_DEBUG
- dbgln("Unexpected application extension format");
-#endif
+ dbgln<debug_gif>("Unexpected application extension format");
continue;
}
|
a9e436c4a3bc30e34212ec2ee6b52c76443f341d
|
2021-12-02 01:14:11
|
Idan Horowitz
|
kernel: Replace usages of SIGSTKFLT with SIGSEGV
| false
|
Replace usages of SIGSTKFLT with SIGSEGV
|
kernel
|
diff --git a/Kernel/Arch/x86/common/Interrupts.cpp b/Kernel/Arch/x86/common/Interrupts.cpp
index d355354ec4ac..0c2650ed9b59 100644
--- a/Kernel/Arch/x86/common/Interrupts.cpp
+++ b/Kernel/Arch/x86/common/Interrupts.cpp
@@ -316,7 +316,7 @@ void page_fault_handler(TrapFrame* trap)
VirtualAddress userspace_sp = VirtualAddress { regs.userspace_sp() };
if (!faulted_in_kernel && !MM.validate_user_stack(current_thread->process().address_space(), userspace_sp)) {
dbgln("Invalid stack pointer: {}", userspace_sp);
- handle_crash(regs, "Bad stack on page fault", SIGSTKFLT);
+ handle_crash(regs, "Bad stack on page fault", SIGSEGV);
}
if (fault_address >= (FlatPtr)&start_of_ro_after_init && fault_address < (FlatPtr)&end_of_ro_after_init) {
diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp
index 9d915078a140..42cd4e34f330 100644
--- a/Kernel/Memory/MemoryManager.cpp
+++ b/Kernel/Memory/MemoryManager.cpp
@@ -654,7 +654,7 @@ void MemoryManager::validate_syscall_preconditions(AddressSpace& space, Register
VirtualAddress userspace_sp = VirtualAddress { regs.userspace_sp() };
if (!MM.validate_user_stack_no_lock(space, userspace_sp)) {
dbgln("Invalid stack pointer: {}", userspace_sp);
- unlock_and_handle_crash("Bad stack on syscall entry", SIGSTKFLT);
+ unlock_and_handle_crash("Bad stack on syscall entry", SIGSEGV);
}
}
|
edf9d07d3f59f99d01bb6c3e4f6662213db3f3d7
|
2021-02-25 13:20:25
|
Morc - Richard Gráčik
|
filemanager: change icon for Show in File Manager
| false
|
change icon for Show in File Manager
|
filemanager
|
diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp
index dbb880503df6..dc61d088ac17 100644
--- a/Userland/Applications/FileManager/main.cpp
+++ b/Userland/Applications/FileManager/main.cpp
@@ -274,7 +274,7 @@ int run_in_desktop_mode([[maybe_unused]] RefPtr<Core::ConfigFile> config)
auto desktop_view_context_menu = GUI::Menu::construct("Directory View");
- auto file_manager_action = GUI::Action::create("Show in File Manager", {}, Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-folder.png"), [&](const GUI::Action&) {
+ auto file_manager_action = GUI::Action::create("Show in File Manager", {}, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"), [&](const GUI::Action&) {
Desktop::Launcher::open(URL::create_with_file_protocol(directory_view.path()));
});
|
9902e71f99ad4a00ae77b356540df175983ec0b1
|
2022-02-26 23:35:06
|
kleines Filmröllchen
|
utilities: Allow link checking in markdown-check to fail during visit
| false
|
Allow link checking in markdown-check to fail during visit
|
utilities
|
diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp
index e43ec3521d02..a86b492d9d93 100644
--- a/Userland/Utilities/markdown-check.cpp
+++ b/Userland/Utilities/markdown-check.cpp
@@ -71,6 +71,7 @@ class MarkdownLinkage final : Markdown::Visitor {
bool has_anchor(String const& anchor) const { return m_anchors.contains(anchor); }
HashTable<String> const& anchors() const { return m_anchors; }
+ bool has_invalid_link() const { return m_has_invalid_link; }
Vector<FileLink> const& file_links() const { return m_file_links; }
private:
@@ -81,6 +82,7 @@ class MarkdownLinkage final : Markdown::Visitor {
HashTable<String> m_anchors;
Vector<FileLink> m_file_links;
+ bool m_has_invalid_link { false };
};
MarkdownLinkage MarkdownLinkage::analyze(Markdown::Document const& document)
@@ -231,6 +233,12 @@ int main(int argc, char** argv)
outln("Checking links ...");
bool any_problems = false;
for (auto const& file_item : files) {
+ if (file_item.value.has_invalid_link()) {
+ outln("File '{}' has invalid links.", file_item.key);
+ any_problems = true;
+ continue;
+ }
+
auto file_lexical_path = LexicalPath(file_item.key);
auto file_dir = file_lexical_path.dirname();
for (auto const& file_link : file_item.value.file_links()) {
|
b75d2d36e12d4f32c448b4ae352a8b5cc14f00a6
|
2021-04-16 00:20:24
|
Andreas Kling
|
windowserver: Clean up some of the code around menu item hovering
| false
|
Clean up some of the code around menu item hovering
|
windowserver
|
diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp
index 0b0c10380e88..8d1208f37153 100644
--- a/Userland/Services/WindowServer/Menu.cpp
+++ b/Userland/Services/WindowServer/Menu.cpp
@@ -300,10 +300,11 @@ MenuItem* Menu::hovered_item() const
void Menu::update_for_new_hovered_item(bool make_input)
{
- if (hovered_item() && hovered_item()->is_submenu()) {
+ auto* hovered_item = this->hovered_item();
+ if (hovered_item && hovered_item->is_submenu()) {
VERIFY(menu_window());
- MenuManager::the().close_everyone_not_in_lineage(*hovered_item()->submenu());
- hovered_item()->submenu()->do_popup(hovered_item()->rect().top_right().translated(menu_window()->rect().location()), make_input, true);
+ MenuManager::the().close_everyone_not_in_lineage(*hovered_item->submenu());
+ hovered_item->submenu()->do_popup(hovered_item->rect().top_right().translated(menu_window()->rect().location()), make_input, true);
} else {
MenuManager::the().close_everyone_not_in_lineage(*this);
ensure_menu_window();
@@ -330,7 +331,7 @@ void Menu::descend_into_submenu_at_hovered_item()
auto submenu = hovered_item()->submenu();
VERIFY(submenu);
MenuManager::the().open_menu(*submenu, false);
- submenu->set_hovered_item(0);
+ submenu->set_hovered_index(0);
VERIFY(submenu->hovered_item()->type() != MenuItem::Separator);
}
@@ -353,12 +354,7 @@ void Menu::handle_mouse_move_event(const MouseEvent& mouse_event)
}
int index = item_index_at(mouse_event.position());
- if (m_hovered_item_index == index)
- return;
- m_hovered_item_index = index;
-
- update_for_new_hovered_item();
- return;
+ set_hovered_index(index);
}
void Menu::event(Core::Event& event)
@@ -380,11 +376,7 @@ void Menu::event(Core::Event& event)
m_scroll_offset = clamp(m_scroll_offset, 0, m_max_scroll_offset);
int index = item_index_at(mouse_event.position());
- if (m_hovered_item_index == index)
- return;
-
- m_hovered_item_index = index;
- update_for_new_hovered_item();
+ set_hovered_index(index);
return;
}
@@ -402,62 +394,65 @@ void Menu::event(Core::Event& event)
int counter = 0;
for (const auto& item : m_items) {
if (item.type() != MenuItem::Separator && item.is_enabled()) {
- m_hovered_item_index = counter;
+ set_hovered_index(counter, key == Key_Right);
break;
}
counter++;
}
- update_for_new_hovered_item(key == Key_Right);
return;
}
if (key == Key_Up) {
- VERIFY(m_items.at(0).type() != MenuItem::Separator);
+ VERIFY(item(0).type() != MenuItem::Separator);
if (is_scrollable() && m_hovered_item_index == 0)
return;
auto original_index = m_hovered_item_index;
+ auto new_index = original_index;
do {
- if (m_hovered_item_index == 0)
- m_hovered_item_index = m_items.size() - 1;
+ if (new_index == 0)
+ new_index = m_items.size() - 1;
else
- --m_hovered_item_index;
- if (m_hovered_item_index == original_index)
+ --new_index;
+ if (new_index == original_index)
return;
- } while (hovered_item()->type() == MenuItem::Separator || !hovered_item()->is_enabled());
+ } while (item(new_index).type() == MenuItem::Separator || !item(new_index).is_enabled());
- VERIFY(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1);
+ VERIFY(new_index >= 0);
+ VERIFY(new_index <= static_cast<int>(m_items.size()) - 1);
- if (is_scrollable() && m_hovered_item_index < m_scroll_offset)
+ if (is_scrollable() && new_index < m_scroll_offset)
--m_scroll_offset;
- update_for_new_hovered_item();
+ set_hovered_index(new_index);
return;
}
if (key == Key_Down) {
- VERIFY(m_items.at(0).type() != MenuItem::Separator);
+ VERIFY(item(0).type() != MenuItem::Separator);
if (is_scrollable() && m_hovered_item_index == static_cast<int>(m_items.size()) - 1)
return;
auto original_index = m_hovered_item_index;
+ auto new_index = original_index;
do {
- if (m_hovered_item_index == static_cast<int>(m_items.size()) - 1)
- m_hovered_item_index = 0;
+ if (new_index == static_cast<int>(m_items.size()) - 1)
+ new_index = 0;
else
- ++m_hovered_item_index;
- if (m_hovered_item_index == original_index)
+ ++new_index;
+ if (new_index == original_index)
return;
- } while (hovered_item()->type() == MenuItem::Separator || !hovered_item()->is_enabled());
+ } while (item(new_index).type() == MenuItem::Separator || !item(new_index).is_enabled());
- VERIFY(m_hovered_item_index >= 0 && m_hovered_item_index <= static_cast<int>(m_items.size()) - 1);
+ VERIFY(new_index >= 0);
+ VERIFY(new_index <= static_cast<int>(m_items.size()) - 1);
- if (is_scrollable() && m_hovered_item_index >= (m_scroll_offset + visible_item_count()))
+ if (is_scrollable() && new_index >= (m_scroll_offset + visible_item_count()))
++m_scroll_offset;
- update_for_new_hovered_item();
+ set_hovered_index(new_index);
return;
}
}
diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h
index fa26b7c3cee2..d289c5022ffe 100644
--- a/Userland/Services/WindowServer/Menu.h
+++ b/Userland/Services/WindowServer/Menu.h
@@ -101,10 +101,10 @@ class Menu final : public Core::Object {
MenuItem* hovered_item() const;
- void set_hovered_item(int index)
+ void set_hovered_index(int index, bool make_input = false)
{
m_hovered_item_index = index;
- update_for_new_hovered_item();
+ update_for_new_hovered_item(make_input);
}
void clear_hovered_item();
diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp
index 7be6729c40eb..539d6385ba7a 100644
--- a/Userland/Services/WindowServer/MenuManager.cpp
+++ b/Userland/Services/WindowServer/MenuManager.cpp
@@ -96,7 +96,7 @@ void MenuManager::event(Core::Event& event)
// with each keypress instead of activating immediately.
auto index = shortcut_item_indexes->at(0);
auto& item = m_current_menu->item(index);
- m_current_menu->set_hovered_item(index);
+ m_current_menu->set_hovered_index(index);
if (item.is_submenu())
m_current_menu->descend_into_submenu_at_hovered_item();
else
@@ -117,7 +117,7 @@ void MenuManager::event(Core::Event& event)
set_current_menu(m_open_menu_stack.at(it.index() - 1));
else {
if (m_current_menu->hovered_item())
- m_current_menu->set_hovered_item(-1);
+ m_current_menu->set_hovered_index(-1);
else {
auto* target_menu = previous_menu(m_current_menu);
if (target_menu) {
diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp
index 6eef418973df..6834221a8e8f 100644
--- a/Userland/Services/WindowServer/Window.cpp
+++ b/Userland/Services/WindowServer/Window.cpp
@@ -493,7 +493,7 @@ void Window::handle_keydown_event(const KeyEvent& event)
if (menu_to_open) {
frame().open_menubar_menu(*menu_to_open);
if (!menu_to_open->is_empty())
- menu_to_open->set_hovered_item(0);
+ menu_to_open->set_hovered_index(0);
return;
}
}
|
db0a48d34c3dfa689a2e284cc282a49785647cd0
|
2021-09-09 01:07:39
|
davidot
|
libjs: Restore the environment if an exception is thrown in 'with' block
| false
|
Restore the environment if an exception is thrown in 'with' block
|
libjs
|
diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp
index 80dd4f6448d4..658d5b608112 100644
--- a/Userland/Libraries/LibJS/AST.cpp
+++ b/Userland/Libraries/LibJS/AST.cpp
@@ -379,12 +379,13 @@ Value WithStatement::execute(Interpreter& interpreter, GlobalObject& global_obje
// 6. Let C be the result of evaluating Statement.
auto result = interpreter.execute_statement(global_object, m_body).value_or(js_undefined());
- if (interpreter.exception())
- return {};
// 7. Set the running execution context's LexicalEnvironment to oldEnv.
interpreter.vm().running_execution_context().lexical_environment = old_environment;
+ if (interpreter.exception())
+ return {};
+
// 8. Return Completion(UpdateEmpty(C, undefined)).
return result;
}
diff --git a/Userland/Libraries/LibJS/Tests/with-basic.js b/Userland/Libraries/LibJS/Tests/with-basic.js
index c2ef01698b40..110c454734c5 100644
--- a/Userland/Libraries/LibJS/Tests/with-basic.js
+++ b/Userland/Libraries/LibJS/Tests/with-basic.js
@@ -15,6 +15,7 @@ test("basic with statement functionality", () => {
}
expect(object.bar).toBe(2);
+ expect(() => foo).toThrowWithMessage(ReferenceError, "'foo' is not defined");
expect(bar).toBe(99);
});
@@ -22,3 +23,23 @@ test("basic with statement functionality", () => {
test("syntax error in strict mode", () => {
expect("'use strict'; with (foo) {}").not.toEval();
});
+
+test("restores lexical environment even when exception is thrown", () => {
+ var object = {
+ foo: 1,
+ get bar() {
+ throw Error();
+ },
+ };
+
+ try {
+ with (object) {
+ expect(foo).toBe(1);
+ bar;
+ }
+ expect().fail();
+ } catch (e) {
+ expect(() => foo).toThrowWithMessage(ReferenceError, "'foo' is not defined");
+ }
+ expect(() => foo).toThrowWithMessage(ReferenceError, "'foo' is not defined");
+});
|
22f7e800d2d0eecdf6f8d64b6c265eb05cad4546
|
2022-08-10 21:08:18
|
Brian Gianforcaro
|
kernel: Fix a typo and a grammar issue in code comments
| false
|
Fix a typo and a grammar issue in code comments
|
kernel
|
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index 743dc9394dc0..c0460d6b1412 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -1494,7 +1494,7 @@ void Thread::track_lock_release(LockRank rank)
// This is validated by toggling the least significant bit of the mask, and
// then bit wise or-ing the rank we are trying to release with the resulting
// mask. If the rank we are releasing is truly the highest rank then the mask
- // we get back will be equal to the current mask of stored on the thread.
+ // we get back will be equal to the current mask stored on the thread.
auto rank_is_in_order = [](auto mask_enum, auto rank_enum) -> bool {
auto mask = to_underlying(mask_enum);
auto rank = to_underlying(rank_enum);
diff --git a/Kernel/TimerQueue.cpp b/Kernel/TimerQueue.cpp
index cd2d77443836..3291f0db5d24 100644
--- a/Kernel/TimerQueue.cpp
+++ b/Kernel/TimerQueue.cpp
@@ -62,7 +62,7 @@ bool TimerQueue::add_timer_without_id(NonnullRefPtr<Timer> timer, clockid_t cloc
// Because timer handlers can execute on any processor and there is
// a race between executing a timer handler and cancel_timer() this
- // *must* be a RefPtr<Timer>. Otherwise calling cancel_timer() could
+ // *must* be a RefPtr<Timer>. Otherwise, calling cancel_timer() could
// inadvertently cancel another timer that has been created between
// returning from the timer handler and a call to cancel_timer().
timer->setup(clock_id, deadline, move(callback));
|
a655cf5b414ba10a0bf5046a313771711fcceb64
|
2020-07-24 04:33:24
|
Andreas Kling
|
libgui: Break up Window::event() into many smaller functions
| false
|
Break up Window::event() into many smaller functions
|
libgui
|
diff --git a/Libraries/LibGUI/Forward.h b/Libraries/LibGUI/Forward.h
index 43bbd7a21764..55c1b166e21e 100644
--- a/Libraries/LibGUI/Forward.h
+++ b/Libraries/LibGUI/Forward.h
@@ -38,6 +38,8 @@ class BoxLayout;
class Button;
class CheckBox;
class Command;
+class DragEvent;
+class DropEvent;
class FileSystemModel;
class Frame;
class GroupBox;
@@ -56,10 +58,12 @@ class Model;
class ModelEditingDelegate;
class ModelIndex;
class MouseEvent;
+class MultiPaintEvent;
class MultiView;
class PaintEvent;
class Painter;
class ResizeCorner;
+class ResizeEvent;
class ScrollBar;
class Slider;
class SortingProxyModel;
@@ -75,9 +79,10 @@ class TextDocument;
class TextDocumentLine;
class TextDocumentUndoCommand;
class TextEditor;
-class TreeView;
+class ThemeChangeEvent;
class ToolBar;
class ToolBarContainer;
+class TreeView;
class Variant;
class VerticalBoxLayout;
class VerticalSlider;
diff --git a/Libraries/LibGUI/Window.cpp b/Libraries/LibGUI/Window.cpp
index ce7685451b4b..30d4473de605 100644
--- a/Libraries/LibGUI/Window.cpp
+++ b/Libraries/LibGUI/Window.cpp
@@ -227,186 +227,217 @@ void Window::set_override_cursor(const Gfx::Bitmap& cursor)
WindowServerConnection::the().send_sync<Messages::WindowServer::SetWindowCustomOverrideCursor>(m_window_id, m_custom_cursor->to_shareable_bitmap(WindowServerConnection::the().server_pid()));
}
-void Window::event(Core::Event& event)
+void Window::handle_drop_event(DropEvent& event)
{
- if (event.type() == Event::Drop) {
- auto& drop_event = static_cast<DropEvent&>(event);
- if (!m_main_widget)
- return;
- auto result = m_main_widget->hit_test(drop_event.position());
- auto local_event = make<DropEvent>(result.local_position, drop_event.text(), drop_event.mime_data());
- ASSERT(result.widget);
- return result.widget->dispatch_event(*local_event, this);
- }
+ if (!m_main_widget)
+ return;
+ auto result = m_main_widget->hit_test(event.position());
+ auto local_event = make<DropEvent>(result.local_position, event.text(), event.mime_data());
+ ASSERT(result.widget);
+ return result.widget->dispatch_event(*local_event, this);
+}
- if (event.type() == Event::MouseUp || event.type() == Event::MouseDown || event.type() == Event::MouseDoubleClick || event.type() == Event::MouseMove || event.type() == Event::MouseWheel) {
- auto& mouse_event = static_cast<MouseEvent&>(event);
- if (m_global_cursor_tracking_widget) {
- auto window_relative_rect = m_global_cursor_tracking_widget->window_relative_rect();
- Gfx::IntPoint local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
- auto local_event = make<MouseEvent>((Event::Type)event.type(), local_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers(), mouse_event.wheel_delta());
- m_global_cursor_tracking_widget->dispatch_event(*local_event, this);
- return;
- }
- if (m_automatic_cursor_tracking_widget) {
- auto window_relative_rect = m_automatic_cursor_tracking_widget->window_relative_rect();
- Gfx::IntPoint local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
- auto local_event = make<MouseEvent>((Event::Type)event.type(), local_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers(), mouse_event.wheel_delta());
- m_automatic_cursor_tracking_widget->dispatch_event(*local_event, this);
- if (mouse_event.buttons() == 0)
- m_automatic_cursor_tracking_widget = nullptr;
- return;
- }
- if (!m_main_widget)
- return;
- auto result = m_main_widget->hit_test(mouse_event.position());
- auto local_event = make<MouseEvent>((Event::Type)event.type(), result.local_position, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers(), mouse_event.wheel_delta());
- ASSERT(result.widget);
- set_hovered_widget(result.widget);
- if (mouse_event.buttons() != 0 && !m_automatic_cursor_tracking_widget)
- m_automatic_cursor_tracking_widget = result.widget->make_weak_ptr();
- if (result.widget != m_global_cursor_tracking_widget.ptr())
- return result.widget->dispatch_event(*local_event, this);
+void Window::handle_mouse_event(MouseEvent& event)
+{
+ if (m_global_cursor_tracking_widget) {
+ auto window_relative_rect = m_global_cursor_tracking_widget->window_relative_rect();
+ Gfx::IntPoint local_point { event.x() - window_relative_rect.x(), event.y() - window_relative_rect.y() };
+ auto local_event = make<MouseEvent>((Event::Type)event.type(), local_point, event.buttons(), event.button(), event.modifiers(), event.wheel_delta());
+ m_global_cursor_tracking_widget->dispatch_event(*local_event, this);
return;
}
+ if (m_automatic_cursor_tracking_widget) {
+ auto window_relative_rect = m_automatic_cursor_tracking_widget->window_relative_rect();
+ Gfx::IntPoint local_point { event.x() - window_relative_rect.x(), event.y() - window_relative_rect.y() };
+ auto local_event = make<MouseEvent>((Event::Type)event.type(), local_point, event.buttons(), event.button(), event.modifiers(), event.wheel_delta());
+ m_automatic_cursor_tracking_widget->dispatch_event(*local_event, this);
+ if (event.buttons() == 0)
+ m_automatic_cursor_tracking_widget = nullptr;
+ return;
+ }
+ if (!m_main_widget)
+ return;
+ auto result = m_main_widget->hit_test(event.position());
+ auto local_event = make<MouseEvent>((Event::Type)event.type(), result.local_position, event.buttons(), event.button(), event.modifiers(), event.wheel_delta());
+ ASSERT(result.widget);
+ set_hovered_widget(result.widget);
+ if (event.buttons() != 0 && !m_automatic_cursor_tracking_widget)
+ m_automatic_cursor_tracking_widget = result.widget->make_weak_ptr();
+ if (result.widget != m_global_cursor_tracking_widget.ptr())
+ return result.widget->dispatch_event(*local_event, this);
+ return;
+}
- if (event.type() == Event::MultiPaint) {
- if (!is_visible())
- return;
- if (!m_main_widget)
- return;
- auto& paint_event = static_cast<MultiPaintEvent&>(event);
- auto rects = paint_event.rects();
- ASSERT(!rects.is_empty());
- if (m_back_bitmap && m_back_bitmap->size() != paint_event.window_size()) {
- // Eagerly discard the backing store if we learn from this paint event that it needs to be bigger.
- // Otherwise we would have to wait for a resize event to tell us. This way we don't waste the
- // effort on painting into an undersized bitmap that will be thrown away anyway.
- m_back_bitmap = nullptr;
- }
- bool created_new_backing_store = !m_back_bitmap;
- if (!m_back_bitmap) {
- m_back_bitmap = create_backing_bitmap(paint_event.window_size());
+void Window::handle_multi_paint_event(MultiPaintEvent& event)
+{
+ if (!is_visible())
+ return;
+ if (!m_main_widget)
+ return;
+ auto rects = event.rects();
+ ASSERT(!rects.is_empty());
+ if (m_back_bitmap && m_back_bitmap->size() != event.window_size()) {
+ // Eagerly discard the backing store if we learn from this paint event that it needs to be bigger.
+ // Otherwise we would have to wait for a resize event to tell us. This way we don't waste the
+ // effort on painting into an undersized bitmap that will be thrown away anyway.
+ m_back_bitmap = nullptr;
+ }
+ bool created_new_backing_store = !m_back_bitmap;
+ if (!m_back_bitmap) {
+ m_back_bitmap = create_backing_bitmap(event.window_size());
+ ASSERT(m_back_bitmap);
+ } else if (m_double_buffering_enabled) {
+ bool still_has_pixels = m_back_bitmap->shared_buffer()->set_nonvolatile();
+ if (!still_has_pixels) {
+ m_back_bitmap = create_backing_bitmap(event.window_size());
ASSERT(m_back_bitmap);
- } else if (m_double_buffering_enabled) {
- bool still_has_pixels = m_back_bitmap->shared_buffer()->set_nonvolatile();
- if (!still_has_pixels) {
- m_back_bitmap = create_backing_bitmap(paint_event.window_size());
- ASSERT(m_back_bitmap);
- created_new_backing_store = true;
- }
+ created_new_backing_store = true;
}
+ }
- auto rect = rects.first();
- if (rect.is_empty() || created_new_backing_store) {
- rects.clear();
- rects.append({ {}, paint_event.window_size() });
- }
+ auto rect = rects.first();
+ if (rect.is_empty() || created_new_backing_store) {
+ rects.clear();
+ rects.append({ {}, event.window_size() });
+ }
- for (auto& rect : rects) {
- PaintEvent paint_event(rect);
- m_main_widget->dispatch_event(paint_event, this);
- }
+ for (auto& rect : rects) {
+ PaintEvent paint_event(rect);
+ m_main_widget->dispatch_event(paint_event, this);
+ }
- if (m_double_buffering_enabled)
- flip(rects);
- else if (created_new_backing_store)
- set_current_backing_bitmap(*m_back_bitmap, true);
+ if (m_double_buffering_enabled)
+ flip(rects);
+ else if (created_new_backing_store)
+ set_current_backing_bitmap(*m_back_bitmap, true);
- if (is_visible()) {
- Vector<Gfx::IntRect> rects_to_send;
- for (auto& r : rects)
- rects_to_send.append(r);
- WindowServerConnection::the().post_message(Messages::WindowServer::DidFinishPainting(m_window_id, rects_to_send));
- }
- return;
+ if (is_visible()) {
+ Vector<Gfx::IntRect> rects_to_send;
+ for (auto& r : rects)
+ rects_to_send.append(r);
+ WindowServerConnection::the().post_message(Messages::WindowServer::DidFinishPainting(m_window_id, rects_to_send));
}
+}
- if (event.type() == Event::KeyUp || event.type() == Event::KeyDown) {
- if (m_focused_widget)
- return m_focused_widget->dispatch_event(event, this);
- if (m_main_widget)
- return m_main_widget->dispatch_event(event, this);
- return;
- }
+void Window::handle_key_event(KeyEvent& event)
+{
+ if (m_focused_widget)
+ return m_focused_widget->dispatch_event(event, this);
+ if (m_main_widget)
+ return m_main_widget->dispatch_event(event, this);
+}
- if (event.type() == Event::WindowBecameActive || event.type() == Event::WindowBecameInactive) {
- m_is_active = event.type() == Event::WindowBecameActive;
- if (on_activity_change)
- on_activity_change(m_is_active);
- if (m_main_widget)
- m_main_widget->dispatch_event(event, this);
- if (m_focused_widget)
- m_focused_widget->update();
- return;
+void Window::handle_resize_event(ResizeEvent& event)
+{
+ auto new_size = event.size();
+ if (m_back_bitmap && m_back_bitmap->size() != new_size)
+ m_back_bitmap = nullptr;
+ if (!m_pending_paint_event_rects.is_empty()) {
+ m_pending_paint_event_rects.clear_with_capacity();
+ m_pending_paint_event_rects.append({ {}, new_size });
}
+ m_rect_when_windowless = { {}, new_size };
+ m_main_widget->set_relative_rect({ {}, new_size });
+}
- if (event.type() == Event::WindowInputEntered || event.type() == Event::WindowInputLeft) {
- m_is_active_input = event.type() == Event::WindowInputEntered;
- if (on_active_input_change)
- on_active_input_change(m_is_active_input);
- if (m_main_widget)
- m_main_widget->dispatch_event(event, this);
- if (m_focused_widget)
- m_focused_widget->update();
- return;
- }
+void Window::handle_input_entered_or_left_event(Core::Event& event)
+{
+ m_is_active_input = event.type() == Event::WindowInputEntered;
+ if (on_active_input_change)
+ on_active_input_change(m_is_active_input);
+ if (m_main_widget)
+ m_main_widget->dispatch_event(event, this);
+ if (m_focused_widget)
+ m_focused_widget->update();
+}
- if (event.type() == Event::WindowCloseRequest) {
- if (on_close_request) {
- if (on_close_request() == Window::CloseRequestDecision::StayOpen)
- return;
- }
- close();
- return;
+void Window::handle_became_active_or_inactive_event(Core::Event& event)
+{
+ m_is_active = event.type() == Event::WindowBecameActive;
+ if (on_activity_change)
+ on_activity_change(m_is_active);
+ if (m_main_widget)
+ m_main_widget->dispatch_event(event, this);
+ if (m_focused_widget)
+ m_focused_widget->update();
+}
+
+void Window::handle_close_request()
+{
+ if (on_close_request) {
+ if (on_close_request() == Window::CloseRequestDecision::StayOpen)
+ return;
}
+ close();
+}
- if (event.type() == Event::WindowLeft) {
- set_hovered_widget(nullptr);
+void Window::handle_theme_change_event(ThemeChangeEvent& event)
+{
+ if (!m_main_widget)
return;
- }
+ auto dispatch_theme_change = [&](auto& widget, auto recursive) {
+ widget.dispatch_event(event, this);
+ widget.for_each_child_widget([&](auto& widget) -> IterationDecision {
+ widget.dispatch_event(event, this);
+ recursive(widget, recursive);
+ return IterationDecision::Continue;
+ });
+ };
+ dispatch_theme_change(*m_main_widget.ptr(), dispatch_theme_change);
+}
- if (event.type() == Event::Resize) {
- auto new_size = static_cast<ResizeEvent&>(event).size();
- if (m_back_bitmap && m_back_bitmap->size() != new_size)
- m_back_bitmap = nullptr;
- if (!m_pending_paint_event_rects.is_empty()) {
- m_pending_paint_event_rects.clear_with_capacity();
- m_pending_paint_event_rects.append({ {}, new_size });
- }
- m_rect_when_windowless = { {}, new_size };
- m_main_widget->set_relative_rect({ {}, new_size });
+void Window::handle_drag_move_event(DragEvent& event)
+{
+ if (!m_main_widget)
return;
- }
+ auto result = m_main_widget->hit_test(event.position());
+ auto local_event = make<DragEvent>(static_cast<Event::Type>(event.type()), result.local_position, event.data_type());
+ ASSERT(result.widget);
+ return result.widget->dispatch_event(*local_event, this);
+}
+
+void Window::handle_left_event()
+{
+ set_hovered_widget(nullptr);
+}
+
+void Window::event(Core::Event& event)
+{
+ if (event.type() == Event::Drop)
+ return handle_drop_event(static_cast<DropEvent&>(event));
+
+ if (event.type() == Event::MouseUp || event.type() == Event::MouseDown || event.type() == Event::MouseDoubleClick || event.type() == Event::MouseMove || event.type() == Event::MouseWheel)
+ return handle_mouse_event(static_cast<MouseEvent&>(event));
+
+ if (event.type() == Event::MultiPaint)
+ return handle_multi_paint_event(static_cast<MultiPaintEvent&>(event));
+
+ if (event.type() == Event::KeyUp || event.type() == Event::KeyDown)
+ return handle_key_event(static_cast<KeyEvent&>(event));
+
+ if (event.type() == Event::WindowBecameActive || event.type() == Event::WindowBecameInactive)
+ return handle_became_active_or_inactive_event(event);
+
+ if (event.type() == Event::WindowInputEntered || event.type() == Event::WindowInputLeft)
+ return handle_input_entered_or_left_event(event);
+
+ if (event.type() == Event::WindowCloseRequest)
+ return handle_close_request();
+
+ if (event.type() == Event::WindowLeft)
+ return handle_left_event();
+
+ if (event.type() == Event::Resize)
+ return handle_resize_event(static_cast<ResizeEvent&>(event));
if (event.type() > Event::__Begin_WM_Events && event.type() < Event::__End_WM_Events)
return wm_event(static_cast<WMEvent&>(event));
- if (event.type() == Event::DragMove) {
- if (!m_main_widget)
- return;
- auto& drag_event = static_cast<DragEvent&>(event);
- auto result = m_main_widget->hit_test(drag_event.position());
- auto local_event = make<DragEvent>(static_cast<Event::Type>(drag_event.type()), result.local_position, drag_event.data_type());
- ASSERT(result.widget);
- return result.widget->dispatch_event(*local_event, this);
- }
+ if (event.type() == Event::DragMove)
+ return handle_drag_move_event(static_cast<DragEvent&>(event));
- if (event.type() == Event::ThemeChange) {
- if (!m_main_widget)
- return;
- auto theme_event = static_cast<ThemeChangeEvent&>(event);
- auto dispatch_theme_change = [&](auto& widget, auto recursive) {
- widget.dispatch_event(theme_event, this);
- widget.for_each_child_widget([&](auto& widget) -> IterationDecision {
- widget.dispatch_event(theme_event, this);
- recursive(widget, recursive);
- return IterationDecision::Continue;
- });
- };
- dispatch_theme_change(*m_main_widget.ptr(), dispatch_theme_change);
- return;
- }
+ if (event.type() == Event::ThemeChange)
+ return handle_theme_change_event(static_cast<ThemeChangeEvent&>(event));
Core::Object::event(event);
}
@@ -810,5 +841,4 @@ void Window::set_progress(int progress)
ASSERT(m_window_id);
WindowServerConnection::the().post_message(Messages::WindowServer::SetWindowProgress(m_window_id, progress));
}
-
}
diff --git a/Libraries/LibGUI/Window.h b/Libraries/LibGUI/Window.h
index 2b505b6b0206..b6e8688978bb 100644
--- a/Libraries/LibGUI/Window.h
+++ b/Libraries/LibGUI/Window.h
@@ -209,6 +209,18 @@ class Window : public Core::Object {
private:
virtual bool is_window() const override final { return true; }
+ void handle_drop_event(DropEvent&);
+ void handle_mouse_event(MouseEvent&);
+ void handle_multi_paint_event(MultiPaintEvent&);
+ void handle_key_event(KeyEvent&);
+ void handle_resize_event(ResizeEvent&);
+ void handle_input_entered_or_left_event(Core::Event&);
+ void handle_became_active_or_inactive_event(Core::Event&);
+ void handle_close_request();
+ void handle_theme_change_event(ThemeChangeEvent&);
+ void handle_drag_move_event(DragEvent&);
+ void handle_left_event();
+
void server_did_destroy();
RefPtr<Gfx::Bitmap> create_backing_bitmap(const Gfx::IntSize&);
|
3250a424f0a5d449ea7c8256c44ad75149aa1051
|
2023-10-08 12:36:30
|
Andreas Kling
|
libweb: Don't offset abspos children of flex container by padding twice
| false
|
Don't offset abspos children of flex container by padding twice
|
libweb
|
diff --git a/Tests/LibWeb/Layout/expected/flex/abspos-flex-child-static-position-with-padding-on-flex-container.txt b/Tests/LibWeb/Layout/expected/flex/abspos-flex-child-static-position-with-padding-on-flex-container.txt
new file mode 100644
index 000000000000..1289eeb29bcf
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/flex/abspos-flex-child-static-position-with-padding-on-flex-container.txt
@@ -0,0 +1,20 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer <html> at (0,0) content-size 800x53.46875 [BFC] children: not-inline
+ BlockContainer <body> at (8,8) content-size 784x37.46875 children: not-inline
+ Box <div#flex-container> at (18,18) content-size 764x17.46875 flex-container(row) [FFC] children: not-inline
+ BlockContainer <div#absolute> at (18,18) content-size 50x50 positioned [BFC] children: not-inline
+ BlockContainer <div#orange> at (18,18) content-size 50x50 children: not-inline
+ BlockContainer <div#red> at (18,18) content-size 9.703125x17.46875 flex-item [BFC] children: inline
+ line 0 width: 9.703125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 1, rect: [18,18 9.703125x17.46875]
+ "x"
+ TextNode <#text>
+
+ViewportPaintable (Viewport<#document>) [0,0 800x600]
+ PaintableWithLines (BlockContainer<HTML>) [0,0 800x53.46875] overflow: [0,0 800x68]
+ PaintableWithLines (BlockContainer<BODY>) [8,8 784x37.46875] overflow: [8,8 784x60]
+ PaintableBox (Box<DIV>#flex-container) [8,8 784x37.46875] overflow: [8,8 784x60]
+ PaintableWithLines (BlockContainer<DIV>#absolute) [18,18 50x50]
+ PaintableWithLines (BlockContainer<DIV>#orange) [18,18 50x50]
+ PaintableWithLines (BlockContainer<DIV>#red) [18,18 9.703125x17.46875]
+ TextPaintable (TextNode<#text>)
diff --git a/Tests/LibWeb/Layout/input/flex/abspos-flex-child-static-position-with-padding-on-flex-container.html b/Tests/LibWeb/Layout/input/flex/abspos-flex-child-static-position-with-padding-on-flex-container.html
new file mode 100644
index 000000000000..c654dc8fac25
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/flex/abspos-flex-child-static-position-with-padding-on-flex-container.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html><html><head><style>
+#flex-container {
+ display: flex;
+ padding: 10px;
+}
+#absolute {
+ position: absolute;
+}
+#orange {
+ background-color: orange;
+ width: 50px;
+ height: 50px;
+}
+#red {
+ background-color: red;
+}
+</style></head><body><div id="flex-container"><div id="absolute"><div id="orange"></div></div><div id="red">x
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index 61f67908f68d..953d3e76f0af 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -2240,14 +2240,6 @@ CSSPixelPoint FlexFormattingContext::calculate_static_position(Box const& box) c
break;
}
- // NOTE: Next, we add the flex container's padding since abspos boxes are placed relative to the padding edge
- // of their abspos containing block.
- if (pack_from_end) {
- main_offset += is_row_layout() ? m_flex_container_state.padding_right : m_flex_container_state.padding_bottom;
- } else {
- main_offset += is_row_layout() ? m_flex_container_state.padding_left : m_flex_container_state.padding_top;
- }
-
if (pack_from_end)
main_offset += inner_main_size(flex_container()) - inner_main_size(box) - main_border_before - main_border_after;
|
e5a6c268ca816a321bcb0cade087751c2d8e116e
|
2023-07-18 03:56:23
|
dependabot[bot]
|
ci: Bump JamesIves/github-pages-deploy-action from 4.4.2 to 4.4.3
| false
|
Bump JamesIves/github-pages-deploy-action from 4.4.2 to 4.4.3
|
ci
|
diff --git a/.github/workflows/libjs-test262.yml b/.github/workflows/libjs-test262.yml
index b4f5210b2e6e..591ca05a9a16 100644
--- a/.github/workflows/libjs-test262.yml
+++ b/.github/workflows/libjs-test262.yml
@@ -150,7 +150,7 @@ jobs:
mv wasm-new-results.json ../../libjs-website/wasm/data/results.json
- name: Deploy to GitHub pages
- uses: JamesIves/[email protected]
+ uses: JamesIves/[email protected]
with:
git-config-name: BuggieBot
git-config-email: [email protected]
diff --git a/.github/workflows/manpages.yml b/.github/workflows/manpages.yml
index 948e4f1bafd3..8c9ed88c5bea 100644
--- a/.github/workflows/manpages.yml
+++ b/.github/workflows/manpages.yml
@@ -18,7 +18,7 @@ jobs:
- name: Actually build website
run: ./Meta/build-manpages-website.sh
- name: Deploy to GitHub pages
- uses: JamesIves/[email protected]
+ uses: JamesIves/[email protected]
with:
git-config-name: BuggieBot
git-config-email: [email protected]
diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml
index ace491d58773..1eb664484db4 100644
--- a/.github/workflows/wasm.yml
+++ b/.github/workflows/wasm.yml
@@ -96,7 +96,7 @@ jobs:
- name: "Deploy to GitHub Pages"
if: github.ref == 'refs/heads/master'
- uses: JamesIves/[email protected]
+ uses: JamesIves/[email protected]
with:
git-config-name: BuggieBot
git-config-email: [email protected]
|
4a359b5a42cc129fcd1624959412ec5c6b2db551
|
2023-06-07 02:49:50
|
Ben Wiederhake
|
meta: Check that local includes can be resolved
| false
|
Check that local includes can be resolved
|
meta
|
diff --git a/Meta/check-style.py b/Meta/check-style.py
index 971f724d907d..2ea2723ac95b 100755
--- a/Meta/check-style.py
+++ b/Meta/check-style.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import os
+import pathlib
import re
import subprocess
import sys
@@ -46,6 +47,16 @@
# LibC is supposed to be a system library; don't mention the directory.
BAD_INCLUDE_LIBC = re.compile("# *include <LibC/")
+# Make sure that all includes are either system includes or immediately resolvable local includes
+ANY_INCLUDE_PATTERN = re.compile('^ *# *include\\b.*[>"](?!\\)).*$', re.M)
+SYSTEM_INCLUDE_PATTERN = re.compile("^ *# *include *<([^>]+)>(?: /[*/].*)?$")
+LOCAL_INCLUDE_PATTERN = re.compile('^ *# *include *"([^>]+)"(?: /[*/].*)?$')
+INCLUDE_CHECK_EXCLUDES = {
+ "Userland/Libraries/LibCodeComprehension/Cpp/Tests/",
+ "Userland/Libraries/LibCpp/Tests/parser/",
+ "Userland/Libraries/LibCpp/Tests/preprocessor/",
+}
+
def should_check_file(filename):
if not filename.endswith('.cpp') and not filename.endswith('.h'):
@@ -67,20 +78,28 @@ def find_files_here_or_argv():
return filter(should_check_file, raw_list)
+def is_in_prefix_list(filename, prefix_list):
+ return any(
+ filename.startswith(prefix) for prefix in prefix_list
+ )
+
+
def run():
errors_license = []
errors_pragma_once_bad = []
errors_pragma_once_missing = []
errors_include_libc = []
+ errors_include_weird_format = []
+ errors_include_missing_local = []
for filename in find_files_here_or_argv():
with open(filename, "r") as f:
file_content = f.read()
- if not any(filename.startswith(forbidden_prefix) for forbidden_prefix in LICENSE_HEADER_CHECK_EXCLUDES):
+ if not is_in_prefix_list(filename, LICENSE_HEADER_CHECK_EXCLUDES):
if not GOOD_LICENSE_HEADER_PATTERN.search(file_content):
errors_license.append(filename)
if filename.endswith('.h'):
- if any(filename.startswith(forbidden_prefix) for forbidden_prefix in PRAGMA_ONCE_CHECK_EXCLUDES):
+ if is_in_prefix_list(filename, PRAGMA_ONCE_CHECK_EXCLUDES):
# File was excluded
pass
elif GOOD_PRAGMA_ONCE_PATTERN.search(file_content):
@@ -92,20 +111,58 @@ def run():
else:
# Bad, the '#pragma once' is missing completely.
errors_pragma_once_missing.append(filename)
- if not any(filename.startswith(forbidden_prefix) for forbidden_prefix in LIBC_CHECK_EXCLUDES):
+ if not is_in_prefix_list(filename, LIBC_CHECK_EXCLUDES):
if BAD_INCLUDE_LIBC.search(file_content):
errors_include_libc.append(filename)
-
+ if not is_in_prefix_list(filename, INCLUDE_CHECK_EXCLUDES):
+ file_directory = pathlib.Path(filename).parent
+ for include_line in ANY_INCLUDE_PATTERN.findall(file_content):
+ if SYSTEM_INCLUDE_PATTERN.match(include_line):
+ # Don't try to resolve system-style includes, as these might depend on generators.
+ continue
+ local_match = LOCAL_INCLUDE_PATTERN.match(include_line)
+ if local_match is None:
+ print(f"Cannot parse include-line '{include_line}' in {filename}")
+ if filename not in errors_include_weird_format:
+ errors_include_weird_format.append(filename)
+ continue
+ relative_filename = local_match.group(1)
+ referenced_file = file_directory.joinpath(relative_filename)
+ if not referenced_file.exists():
+ print(f"In {filename}: Cannot find {referenced_file}")
+ if filename not in errors_include_missing_local:
+ errors_include_missing_local.append(filename)
+
+ have_errors = False
if errors_license:
print("Files with bad licenses:", " ".join(errors_license))
+ have_errors = True
if errors_pragma_once_missing:
print("Files without #pragma once:", " ".join(errors_pragma_once_missing))
+ have_errors = True
if errors_pragma_once_bad:
print("Files with a bad #pragma once:", " ".join(errors_pragma_once_bad))
+ have_errors = True
if errors_include_libc:
- print("Files that include a LibC header using #include <LibC/...>:", " ".join(errors_include_libc))
-
- if errors_license or errors_pragma_once_missing or errors_pragma_once_bad or errors_include_libc:
+ print(
+ "Files that include a LibC header using #include <LibC/...>:",
+ " ".join(errors_include_libc),
+ )
+ have_errors = True
+ if errors_include_weird_format:
+ print(
+ "Files that contain badly-formatted #include statements:",
+ " ".join(errors_include_weird_format),
+ )
+ have_errors = True
+ if errors_include_missing_local:
+ print(
+ "Files that #include a missing local file:",
+ " ".join(errors_include_missing_local),
+ )
+ have_errors = True
+
+ if have_errors:
sys.exit(1)
|
3eff6024b112c66754b2f8cc46bc7720462f6993
|
2020-07-24 16:36:02
|
Andreas Kling
|
libweb: Add code generation for reflecting IDL attributes
| false
|
Add code generation for reflecting IDL attributes
|
libweb
|
diff --git a/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
index 51e6c67c4d6b..4e5da81a2378 100644
--- a/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
+++ b/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
@@ -25,6 +25,7 @@
*/
#include <AK/ByteBuffer.h>
+#include <AK/HashMap.h>
#include <AK/StringBuilder.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
@@ -65,6 +66,7 @@ struct Function {
Type return_type;
String name;
Vector<Parameter> parameters;
+ HashMap<String, String> extended_attributes;
size_t length() const
{
@@ -78,6 +80,7 @@ struct Attribute {
bool unsigned_ { false };
Type type;
String name;
+ HashMap<String, String> extended_attributes;
// Added for convenience after parsing
String getter_callback_name;
@@ -174,7 +177,7 @@ OwnPtr<Interface> parse_interface(const StringView& input)
return Type { name, nullable };
};
- auto parse_attribute = [&] {
+ auto parse_attribute = [&](HashMap<String, String>& extended_attributes) {
bool readonly = false;
bool unsigned_ = false;
if (next_is("readonly")) {
@@ -202,10 +205,11 @@ OwnPtr<Interface> parse_interface(const StringView& input)
attribute.name = name;
attribute.getter_callback_name = String::format("%s_getter", snake_name(attribute.name).characters());
attribute.setter_callback_name = String::format("%s_setter", snake_name(attribute.name).characters());
+ attribute.extended_attributes = move(extended_attributes);
interface->attributes.append(move(attribute));
};
- auto parse_function = [&] {
+ auto parse_function = [&](HashMap<String, String>& extended_attributes) {
auto return_type = parse_type();
consume_whitespace();
auto name = consume_while([](auto ch) { return !isspace(ch) && ch != '('; });
@@ -228,22 +232,45 @@ OwnPtr<Interface> parse_interface(const StringView& input)
consume_specific(';');
- interface->functions.append(Function { return_type, name, move(parameters) });
+ interface->functions.append(Function { return_type, name, move(parameters), move(extended_attributes) });
+ };
+
+ auto parse_extended_attributes = [&] {
+ HashMap<String, String> extended_attributes;
+ for (;;) {
+ consume_whitespace();
+ if (consume_if(']'))
+ break;
+ auto name = consume_while([](auto ch) { return ch != ']' && ch != '=' && ch != ','; });
+ if (consume_if('=')) {
+ auto value = consume_while([](auto ch) { return ch != ']' && ch != ','; });
+ extended_attributes.set(name, value);
+ } else {
+ extended_attributes.set(name, {});
+ }
+ }
+ consume_whitespace();
+ return extended_attributes;
};
for (;;) {
+ HashMap<String, String> extended_attributes;
consume_whitespace();
if (consume_if('}'))
break;
+ if (consume_if('[')) {
+ extended_attributes = parse_extended_attributes();
+ }
+
if (next_is("readonly") || next_is("attribute")) {
- parse_attribute();
+ parse_attribute(extended_attributes);
continue;
}
- parse_function();
+ parse_function(extended_attributes);
}
interface->wrapper_class = String::format("%sWrapper", interface->name.characters());
@@ -569,7 +596,13 @@ void generate_implementation(const IDL::Interface& interface)
out() << " auto* impl = impl_from(interpreter, global_object);";
out() << " if (!impl)";
out() << " return {};";
- out() << " auto retval = impl->" << snake_name(attribute.name) << "();";
+
+ if (attribute.extended_attributes.contains("Reflect")) {
+ out() << " auto retval = impl->attribute(HTML::AttributeNames::" << attribute.name << ");";
+ } else {
+ out() << " auto retval = impl->" << snake_name(attribute.name) << "();";
+ }
+
generate_return_statement(attribute.type);
out() << "}";
@@ -582,7 +615,11 @@ void generate_implementation(const IDL::Interface& interface)
generate_to_cpp(attribute, "value", "", "cpp_value", true);
- out() << " impl->set_" << snake_name(attribute.name) << "(cpp_value);";
+ if (attribute.extended_attributes.contains("Reflect")) {
+ out() << " impl->set_attribute(HTML::AttributeNames::" << attribute.name << ", cpp_value);";
+ } else {
+ out() << " impl->set_" << snake_name(attribute.name) << "(cpp_value);";
+ }
out() << "}";
}
}
|
c9c59602a4a47f2b930109321c7d276540b29fe1
|
2022-05-04 01:46:14
|
Tim Schumacher
|
ports: Return halflife to upstream
| false
|
Return halflife to upstream
|
ports
|
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md
index 7e2c820b9ff7..9fc0c70ff96b 100644
--- a/Ports/AvailablePorts.md
+++ b/Ports/AvailablePorts.md
@@ -74,7 +74,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`grep`](grep/) | GNU Grep | 3.7 | https://www.gnu.org/software/grep/ |
| [`griffon`](griffon/) | The Griffon Legend | 1.0 | https://www.scummvm.org/games/#games-griffon |
| [`gsl`](gsl/) | GNU Scientific Library | 2.7.1 | https://www.gnu.org/software/gsl/ |
-| [`halflife`](halflife/) | Half-Life | 1.0.0 | https://github.com/SerenityPorts/xash3d-fwgs |
+| [`halflife`](halflife/) | Half-Life | 2022.05.01 | https://github.com/FWGS/xash3d-fwgs |
| [`harfbuzz`](harfbuzz/) | HarfBuzz | 2.8.1 | https://github.com/harfbuzz/harfbuzz |
| [`hatari`](hatari/) | Atari ST/STE/TT/Falcon emulator | 2.4.0-devel | https://hatari.tuxfamily.org/ |
| [`imagemagick`](imagemagick/) | ImageMagick | 7.1.0-29 | https://imagemagick.org |
diff --git a/Ports/halflife/package.sh b/Ports/halflife/package.sh
index 4daf496ee1d5..0aff1baa971b 100755
--- a/Ports/halflife/package.sh
+++ b/Ports/halflife/package.sh
@@ -1,14 +1,20 @@
#!/usr/bin/env -S bash ../.port_include.sh
port="halflife"
-version="1.0.0"
+version="2022.05.01" # Bogus version, this was the last time the commit hashes were updated.
+_fwgs_commit=5402e1a2597c40c603bd0f2b1a9cd6a16506ec84
+_hlsdk_commit=808be9442f60b4388f68fcef8b2659d0cd6db17b
+_vgui_commit=93573075afe885618ea15831e72d44bdacd65bfb
+_mainui_commit=01e964fdc26f5dce1512c030d0dfd68e17be2858
+_miniutl_commit=67c8c226c451f32ee3c98b94e04f8966092b70d3
useconfigure="true"
depends=("SDL2" "fontconfig" "freetype")
workdir="."
-files="https://github.com/SerenityPorts/xash3d-fwgs/archive/master.tar.gz xash3d_engine.tar.gz
-https://github.com/SerenityPorts/hlsdk-xash3d/archive/master.tar.gz xash3d_hldll.tar.gz
-https://github.com/FWGS/vgui-dev/archive/master.tar.gz vgui-dev.tar.gz
-https://github.com/FWGS/mainui_cpp/archive/master.tar.gz mainui.tar.gz
-https://github.com/FWGS/miniutl/archive/master.tar.gz miniutl.tar.gz"
+files="https://github.com/FWGS/xash3d-fwgs/archive/${_fwgs_commit}.tar.gz xash3d-fwgs-${_fwgs_commit}.tar.gz 1401f6c0cf619c48a8a40938b2acdffd327725ca0ab59804c518bddf821637f9
+https://github.com/FWGS/hlsdk-xash3d/archive/${_hlsdk_commit}.tar.gz hlsdk-xash3d-${_hlsdk_commit}.tar.gz fd17436571341bd5e50739f22d84f9857f492637479144d01b1ffc1ead9d776b
+https://github.com/FWGS/vgui-dev/archive/${_vgui_commit}.tar.gz vgui-dev-${_vgui_commit}.tar.gz eb9315fba8ae444fdae240c10afebaf7f3b157233bf1589f0af557b2286928fa
+https://github.com/FWGS/mainui_cpp/archive/${_mainui_commit}.tar.gz mainui_cpp-${_mainui_commit}.tar.gz c8f6ce81596d5690044542074ac9bc69bbd43b5e5766f71363a8b5d4d382ad71
+https://github.com/FWGS/MiniUTL/archive/${_miniutl_commit}.tar.gz MiniUTL-${_miniutl_commit}.tar.gz 7b7b26377854b3fc741c8d652d8b3c9c540512644943ca6efb63df941b2861e3"
+auth_type=sha256
launcher_name="Half-Life"
launcher_category="Games"
launcher_command="sh /home/anon/Games/halflife/hl.sh"
@@ -18,40 +24,40 @@ export PKG_CONFIG_PATH="${SERENITY_INSTALL_ROOT}/usr/local/lib/pkgconfig"
# This one is a bit tricky to build, so I'm going a little bit off the script....
configure() {
# Initialize submodules from tarballs
- [ -e ./xash3d-fwgs-master/mainui ] && rm -r ./xash3d-fwgs-master/mainui
- cp -r mainui_cpp-master/ ./xash3d-fwgs-master/mainui
- rmdir ./xash3d-fwgs-master/mainui/miniutl
- cp -r MiniUTL-master/ ./xash3d-fwgs-master/mainui/miniutl
+ [ -e ./xash3d-fwgs-${_fwgs_commit}/mainui ] && rm -r ./xash3d-fwgs-${_fwgs_commit}/mainui
+ cp -r mainui_cpp-${_mainui_commit}/ ./xash3d-fwgs-${_fwgs_commit}/mainui
+ rmdir ./xash3d-fwgs-${_fwgs_commit}/mainui/miniutl
+ cp -r MiniUTL-${_miniutl_commit}/ ./xash3d-fwgs-${_fwgs_commit}/mainui/miniutl
# Configure the shared object projects (client and game)
- cd ./hlsdk-xash3d-master
+ cd ./hlsdk-xash3d-${_hlsdk_commit}
./waf configure -T release
cd ../
# Configure the engine itself...
- cd ./xash3d-fwgs-master
- ./waf configure --sdl2="${SERENITY_INSTALL_ROOT}/usr/local" --vgui=../vgui-dev-master/ -T release
+ cd ./xash3d-fwgs-${_fwgs_commit}
+ ./waf configure --sdl2="${SERENITY_INSTALL_ROOT}/usr/local" --vgui=../vgui-dev-${_vgui_commit}/ -T release
cd ../
}
build() {
# Build the game and client
- cd ./hlsdk-xash3d-master
+ cd ./hlsdk-xash3d-${_hlsdk_commit}
./waf build
cd ../
# Build the engine
- cd ./xash3d-fwgs-master
+ cd ./xash3d-fwgs-${_fwgs_commit}
./waf build
cd ../
}
install() {
- cd ./hlsdk-xash3d-master
+ cd ./hlsdk-xash3d-${_hlsdk_commit}
./waf install --destdir=${SERENITY_INSTALL_ROOT}/home/anon/Games/halflife
cd ../
- cd ./xash3d-fwgs-master
+ cd ./xash3d-fwgs-${_fwgs_commit}
./waf install --destdir=${SERENITY_INSTALL_ROOT}/home/anon/Games/halflife/
cd ../
}
diff --git a/Ports/halflife/patches/ReadMe.md b/Ports/halflife/patches/ReadMe.md
new file mode 100644
index 000000000000..6443812e34d9
--- /dev/null
+++ b/Ports/halflife/patches/ReadMe.md
@@ -0,0 +1,14 @@
+# Patches for halflife
+
+## `fwgs-add-serenity.patch`
+
+Add SerenityOS to the supported architectures of FWGS.
+
+## `hlsdk-add-serenity.patch`
+
+Add SerenityOS to the supported architectures of hlsdk.
+
+## `hlsdk-strings-compat.patch`
+
+This bypasses a bunch of `str[n]cmpcase` errors that occur due to weird LibC compatibility problems.
+
diff --git a/Ports/halflife/patches/fwgs-add-serenity.patch b/Ports/halflife/patches/fwgs-add-serenity.patch
new file mode 100644
index 000000000000..4e9d1885af14
--- /dev/null
+++ b/Ports/halflife/patches/fwgs-add-serenity.patch
@@ -0,0 +1,47 @@
+From 9b3a3057e154062384b46082d423285f21da28a2 Mon Sep 17 00:00:00 2001
+From: Jesse Buhagiar <[email protected]>
+Date: Sun, 2 Jan 2022 00:39:02 +1100
+Subject: [PATCH] Build: Add SerenityOS to list of compatible systems
+
+This is required by the build system to spit out a library with
+the correct name/platform.
+---
+ xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/build.c | 2 ++
+ xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/public/build.h | 4 ++++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/build.c b/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/build.c
+index c4ddaeeb2..42ba572c4 100644
+--- a/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/build.c
++++ b/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/engine/common/build.c
+@@ -95,6 +95,8 @@ const char *Q_buildos( void )
+ osname = "DOS4GW";
+ #elif XASH_HAIKU
+ osname = "haiku";
++#elif XASH_SERENITY
++ osname = "serenityos";
+ #else
+ #error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
+ #endif
+diff --git a/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/public/build.h b/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/public/build.h
+index 6e1f326d6..57a7735f4 100644
+--- a/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/public/build.h
++++ b/xash3d-fwgs-5402e1a2597c40c603bd0f2b1a9cd6a16506ec84/public/build.h
+@@ -74,6 +74,7 @@ For more information, please refer to <http://unlicense.org/>
+ #undef XASH_RISCV_DOUBLEFP
+ #undef XASH_RISCV_SINGLEFP
+ #undef XASH_RISCV_SOFTFP
++#undef XASH_SERENITY
+ #undef XASH_WIN32
+ #undef XASH_WIN64
+ #undef XASH_X86
+@@ -125,6 +126,9 @@ For more information, please refer to <http://unlicense.org/>
+ #elif defined __HAIKU__
+ #define XASH_HAIKU 1
+ #define XASH_POSIX 1
++#elif defined __serenity__
++ #define XASH_SERENITY 1
++ #define XASH_POSIX 1
+ #else
+ #error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
+ #endif
diff --git a/Ports/halflife/patches/hlsdk-add-serenity.patch b/Ports/halflife/patches/hlsdk-add-serenity.patch
new file mode 100644
index 000000000000..674ebc8488af
--- /dev/null
+++ b/Ports/halflife/patches/hlsdk-add-serenity.patch
@@ -0,0 +1,55 @@
+From cfeb76389a3f6ad2691a4838c95365f49305f16d Mon Sep 17 00:00:00 2001
+From: Jesse Buhagiar <[email protected]>
+Date: Sun, 2 Jan 2022 00:10:53 +1100
+Subject: [PATCH] Build: Add SerenityOS to list of compatible systems
+
+This is required by the build system to spit out a library with
+the correct name/platform.
+---
+ hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/public/build.h | 4 ++++
+ hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/scripts/waifulib/library_naming.py | 3 +++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/public/build.h b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/public/build.h
+index 3692cf175..5b6bcc362 100644
+--- a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/public/build.h
++++ b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/public/build.h
+@@ -75,6 +75,7 @@ For more information, please refer to <http://unlicense.org/>
+ #undef XASH_RISCV_DOUBLEFP
+ #undef XASH_RISCV_SINGLEFP
+ #undef XASH_RISCV_SOFTFP
++#undef XASH_SERENITY
+ #undef XASH_WIN32
+ #undef XASH_WIN64
+ #undef XASH_X86
+@@ -126,6 +127,9 @@ For more information, please refer to <http://unlicense.org/>
+ #elif defined __HAIKU__
+ #define XASH_HAIKU 1
+ #define XASH_POSIX 1
++#elif defined __serenity__
++ #define XASH_SERENITY 1
++ #define XASH_POSIX 1
+ #else
+ #error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
+ #endif
+diff --git a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/scripts/waifulib/library_naming.py b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/scripts/waifulib/library_naming.py
+index a3929067f..44ade2fd2 100644
+--- a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/scripts/waifulib/library_naming.py
++++ b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/scripts/waifulib/library_naming.py
+@@ -57,6 +57,7 @@
+ 'XASH_RISCV_DOUBLEFP',
+ 'XASH_RISCV_SINGLEFP',
+ 'XASH_RISCV_SOFTFP',
++'XASH_SERENITY',
+ 'XASH_WIN32',
+ 'XASH_WIN64',
+ 'XASH_X86',
+@@ -89,6 +90,8 @@ def configure(conf):
+ buildos = "dos4gw" # unused, just in case
+ elif conf.env.XASH_HAIKU:
+ buildos = "haiku"
++ elif conf.env.XASH_SERENITY:
++ buildos = "serenityos"
+ else:
+ conf.fatal("Place your operating system name in build.h and library_naming.py!\n"
+ "If this is a mistake, try to fix conditions above and report a bug")
diff --git a/Ports/halflife/patches/hlsdk-strings-compat.patch b/Ports/halflife/patches/hlsdk-strings-compat.patch
new file mode 100644
index 000000000000..854d5034dedf
--- /dev/null
+++ b/Ports/halflife/patches/hlsdk-strings-compat.patch
@@ -0,0 +1,24 @@
+From 673aea20b5917dd7e295f795eb0dd730598c9b0a Mon Sep 17 00:00:00 2001
+From: Jesse Buhagiar <[email protected]>
+Date: Sun, 2 Jan 2022 00:27:17 +1100
+Subject: [PATCH] Build: Add `__STRINGS_H_COMPAT_HACK` macro
+
+This bypasses a bunch of `str[n]cmpcase` errors that occur due to weird
+LibC compatibility problems.
+---
+ hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/wscript | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/wscript b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/wscript
+index 336e8d34f..684c575a5 100644
+--- a/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/wscript
++++ b/hlsdk-xash3d-808be9442f60b4388f68fcef8b2659d0cd6db17b/wscript
+@@ -171,7 +171,7 @@ def configure(conf):
+ elif conf.env.COMPILER_CC == 'owcc':
+ pass
+ else:
+- conf.env.append_unique('DEFINES', ['stricmp=strcasecmp', 'strnicmp=strncasecmp', '_snprintf=snprintf', '_vsnprintf=vsnprintf', '_LINUX', 'LINUX'])
++ conf.env.append_unique('DEFINES', ['stricmp=strcasecmp', 'strnicmp=strncasecmp', '_snprintf=snprintf', '_vsnprintf=vsnprintf', '_LINUX', 'LINUX', '__STRINGS_H_COMPAT_HACK'])
+ conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof', '-fno-rtti', '-fno-exceptions'])
+
+ # strip lib from pattern
|
13e4093da4e94e2a5bb5576fa8d3faedaa78dd46
|
2021-06-25 18:49:09
|
Gunnar Beutner
|
kernel: Move Multiboot header into a separate file
| false
|
Move Multiboot header into a separate file
|
kernel
|
diff --git a/Kernel/Arch/x86/common/Boot/multiboot.S b/Kernel/Arch/x86/common/Boot/multiboot.S
new file mode 100644
index 000000000000..1d43fa799b17
--- /dev/null
+++ b/Kernel/Arch/x86/common/Boot/multiboot.S
@@ -0,0 +1,28 @@
+.code32
+.set MULTIBOOT_MAGIC, 0x1badb002
+.set MULTIBOOT_PAGE_ALIGN, 0x1
+.set MULTIBOOT_MEMORY_INFO, 0x2
+.set MULTIBOOT_VIDEO_MODE, 0x4
+.set multiboot_flags, MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO
+.set multiboot_checksum, -(MULTIBOOT_MAGIC + multiboot_flags)
+
+.section .multiboot, "a"
+.align 4
+
+.long MULTIBOOT_MAGIC
+.long multiboot_flags
+.long multiboot_checksum
+
+
+/* for MULTIBOOT_MEMORY_INFO */
+.long 0x00000000 /* header_addr */
+.long 0x00000000 /* load_addr */
+.long 0x00000000 /* load_end_addr */
+.long 0x00000000 /* bss_end_addr */
+.long 0x00000000 /* entry_addr */
+
+/* for MULTIBOOT_VIDEO_MODE */
+.long 0x00000000 /* mode_type */
+.long 1280 /* width */
+.long 1024 /* height */
+.long 32 /* depth */
diff --git a/Kernel/Arch/x86/i386/Boot/boot.S b/Kernel/Arch/x86/i386/Boot/boot.S
index 33e48097df75..8b1b8f53c3af 100644
--- a/Kernel/Arch/x86/i386/Boot/boot.S
+++ b/Kernel/Arch/x86/i386/Boot/boot.S
@@ -1,31 +1,3 @@
-.set MULTIBOOT_MAGIC, 0x1badb002
-.set MULTIBOOT_PAGE_ALIGN, 0x1
-.set MULTIBOOT_MEMORY_INFO, 0x2
-.set MULTIBOOT_VIDEO_MODE, 0x4
-.set multiboot_flags, MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO
-.set multiboot_checksum, -(MULTIBOOT_MAGIC + multiboot_flags)
-
-.section .multiboot, "a"
-.align 4
-
-.long MULTIBOOT_MAGIC
-.long multiboot_flags
-.long multiboot_checksum
-
-
-/* for MULTIBOOT_MEMORY_INFO */
-.long 0x00000000 /* header_addr */
-.long 0x00000000 /* load_addr */
-.long 0x00000000 /* load_end_addr */
-.long 0x00000000 /* bss_end_addr */
-.long 0x00000000 /* entry_addr */
-
-/* for MULTIBOOT_VIDEO_MODE */
-.long 0x00000000 /* mode_type */
-.long 1280 /* width */
-.long 1024 /* height */
-.long 32 /* depth */
-
.section .stack, "aw", @nobits
stack_bottom:
.skip 32768
diff --git a/Kernel/Arch/x86/x86_64/Boot/boot.S b/Kernel/Arch/x86/x86_64/Boot/boot.S
index 1716536df47c..59920cf3aacb 100644
--- a/Kernel/Arch/x86/x86_64/Boot/boot.S
+++ b/Kernel/Arch/x86/x86_64/Boot/boot.S
@@ -1,32 +1,4 @@
.code32
-.set MULTIBOOT_MAGIC, 0x1badb002
-.set MULTIBOOT_PAGE_ALIGN, 0x1
-.set MULTIBOOT_MEMORY_INFO, 0x2
-.set MULTIBOOT_VIDEO_MODE, 0x4
-.set multiboot_flags, MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_MODE
-.set multiboot_checksum, -(MULTIBOOT_MAGIC + multiboot_flags)
-
-.section .multiboot
-.align 4
-
-.long MULTIBOOT_MAGIC
-.long multiboot_flags
-.long multiboot_checksum
-
-
-/* for MULTIBOOT_MEMORY_INFO */
-.long 0x00000000 /* header_addr */
-.long 0x00000000 /* load_addr */
-.long 0x00000000 /* load_end_addr */
-.long 0x00000000 /* bss_end_addr */
-.long 0x00000000 /* entry_addr */
-
-/* for MULTIBOOT_VIDEO_MODE */
-.long 0x00000000 /* mode_type */
-.long 1280 /* width */
-.long 1024 /* height */
-.long 32 /* depth */
-
.section .stack, "aw", @nobits
stack_bottom:
.skip 32768
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt
index b3bfdf8de0cb..86d17579b454 100644
--- a/Kernel/CMakeLists.txt
+++ b/Kernel/CMakeLists.txt
@@ -281,6 +281,7 @@ set(KERNEL_SOURCES
set(KERNEL_SOURCES
${KERNEL_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/ASM_wrapper.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/Boot/multiboot.S
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/CPU.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/Interrupts.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Arch/x86/common/Processor.cpp
|
963b0f76cfc4847318ece4267533151db73494d5
|
2022-01-09 04:13:03
|
Linus Groh
|
libjs: Remove now unused VM::{set_,}last_value()
| false
|
Remove now unused VM::{set_,}last_value()
|
libjs
|
diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
index ab704b498550..9ac95b633949 100644
--- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
@@ -45,8 +45,6 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
TemporaryChange restore_executable { m_current_executable, &executable };
- vm().set_last_value(Badge<Interpreter> {}, {});
-
ExecutionContext execution_context(vm().heap());
if (vm().execution_context_stack().is_empty()) {
execution_context.this_value = &global_object();
@@ -137,8 +135,6 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
}
}
- vm().set_last_value(Badge<Interpreter> {}, accumulator());
-
OwnPtr<RegisterWindow> frame;
if (!m_manually_entered_frames.last()) {
frame = m_register_windows.take_last();
diff --git a/Userland/Libraries/LibJS/Interpreter.cpp b/Userland/Libraries/LibJS/Interpreter.cpp
index bcd17733b207..18d50349181c 100644
--- a/Userland/Libraries/LibJS/Interpreter.cpp
+++ b/Userland/Libraries/LibJS/Interpreter.cpp
@@ -47,8 +47,6 @@ ThrowCompletionOr<Value> Interpreter::run(GlobalObject& global_object, const Pro
VM::InterpreterExecutionScope scope(*this);
- vm.set_last_value(Badge<Interpreter> {}, {});
-
ExecutionContext execution_context(heap());
execution_context.current_node = &program;
execution_context.this_value = &global_object;
@@ -60,7 +58,6 @@ ThrowCompletionOr<Value> Interpreter::run(GlobalObject& global_object, const Pro
execution_context.is_strict_mode = program.is_strict_mode();
MUST(vm.push_execution_context(execution_context, global_object));
auto completion = program.execute(*this, global_object);
- vm.set_last_value(Badge<Interpreter> {}, completion.value().value_or(js_undefined()));
// At this point we may have already run any queued promise jobs via on_call_stack_emptied,
// in which case this is a no-op.
diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp
index 6aec616e39dd..29eea9eb9260 100644
--- a/Userland/Libraries/LibJS/Runtime/VM.cpp
+++ b/Userland/Libraries/LibJS/Runtime/VM.cpp
@@ -97,9 +97,6 @@ void VM::gather_roots(HashTable<Cell*>& roots)
roots.set(m_exception);
- if (m_last_value.is_cell())
- roots.set(&m_last_value.as_cell());
-
auto gather_roots_from_execution_context_stack = [&roots](Vector<ExecutionContext*> const& stack) {
for (auto& execution_context : stack) {
if (execution_context->this_value.is_cell())
diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h
index 74e3fac855f4..90bdb6a360b1 100644
--- a/Userland/Libraries/LibJS/Runtime/VM.h
+++ b/Userland/Libraries/LibJS/Runtime/VM.h
@@ -148,10 +148,6 @@ class VM : public RefCounted<VM> {
ThrowCompletionOr<Value> resolve_this_binding(GlobalObject&);
- Value last_value() const { return m_last_value; }
- void set_last_value(Badge<Bytecode::Interpreter>, Value value) { m_last_value = value; }
- void set_last_value(Badge<Interpreter>, Value value) { m_last_value = value; }
-
const StackInfo& stack_info() const { return m_stack_info; };
bool underscore_is_last_value() const { return m_underscore_is_last_value; }
@@ -261,8 +257,6 @@ class VM : public RefCounted<VM> {
Vector<Vector<ExecutionContext*>> m_saved_execution_context_stacks;
- Value m_last_value;
-
StackInfo m_stack_info;
HashMap<String, Symbol*> m_global_symbol_map;
|
06a8674eec6ca72d4e11aab5aa6bc5088c4da24e
|
2024-02-22 00:22:35
|
Matthew Olsson
|
libweb: Simplify Animation::update_finished_state a bit
| false
|
Simplify Animation::update_finished_state a bit
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/Animations/Animation.cpp b/Userland/Libraries/LibWeb/Animations/Animation.cpp
index 338d607af60a..223802197b50 100644
--- a/Userland/Libraries/LibWeb/Animations/Animation.cpp
+++ b/Userland/Libraries/LibWeb/Animations/Animation.cpp
@@ -630,6 +630,8 @@ WebIDL::ExceptionOr<void> Animation::silently_set_current_time(Optional<double>
// https://www.w3.org/TR/web-animations-1/#update-an-animations-finished-state
void Animation::update_finished_state(DidSeek did_seek, SynchronouslyNotify synchronously_notify)
{
+ auto& realm = this->realm();
+
// 1. Let the unconstrained current time be the result of calculating the current time substituting an unresolved
// time value for the hold time if did seek is false. If did seek is true, the unconstrained current time is
// equal to the current time.
@@ -706,30 +708,23 @@ void Animation::update_finished_state(DidSeek did_seek, SynchronouslyNotify sync
if (current_finished_state && !m_is_finished) {
// 1. Let finish notification steps refer to the following procedure:
JS::SafeFunction<void()> finish_notification_steps = [&]() {
- if (m_should_abort_finish_notification_microtask) {
- m_should_abort_finish_notification_microtask = false;
- m_has_finish_notification_microtask_scheduled = false;
- return;
- }
-
// 1. If animation’s play state is not equal to finished, abort these steps.
if (play_state() != Bindings::AnimationPlayState::Finished)
return;
// 2. Resolve animation’s current finished promise object with animation.
{
- HTML::TemporaryExecutionContext execution_context { Bindings::host_defined_environment_settings_object(realm()) };
- WebIDL::resolve_promise(realm(), current_finished_promise(), this);
+ HTML::TemporaryExecutionContext execution_context { Bindings::host_defined_environment_settings_object(realm) };
+ WebIDL::resolve_promise(realm, current_finished_promise(), this);
}
m_is_finished = true;
// 3. Create an AnimationPlaybackEvent, finishEvent.
// 4. Set finishEvent’s type attribute to finish.
// 5. Set finishEvent’s currentTime attribute to the current time of animation.
- auto& realm = this->realm();
AnimationPlaybackEventInit init;
init.current_time = current_time();
- auto finish_event = AnimationPlaybackEvent::create(realm, "finish"_fly_string, init);
+ auto finish_event = AnimationPlaybackEvent::create(realm, HTML::EventNames::finish, init);
// 6. Set finishEvent’s timelineTime attribute to the current time of the timeline with which animation is
// associated. If animation is not associated with a timeline, or the timeline is inactive, let
@@ -750,44 +745,47 @@ void Animation::update_finished_state(DidSeek did_seek, SynchronouslyNotify sync
// Otherwise, queue a task to dispatch finishEvent at animation. The task source for this task is the DOM
// manipulation task source.
else {
- HTML::queue_global_task(HTML::Task::Source::DOMManipulation, realm.global_object(), [this, finish_event]() {
+ // Manually create a task so its ID can be saved
+ auto& document = verify_cast<HTML::Window>(realm.global_object()).associated_document();
+ auto task = HTML::Task::create(HTML::Task::Source::DOMManipulation, &document, [this, finish_event]() {
dispatch_event(finish_event);
});
+ m_pending_finish_microtask_id = task->id();
+ HTML::main_thread_event_loop().task_queue().add(move(task));
}
-
- m_has_finish_notification_microtask_scheduled = false;
};
// 2. If synchronously notify is true, cancel any queued microtask to run the finish notification steps for this
// animation, and run the finish notification steps immediately.
if (synchronously_notify == SynchronouslyNotify::Yes) {
- m_should_abort_finish_notification_microtask = false;
+ if (m_pending_finish_microtask_id.has_value()) {
+ HTML::main_thread_event_loop().task_queue().remove_tasks_matching([id = move(m_pending_finish_microtask_id)](auto const& task) {
+ return task.id() == id;
+ });
+ }
finish_notification_steps();
- m_should_abort_finish_notification_microtask = true;
}
// Otherwise, if synchronously notify is false, queue a microtask to run finish notification steps for
// animation unless there is already a microtask queued to run those steps for animation.
- else {
- if (!m_has_finish_notification_microtask_scheduled)
- HTML::queue_a_microtask({}, move(finish_notification_steps));
-
- m_has_finish_notification_microtask_scheduled = true;
- m_should_abort_finish_notification_microtask = false;
+ else if (!m_pending_finish_microtask_id.has_value()) {
+ auto& document = verify_cast<HTML::Window>(realm.global_object()).associated_document();
+ auto task = HTML::Task::create(HTML::Task::Source::DOMManipulation, &document, move(finish_notification_steps));
+ m_pending_finish_microtask_id = task->id();
+ HTML::main_thread_event_loop().task_queue().add(move(task));
}
}
// 6. If current finished state is false and animation’s current finished promise is already resolved, set
// animation’s current finished promise to a new promise in the relevant Realm of animation.
if (!current_finished_state && m_is_finished) {
- m_current_finished_promise = WebIDL::create_promise(realm());
+ {
+ HTML::TemporaryExecutionContext execution_context { Bindings::host_defined_environment_settings_object(realm) };
+ m_current_finished_promise = WebIDL::create_promise(realm);
+ }
m_is_finished = false;
}
- // Invalidate the style of our target element, if applicable
- if (m_effect) {
- if (auto target = m_effect->target())
- target->invalidate_style();
- }
+ invalidate_effect();
}
// Step 12 of https://www.w3.org/TR/web-animations-1/#playing-an-animation-section
@@ -881,6 +879,14 @@ JS::NonnullGCPtr<WebIDL::Promise> Animation::current_finished_promise() const
return *m_current_finished_promise;
}
+void Animation::invalidate_effect()
+{
+ if (m_effect) {
+ if (auto target = m_effect->target())
+ target->invalidate_style();
+ }
+}
+
Animation::Animation(JS::Realm& realm)
: DOM::EventTarget(realm)
{
diff --git a/Userland/Libraries/LibWeb/Animations/Animation.h b/Userland/Libraries/LibWeb/Animations/Animation.h
index 6e11f823cc57..5c5b99965657 100644
--- a/Userland/Libraries/LibWeb/Animations/Animation.h
+++ b/Userland/Libraries/LibWeb/Animations/Animation.h
@@ -120,6 +120,8 @@ class Animation : public DOM::EventTarget {
JS::NonnullGCPtr<WebIDL::Promise> current_ready_promise() const;
JS::NonnullGCPtr<WebIDL::Promise> current_finished_promise() const;
+ void invalidate_effect();
+
// https://www.w3.org/TR/web-animations-1/#dom-animation-id
FlyString m_id;
@@ -164,10 +166,7 @@ class Animation : public DOM::EventTarget {
// https://www.w3.org/TR/web-animations-1/#pending-pause-task
TaskState m_pending_pause_task { TaskState::None };
- // Flags used to manage the finish notification microtask and ultimately prevent more than one finish notification
- // microtask from being queued at any given time
- bool m_should_abort_finish_notification_microtask { false };
- bool m_has_finish_notification_microtask_scheduled { false };
+ Optional<int> m_pending_finish_microtask_id;
};
}
diff --git a/Userland/Libraries/LibWeb/HTML/EventNames.h b/Userland/Libraries/LibWeb/HTML/EventNames.h
index 91329aa490df..e45b95a5e229 100644
--- a/Userland/Libraries/LibWeb/HTML/EventNames.h
+++ b/Userland/Libraries/LibWeb/HTML/EventNames.h
@@ -49,6 +49,7 @@ namespace Web::HTML::EventNames {
__ENUMERATE_HTML_EVENT(emptied) \
__ENUMERATE_HTML_EVENT(ended) \
__ENUMERATE_HTML_EVENT(error) \
+ __ENUMERATE_HTML_EVENT(finish) \
__ENUMERATE_HTML_EVENT(focus) \
__ENUMERATE_HTML_EVENT(formdata) \
__ENUMERATE_HTML_EVENT(hashchange) \
|
4043e770e5f00b7ed869226392599a94ccaf2000
|
2021-02-17 19:11:36
|
AnotherTest
|
kernel: Don't go through ARP for IP broadcast messages
| false
|
Don't go through ARP for IP broadcast messages
|
kernel
|
diff --git a/Kernel/Net/Routing.cpp b/Kernel/Net/Routing.cpp
index 2c813c9afaf6..a7cc5f519cad 100644
--- a/Kernel/Net/Routing.cpp
+++ b/Kernel/Net/Routing.cpp
@@ -205,6 +205,12 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
return { nullptr, {} };
}
+ // If it's a broadcast, we already know everything we need to know.
+ // FIXME: We should also deal with the case where `target_addr` is
+ // a broadcast to a subnet rather than a full broadcast.
+ if (target_addr == 0xffffffff && matches(adapter))
+ return { adapter, { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
+
{
LOCKER(arp_table().lock());
auto addr = arp_table().resource().get(next_hop_ip);
|
08788072c15a4114ae16c0defd51c8f776f4149f
|
2023-08-14 21:16:46
|
Aliaksandr Kalenik
|
libweb: Add SessionHistoryTraversalQueue
| false
|
Add SessionHistoryTraversalQueue
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.cpp b/Userland/Libraries/LibWeb/HTML/Navigable.cpp
index 898768de4c3c..84bd71e329eb 100644
--- a/Userland/Libraries/LibWeb/HTML/Navigable.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Navigable.cpp
@@ -939,61 +939,64 @@ WebIDL::ExceptionOr<void> Navigable::navigate(
// for historyEntry, given navigable, "navigate", sourceSnapshotParams,
// targetSnapshotParams, navigationId, navigationParams, cspNavigationType, with allowPOST
// set to true and completionSteps set to the following step:
- populate_session_history_entry_document(history_entry, navigation_params, navigation_id, source_snapshot_params, [this, history_entry, history_handling] {
- // https://html.spec.whatwg.org/multipage/browsing-the-web.html#finalize-a-cross-document-navigation
+ populate_session_history_entry_document(history_entry, navigation_params, navigation_id, source_snapshot_params, [this, history_entry, history_handling, navigation_id] {
+ traversable_navigable()->append_session_history_traversal_steps([this, history_entry, history_handling, navigation_id] {
+ // https://html.spec.whatwg.org/multipage/browsing-the-web.html#finalize-a-cross-document-navigation
- // 1. FIXME: Assert: this is running on navigable's traversable navigable's session history traversal queue.
+ // 1. FIXME: Assert: this is running on navigable's traversable navigable's session history traversal queue.
- // 2. Set navigable's is delaying load events to false.
- set_delaying_load_events(false);
+ // 2. Set navigable's is delaying load events to false.
+ set_delaying_load_events(false);
- // 3. If historyEntry's document is null, then return.
- if (!history_entry->document_state->document())
- return;
+ // 3. If historyEntry's document is null, then return.
+ if (!history_entry->document_state->document())
+ return;
- // 4. FIXME: If all of the following are true:
- // - navigable's parent is null;
- // - historyEntry's document's browsing context is not an auxiliary browsing context whose opener browsing context is non-null; and
- // - historyEntry's document's origin is not navigable's active document's origin
- // then set historyEntry's document state's navigable target name to the empty string.
+ // 4. FIXME: If all of the following are true:
+ // - navigable's parent is null;
+ // - historyEntry's document's browsing context is not an auxiliary browsing context whose opener browsing context is non-null; and
+ // - historyEntry's document's origin is not navigable's active document's origin
+ // then set historyEntry's document state's navigable target name to the empty string.
- // 5. Let entryToReplace be navigable's active session history entry if historyHandling is "replace", otherwise null.
- auto entry_to_replace = history_handling == HistoryHandlingBehavior::Replace ? active_session_history_entry() : nullptr;
+ // 5. Let entryToReplace be navigable's active session history entry if historyHandling is "replace", otherwise null.
+ auto entry_to_replace = history_handling == HistoryHandlingBehavior::Replace ? active_session_history_entry() : nullptr;
- // 6. Let traversable be navigable's traversable navigable.
- auto traversable = traversable_navigable();
+ // 6. Let traversable be navigable's traversable navigable.
+ auto traversable = traversable_navigable();
- // 7. Let targetStep be null.
- int target_step;
+ // 7. Let targetStep be null.
+ int target_step;
- // 8. Let targetEntries be the result of getting session history entries for navigable.
- auto& target_entries = get_session_history_entries();
+ // 8. Let targetEntries be the result of getting session history entries for navigable.
+ auto& target_entries = get_session_history_entries();
- // 9. If entryToReplace is null, then:
- if (entry_to_replace == nullptr) {
- // FIXME: 1. Clear the forward session history of traversable.
+ // 9. If entryToReplace is null, then:
+ if (entry_to_replace == nullptr) {
+ // FIXME: 1. Clear the forward session history of traversable.
+ traversable->clear_the_forward_session_history();
- // 2. Set targetStep to traversable's current session history step + 1.
- target_step = traversable->current_session_history_step() + 1;
+ // 2. Set targetStep to traversable's current session history step + 1.
+ target_step = traversable->current_session_history_step() + 1;
- // 3. Set historyEntry's step to targetStep.
- history_entry->step = target_step;
+ // 3. Set historyEntry's step to targetStep.
+ history_entry->step = target_step;
- // 4. Append historyEntry to targetEntries.
- target_entries.append(move(history_entry));
- } else {
- // 1. Replace entryToReplace with historyEntry in targetEntries.
- *(target_entries.find(*entry_to_replace)) = history_entry;
+ // 4. Append historyEntry to targetEntries.
+ target_entries.append(move(history_entry));
+ } else {
+ // 1. Replace entryToReplace with historyEntry in targetEntries.
+ *(target_entries.find(*entry_to_replace)) = history_entry;
- // 2. Set historyEntry's step to entryToReplace's step.
- history_entry->step = entry_to_replace->step;
+ // 2. Set historyEntry's step to entryToReplace's step.
+ history_entry->step = entry_to_replace->step;
- // 3. Set targetStep to traversable's current session history step.
- target_step = traversable->current_session_history_step();
- }
+ // 3. Set targetStep to traversable's current session history step.
+ target_step = traversable->current_session_history_step();
+ }
- // 10. Apply the history step targetStep to traversable.
- traversable->apply_the_history_step(target_step);
+ // 10. Apply the history step targetStep to traversable.
+ traversable->apply_the_history_step(target_step);
+ });
}).release_value_but_fixme_should_propagate_errors();
});
@@ -1022,10 +1025,11 @@ void Navigable::reload()
// 2. Let traversable be navigable's traversable navigable.
auto traversable = traversable_navigable();
- // FIXME: 3. Append the following session history traversal steps to traversable:
-
- // 1. Apply pending history changes to traversable with true.
- traversable->apply_pending_history_changes();
+ // 3. Append the following session history traversal steps to traversable:
+ traversable->append_session_history_traversal_steps([traversable] {
+ // 1. Apply pending history changes to traversable with true.
+ traversable->apply_pending_history_changes();
+ });
}
}
diff --git a/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp b/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp
index 4f4d1b0488a9..cc4197f47866 100644
--- a/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp
+++ b/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp
@@ -102,30 +102,31 @@ WebIDL::ExceptionOr<void> NavigableContainer::create_new_child_navigable()
// 11. Let traversable be parentNavigable's traversable navigable.
auto traversable = parent_navigable->traversable_navigable();
- // FIXME: 12. Append the following session history traversal steps to traversable:
+ // 12. Append the following session history traversal steps to traversable:
+ traversable->append_session_history_traversal_steps([traversable, navigable, parent_navigable, history_entry] {
+ // 1. Let parentDocState be parentNavigable's active session history entry's document state.
- // 1. Let parentDocState be parentNavigable's active session history entry's document state.
+ auto parent_doc_state = parent_navigable->active_session_history_entry()->document_state;
- auto parent_doc_state = parent_navigable->active_session_history_entry()->document_state;
+ // 2. Let targetStepSHE be the first session history entry in traversable's session history entries whose document state equals parentDocState.
+ auto target_step_she = *(traversable->session_history_entries().find_if([parent_doc_state](auto& entry) {
+ return entry->document_state == parent_doc_state;
+ }));
- // 2. Let targetStepSHE be the first session history entry in traversable's session history entries whose document state equals parentDocState.
- auto target_step_she = *(traversable->session_history_entries().find_if([parent_doc_state](auto& entry) {
- return entry->document_state == parent_doc_state;
- }));
+ // 3. Set historyEntry's step to targetStepSHE's step.
+ history_entry->step = target_step_she->step;
- // 3. Set historyEntry's step to targetStepSHE's step.
- history_entry->step = target_step_she->step;
+ // 4. Let nestedHistory be a new nested history whose id is navigable's id and entries list is « historyEntry ».
+ DocumentState::NestedHistory nested_history {
+ .id = navigable->id(),
+ .entries { *history_entry },
+ };
- // 4. Let nestedHistory be a new nested history whose id is navigable's id and entries list is « historyEntry ».
- DocumentState::NestedHistory nested_history {
- .id = navigable->id(),
- .entries { *history_entry },
- };
+ // 5. Append nestedHistory to parentDocState's nested histories.
+ parent_doc_state->nested_histories().append(move(nested_history));
- // 5. Append nestedHistory to parentDocState's nested histories.
- parent_doc_state->nested_histories().append(move(nested_history));
-
- // FIXME: 6. Update for navigable creation/destruction given traversable
+ // FIXME: 6. Update for navigable creation/destruction given traversable
+ });
return {};
}
@@ -342,10 +343,11 @@ void NavigableContainer::destroy_the_child_navigable()
// 7. Let traversable be container's node navigable's traversable navigable.
auto traversable = this->navigable()->traversable_navigable();
- // FIXME: 8. Append the following session history traversal steps to traversable:
-
- // 1. Apply pending history changes to traversable.
- traversable->apply_pending_history_changes();
+ // 8. Append the following session history traversal steps to traversable:
+ traversable->append_session_history_traversal_steps([traversable] {
+ // 1. Apply pending history changes to traversable.
+ traversable->apply_pending_history_changes();
+ });
}
}
diff --git a/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.h b/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.h
new file mode 100644
index 000000000000..c2cc7f8b8839
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/SessionHistoryTraversalQueue.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2023, Aliaksandr Kalenik <[email protected]>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibCore/Timer.h>
+
+namespace Web::HTML {
+
+// https://html.spec.whatwg.org/multipage/document-sequences.html#tn-session-history-traversal-queue
+class SessionHistoryTraversalQueue {
+public:
+ SessionHistoryTraversalQueue()
+ {
+ m_timer = Core::Timer::create_single_shot(0, [this] {
+ while (m_queue.size() > 0) {
+ auto steps = m_queue.take_first();
+ steps();
+ }
+ }).release_value_but_fixme_should_propagate_errors();
+ }
+
+ void append(JS::SafeFunction<void()> steps)
+ {
+ m_queue.append(move(steps));
+ if (!m_timer->is_active()) {
+ m_timer->start();
+ }
+ }
+
+private:
+ Vector<JS::SafeFunction<void()>> m_queue;
+ RefPtr<Core::Timer> m_timer;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp
index 19b76e2329f0..822d1a65d1e3 100644
--- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp
+++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp
@@ -479,24 +479,25 @@ void TraversableNavigable::traverse_the_history_by_delta(int delta)
// FIXME: 2. If sourceDocument is given, then:
// 3. Append the following session history traversal steps to traversable:
+ append_session_history_traversal_steps([this, delta] {
+ // 1. Let allSteps be the result of getting all used history steps for traversable.
+ auto all_steps = get_all_used_history_steps();
- // 1. Let allSteps be the result of getting all used history steps for traversable.
- auto all_steps = get_all_used_history_steps();
+ // 2. Let currentStepIndex be the index of traversable's current session history step within allSteps.
+ auto current_step_index = *all_steps.find_first_index(current_session_history_step());
- // 2. Let currentStepIndex be the index of traversable's current session history step within allSteps.
- auto current_step_index = *all_steps.find_first_index(current_session_history_step());
+ // 3. Let targetStepIndex be currentStepIndex plus delta
+ auto target_step_index = current_step_index + delta;
- // 3. Let targetStepIndex be currentStepIndex plus delta
- auto target_step_index = current_step_index + delta;
-
- // 4. If allSteps[targetStepIndex] does not exist, then abort these steps.
- if (target_step_index >= all_steps.size()) {
- return;
- }
+ // 4. If allSteps[targetStepIndex] does not exist, then abort these steps.
+ if (target_step_index >= all_steps.size()) {
+ return;
+ }
- // 5. Apply the history step allSteps[targetStepIndex] to traversable, with checkForUserCancelation set to true,
- // sourceSnapshotParams set to sourceSnapshotParams, and initiatorToCheck set to initiatorToCheck.
- apply_the_history_step(all_steps[target_step_index]);
+ // 5. Apply the history step allSteps[targetStepIndex] to traversable, with checkForUserCancelation set to true,
+ // sourceSnapshotParams set to sourceSnapshotParams, and initiatorToCheck set to initiatorToCheck.
+ apply_the_history_step(all_steps[target_step_index]);
+ });
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-pending-history-changes
diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
index 4e45987906fc..ce237407e456 100644
--- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
+++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
@@ -8,6 +8,7 @@
#include <AK/Vector.h>
#include <LibWeb/HTML/Navigable.h>
+#include <LibWeb/HTML/SessionHistoryTraversalQueue.h>
#include <LibWeb/HTML/VisibilityState.h>
namespace Web::HTML {
@@ -47,6 +48,11 @@ class TraversableNavigable final : public Navigable {
void destroy_top_level_traversable();
+ void append_session_history_traversal_steps(JS::SafeFunction<void()> steps)
+ {
+ m_session_history_traversal_queue.append(move(steps));
+ }
+
private:
TraversableNavigable();
@@ -65,6 +71,8 @@ class TraversableNavigable final : public Navigable {
// https://html.spec.whatwg.org/multipage/document-sequences.html#system-visibility-state
VisibilityState m_system_visibility_state { VisibilityState::Visible };
+
+ SessionHistoryTraversalQueue m_session_history_traversal_queue;
};
}
|
d951e2ca972947362eb0c4d44b40b57bca83fdfa
|
2022-05-06 03:12:51
|
MacDue
|
kernel: Add /proc/{pid}/children to ProcFS
| false
|
Add /proc/{pid}/children to ProcFS
|
kernel
|
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index a6f3b98027cf..844c95d7a4de 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -295,6 +295,8 @@ ErrorOr<NonnullRefPtr<Inode>> ProcFSProcessDirectoryInode::lookup(StringView nam
return TRY(ProcFSProcessSubDirectoryInode::try_create(procfs(), SegmentedProcFSIndex::ProcessSubDirectory::OpenFileDescriptions, associated_pid()));
if (name == "stacks"sv)
return TRY(ProcFSProcessSubDirectoryInode::try_create(procfs(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks, associated_pid()));
+ if (name == "children"sv)
+ return TRY(ProcFSProcessSubDirectoryInode::try_create(procfs(), SegmentedProcFSIndex::ProcessSubDirectory::Children, associated_pid()));
if (name == "unveil"sv)
return TRY(ProcFSProcessPropertyInode::try_create_for_pid_property(procfs(), SegmentedProcFSIndex::MainProcessProperty::Unveil, associated_pid()));
if (name == "pledge"sv)
@@ -367,6 +369,8 @@ ErrorOr<void> ProcFSProcessSubDirectoryInode::traverse_as_directory(Function<Err
return process->traverse_file_descriptions_directory(procfs().fsid(), move(callback));
case SegmentedProcFSIndex::ProcessSubDirectory::Stacks:
return process->traverse_stacks_directory(procfs().fsid(), move(callback));
+ case SegmentedProcFSIndex::ProcessSubDirectory::Children:
+ return process->traverse_children_directory(procfs().fsid(), move(callback));
default:
VERIFY_NOT_REACHED();
}
@@ -384,6 +388,8 @@ ErrorOr<NonnullRefPtr<Inode>> ProcFSProcessSubDirectoryInode::lookup(StringView
return process->lookup_file_descriptions_directory(procfs(), name);
case SegmentedProcFSIndex::ProcessSubDirectory::Stacks:
return process->lookup_stacks_directory(procfs(), name);
+ case SegmentedProcFSIndex::ProcessSubDirectory::Children:
+ return process->lookup_children_directory(procfs(), name);
default:
VERIFY_NOT_REACHED();
}
@@ -401,6 +407,10 @@ ErrorOr<NonnullRefPtr<ProcFSProcessPropertyInode>> ProcFSProcessPropertyInode::t
{
return adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSProcessPropertyInode(procfs, main_property_type, pid));
}
+ErrorOr<NonnullRefPtr<ProcFSProcessPropertyInode>> ProcFSProcessPropertyInode::try_create_for_child_process_link(ProcFS const& procfs, ProcessID child_pid, ProcessID pid)
+{
+ return adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSProcessPropertyInode(procfs, child_pid, pid));
+}
ProcFSProcessPropertyInode::ProcFSProcessPropertyInode(ProcFS const& procfs, SegmentedProcFSIndex::MainProcessProperty main_property_type, ProcessID pid)
: ProcFSProcessAssociatedInode(procfs, pid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(pid, main_property_type))
@@ -423,6 +433,13 @@ ProcFSProcessPropertyInode::ProcFSProcessPropertyInode(ProcFS const& procfs, Thr
m_possible_data.property_index = thread_stack_index.value();
}
+ProcFSProcessPropertyInode::ProcFSProcessPropertyInode(ProcFS const& procfs, ProcessID child_pid, ProcessID pid)
+ : ProcFSProcessAssociatedInode(procfs, pid, SegmentedProcFSIndex::build_segmented_index_for_children(pid, child_pid))
+ , m_parent_sub_directory_type(SegmentedProcFSIndex::ProcessSubDirectory::Children)
+{
+ m_possible_data.property_index = child_pid.value();
+}
+
ErrorOr<void> ProcFSProcessPropertyInode::attach(OpenFileDescription& description)
{
return refresh_data(description);
@@ -440,6 +457,8 @@ static mode_t determine_procfs_process_inode_mode(SegmentedProcFSIndex::ProcessS
return S_IFLNK | 0400;
if (parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Stacks)
return S_IFREG | 0400;
+ if (parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Children)
+ return S_IFLNK | 0400;
VERIFY(parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Reserved);
if (main_property == SegmentedProcFSIndex::MainProcessProperty::BinaryLink)
return S_IFLNK | 0777;
@@ -531,6 +550,10 @@ ErrorOr<void> ProcFSProcessPropertyInode::try_to_acquire_data(Process& process,
TRY(process.procfs_get_thread_stack(m_possible_data.property_index, builder));
return {};
}
+ if (m_parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Children) {
+ TRY(process.procfs_get_child_proccess_link(m_possible_data.property_index, builder));
+ return {};
+ }
VERIFY(m_parent_sub_directory_type == SegmentedProcFSIndex::ProcessSubDirectory::Reserved);
switch (m_possible_data.property_type) {
diff --git a/Kernel/FileSystem/ProcFS.h b/Kernel/FileSystem/ProcFS.h
index 96c8e462372d..97d5c9051b36 100644
--- a/Kernel/FileSystem/ProcFS.h
+++ b/Kernel/FileSystem/ProcFS.h
@@ -172,11 +172,14 @@ class ProcFSProcessPropertyInode final : public ProcFSProcessAssociatedInode {
static ErrorOr<NonnullRefPtr<ProcFSProcessPropertyInode>> try_create_for_file_description_link(ProcFS const&, unsigned, ProcessID);
static ErrorOr<NonnullRefPtr<ProcFSProcessPropertyInode>> try_create_for_thread_stack(ProcFS const&, ThreadID, ProcessID);
static ErrorOr<NonnullRefPtr<ProcFSProcessPropertyInode>> try_create_for_pid_property(ProcFS const&, SegmentedProcFSIndex::MainProcessProperty, ProcessID);
+ static ErrorOr<NonnullRefPtr<ProcFSProcessPropertyInode>> try_create_for_child_process_link(ProcFS const&, ProcessID, ProcessID);
private:
ProcFSProcessPropertyInode(ProcFS const&, SegmentedProcFSIndex::MainProcessProperty, ProcessID);
ProcFSProcessPropertyInode(ProcFS const&, ThreadID, ProcessID);
ProcFSProcessPropertyInode(ProcFS const&, unsigned, ProcessID);
+ ProcFSProcessPropertyInode(ProcFS const&, ProcessID, ProcessID);
+
// ^Inode
virtual ErrorOr<void> attach(OpenFileDescription& description) override;
virtual void did_seek(OpenFileDescription&, off_t) override;
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 195ef0b3d918..fb460e08d10e 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -591,6 +591,9 @@ class Process final
ErrorOr<size_t> procfs_get_file_description_link(unsigned fd, KBufferBuilder& builder) const;
ErrorOr<void> traverse_file_descriptions_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const;
ErrorOr<NonnullRefPtr<Inode>> lookup_file_descriptions_directory(ProcFS const&, StringView name) const;
+ ErrorOr<NonnullRefPtr<Inode>> lookup_children_directory(ProcFS const&, StringView name) const;
+ ErrorOr<void> traverse_children_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const;
+ ErrorOr<size_t> procfs_get_child_proccess_link(ProcessID child_pid, KBufferBuilder& builder) const;
private:
inline PerformanceEventBuffer* current_perf_events_buffer()
diff --git a/Kernel/ProcessExposed.cpp b/Kernel/ProcessExposed.cpp
index 603e281d5e19..2a37d0626906 100644
--- a/Kernel/ProcessExposed.cpp
+++ b/Kernel/ProcessExposed.cpp
@@ -67,6 +67,11 @@ InodeIndex build_segmented_index_for_file_description(ProcessID pid, unsigned fd
return build_segmented_index_with_unknown_property(pid, ProcessSubDirectory::OpenFileDescriptions, fd);
}
+InodeIndex build_segmented_index_for_children(ProcessID pid, ProcessID child_pid)
+{
+ return build_segmented_index_with_unknown_property(pid, ProcessSubDirectory::Children, child_pid.value());
+}
+
}
static size_t s_allocate_global_inode_index()
diff --git a/Kernel/ProcessExposed.h b/Kernel/ProcessExposed.h
index 0f798ba1669b..5f8248e75a3a 100644
--- a/Kernel/ProcessExposed.h
+++ b/Kernel/ProcessExposed.h
@@ -36,6 +36,7 @@ enum class ProcessSubDirectory {
Reserved = 0,
OpenFileDescriptions = 1,
Stacks = 2,
+ Children = 3
};
void read_segments(u32& primary, ProcessSubDirectory& sub_directory, MainProcessProperty& property);
@@ -45,6 +46,8 @@ InodeIndex build_segmented_index_for_main_property(ProcessID, ProcessSubDirector
InodeIndex build_segmented_index_for_main_property_in_pid_directory(ProcessID, MainProcessProperty property);
InodeIndex build_segmented_index_for_thread_stack(ProcessID, ThreadID);
InodeIndex build_segmented_index_for_file_description(ProcessID, unsigned);
+InodeIndex build_segmented_index_for_children(ProcessID, ProcessID);
+
}
class ProcFSComponentRegistry {
diff --git a/Kernel/ProcessProcFSTraits.cpp b/Kernel/ProcessProcFSTraits.cpp
index 97335f889113..45ff810d902d 100644
--- a/Kernel/ProcessProcFSTraits.cpp
+++ b/Kernel/ProcessProcFSTraits.cpp
@@ -55,6 +55,7 @@ ErrorOr<void> Process::ProcessProcFSTraits::traverse_as_directory(FileSystemID f
TRY(callback({ "..", { fsid, ProcFSComponentRegistry::the().root_directory().component_index() }, DT_DIR }));
TRY(callback({ "fd", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::OpenFileDescriptions) }, DT_DIR }));
TRY(callback({ "stacks", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks) }, DT_DIR }));
+ TRY(callback({ "children", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::Children) }, DT_DIR }));
TRY(callback({ "unveil", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::Unveil) }, DT_REG }));
TRY(callback({ "pledge", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::Pledge) }, DT_REG }));
TRY(callback({ "fds", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::OpenFileDescriptions) }, DT_DIR }));
diff --git a/Kernel/ProcessSpecificExposed.cpp b/Kernel/ProcessSpecificExposed.cpp
index c43a016a4127..653f1c786a4e 100644
--- a/Kernel/ProcessSpecificExposed.cpp
+++ b/Kernel/ProcessSpecificExposed.cpp
@@ -80,6 +80,41 @@ ErrorOr<NonnullRefPtr<Inode>> Process::lookup_stacks_directory(ProcFS const& pro
return thread_stack_inode.release_value();
}
+ErrorOr<void> Process::traverse_children_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
+{
+ TRY(callback({ ".", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(pid(), SegmentedProcFSIndex::ProcessSubDirectory::Children) }, 0 }));
+ TRY(callback({ "..", { fsid, m_procfs_traits->component_index() }, 0 }));
+ return Process::all_instances().with([&](auto& processes) -> ErrorOr<void> {
+ for (auto& process : processes) {
+ if (process.ppid() == pid()) {
+ StringBuilder builder;
+ builder.appendff("{}", process.pid());
+ TRY(callback({ builder.string_view(), { fsid, SegmentedProcFSIndex::build_segmented_index_for_children(pid(), process.pid()) }, DT_LNK }));
+ }
+ }
+ return {};
+ });
+}
+
+ErrorOr<NonnullRefPtr<Inode>> Process::lookup_children_directory(ProcFS const& procfs, StringView name) const
+{
+ auto maybe_pid = name.to_uint();
+ if (!maybe_pid.has_value())
+ return ENOENT;
+
+ auto child_process = Process::from_pid(*maybe_pid);
+ if (!child_process || child_process->ppid() != pid())
+ return ENOENT;
+
+ return TRY(ProcFSProcessPropertyInode::try_create_for_child_process_link(procfs, *maybe_pid, pid()));
+}
+
+ErrorOr<size_t> Process::procfs_get_child_proccess_link(ProcessID child_pid, KBufferBuilder& builder) const
+{
+ TRY(builder.appendff("/proc/{}", child_pid.value()));
+ return builder.length();
+}
+
ErrorOr<size_t> Process::procfs_get_file_description_link(unsigned fd, KBufferBuilder& builder) const
{
auto file_description = TRY(open_file_description(fd));
|
7da12f0faf0a9af7bb69f89539a04fa2a63745ef
|
2021-07-23 03:03:21
|
Hendiadyoin1
|
userspaceemulator: Move to using the new SoftFPU
| false
|
Move to using the new SoftFPU
|
userspaceemulator
|
diff --git a/Userland/DevTools/UserspaceEmulator/CMakeLists.txt b/Userland/DevTools/UserspaceEmulator/CMakeLists.txt
index f3b67312e770..224e837f8f71 100644
--- a/Userland/DevTools/UserspaceEmulator/CMakeLists.txt
+++ b/Userland/DevTools/UserspaceEmulator/CMakeLists.txt
@@ -14,9 +14,12 @@ set(SOURCES
Region.cpp
SimpleRegion.cpp
SoftCPU.cpp
+ SoftFPU.cpp
SoftMMU.cpp
main.cpp
)
+add_compile_options(-mmmx)
+
serenity_bin(UserspaceEmulator)
target_link_libraries(UserspaceEmulator LibX86 LibDebug LibCore LibPthread LibLine)
diff --git a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp
index 6063d812effb..a2b325d5b435 100644
--- a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp
+++ b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp
@@ -26,6 +26,12 @@
_exit(0); \
} while (0)
+#define FPU_INSTRUCTION(name) \
+ void SoftCPU::name(const X86::Instruction& insn) \
+ { \
+ m_fpu.name(insn); \
+ }
+
#define DEFINE_GENERIC_SHIFT_ROTATE_INSN_HANDLERS(mnemonic, op) \
void SoftCPU::mnemonic##_RM8_1(const X86::Instruction& insn) { generic_RM8_1(op<ValueWithShadow<u8>>, insn); } \
void SoftCPU::mnemonic##_RM8_CL(const X86::Instruction& insn) { generic_RM8_CL(op<ValueWithShadow<u8>>, insn); } \
@@ -66,6 +72,7 @@ constexpr T sign_extended_to(U value)
SoftCPU::SoftCPU(Emulator& emulator)
: m_emulator(emulator)
+ , m_fpu(emulator, *this)
{
memset(m_gpr, 0, sizeof(m_gpr));
memset(m_gpr_shadow, 1, sizeof(m_gpr_shadow));
@@ -1439,777 +1446,126 @@ void SoftCPU::ESCAPE(const X86::Instruction&)
m_emulator.dump_backtrace();
TODO();
}
+FPU_INSTRUCTION(FADD_RM32);
+FPU_INSTRUCTION(FMUL_RM32);
+FPU_INSTRUCTION(FCOM_RM32);
+FPU_INSTRUCTION(FCOMP_RM32);
+FPU_INSTRUCTION(FSUB_RM32);
+FPU_INSTRUCTION(FSUBR_RM32);
+FPU_INSTRUCTION(FDIV_RM32);
+FPU_INSTRUCTION(FDIVR_RM32);
+FPU_INSTRUCTION(FLD_RM32);
+FPU_INSTRUCTION(FXCH);
+FPU_INSTRUCTION(FST_RM32);
+FPU_INSTRUCTION(FNOP);
+FPU_INSTRUCTION(FSTP_RM32);
+FPU_INSTRUCTION(FLDENV);
+FPU_INSTRUCTION(FCHS);
+FPU_INSTRUCTION(FABS);
+FPU_INSTRUCTION(FTST);
+FPU_INSTRUCTION(FXAM);
+FPU_INSTRUCTION(FLDCW);
+FPU_INSTRUCTION(FLD1);
+FPU_INSTRUCTION(FLDL2T);
+FPU_INSTRUCTION(FLDL2E);
+FPU_INSTRUCTION(FLDPI);
+FPU_INSTRUCTION(FLDLG2);
+FPU_INSTRUCTION(FLDLN2);
+FPU_INSTRUCTION(FLDZ);
+FPU_INSTRUCTION(FNSTENV);
+FPU_INSTRUCTION(F2XM1);
+FPU_INSTRUCTION(FYL2X);
+FPU_INSTRUCTION(FPTAN);
+FPU_INSTRUCTION(FPATAN);
+FPU_INSTRUCTION(FXTRACT);
+FPU_INSTRUCTION(FPREM1);
+FPU_INSTRUCTION(FDECSTP);
+FPU_INSTRUCTION(FINCSTP);
+FPU_INSTRUCTION(FNSTCW);
+FPU_INSTRUCTION(FPREM);
+FPU_INSTRUCTION(FYL2XP1);
+FPU_INSTRUCTION(FSQRT);
+FPU_INSTRUCTION(FSINCOS);
+FPU_INSTRUCTION(FRNDINT);
+FPU_INSTRUCTION(FSCALE);
+FPU_INSTRUCTION(FSIN);
+FPU_INSTRUCTION(FCOS);
+FPU_INSTRUCTION(FIADD_RM32);
+FPU_INSTRUCTION(FCMOVB);
+FPU_INSTRUCTION(FIMUL_RM32);
+FPU_INSTRUCTION(FCMOVE);
+FPU_INSTRUCTION(FICOM_RM32);
+FPU_INSTRUCTION(FCMOVBE);
+FPU_INSTRUCTION(FICOMP_RM32);
+FPU_INSTRUCTION(FCMOVU);
+FPU_INSTRUCTION(FISUB_RM32);
+FPU_INSTRUCTION(FISUBR_RM32);
+FPU_INSTRUCTION(FUCOMPP);
+FPU_INSTRUCTION(FIDIV_RM32);
+FPU_INSTRUCTION(FIDIVR_RM32);
+FPU_INSTRUCTION(FILD_RM32);
+FPU_INSTRUCTION(FCMOVNB);
+FPU_INSTRUCTION(FISTTP_RM32);
+FPU_INSTRUCTION(FCMOVNE);
+FPU_INSTRUCTION(FIST_RM32);
+FPU_INSTRUCTION(FCMOVNBE);
+FPU_INSTRUCTION(FISTP_RM32);
+FPU_INSTRUCTION(FCMOVNU);
+FPU_INSTRUCTION(FNENI);
+FPU_INSTRUCTION(FNDISI);
+FPU_INSTRUCTION(FNCLEX);
+FPU_INSTRUCTION(FNINIT);
+FPU_INSTRUCTION(FNSETPM);
+FPU_INSTRUCTION(FLD_RM80);
+FPU_INSTRUCTION(FUCOMI);
+FPU_INSTRUCTION(FCOMI);
+FPU_INSTRUCTION(FSTP_RM80);
+FPU_INSTRUCTION(FADD_RM64);
+FPU_INSTRUCTION(FMUL_RM64);
+FPU_INSTRUCTION(FCOM_RM64);
+FPU_INSTRUCTION(FCOMP_RM64);
+FPU_INSTRUCTION(FSUB_RM64);
+FPU_INSTRUCTION(FSUBR_RM64);
+FPU_INSTRUCTION(FDIV_RM64);
+FPU_INSTRUCTION(FDIVR_RM64);
+FPU_INSTRUCTION(FLD_RM64);
+FPU_INSTRUCTION(FFREE);
+FPU_INSTRUCTION(FISTTP_RM64);
+FPU_INSTRUCTION(FST_RM64);
+FPU_INSTRUCTION(FSTP_RM64);
+FPU_INSTRUCTION(FRSTOR);
+FPU_INSTRUCTION(FUCOM);
+FPU_INSTRUCTION(FUCOMP);
+FPU_INSTRUCTION(FNSAVE);
+FPU_INSTRUCTION(FNSTSW);
+FPU_INSTRUCTION(FIADD_RM16);
+FPU_INSTRUCTION(FADDP);
+FPU_INSTRUCTION(FIMUL_RM16);
+FPU_INSTRUCTION(FMULP);
+FPU_INSTRUCTION(FICOM_RM16);
+FPU_INSTRUCTION(FICOMP_RM16);
+FPU_INSTRUCTION(FCOMPP);
+FPU_INSTRUCTION(FISUB_RM16);
+FPU_INSTRUCTION(FSUBRP);
+FPU_INSTRUCTION(FISUBR_RM16);
+FPU_INSTRUCTION(FSUBP);
+FPU_INSTRUCTION(FIDIV_RM16);
+FPU_INSTRUCTION(FDIVRP);
+FPU_INSTRUCTION(FIDIVR_RM16);
+FPU_INSTRUCTION(FDIVP);
+FPU_INSTRUCTION(FILD_RM16);
+FPU_INSTRUCTION(FFREEP);
+FPU_INSTRUCTION(FISTTP_RM16);
+FPU_INSTRUCTION(FIST_RM16);
+FPU_INSTRUCTION(FISTP_RM16);
+FPU_INSTRUCTION(FBLD_M80);
+FPU_INSTRUCTION(FNSTSW_AX);
+FPU_INSTRUCTION(FILD_RM64);
+FPU_INSTRUCTION(FUCOMIP);
+FPU_INSTRUCTION(FBSTP_M80);
+FPU_INSTRUCTION(FCOMIP);
+FPU_INSTRUCTION(FISTP_RM64);
-void SoftCPU::FADD_RM32(const X86::Instruction& insn)
-{
- // XXX look at ::INC_foo for how mem/reg stuff is handled, and use that here too to make sure this is only called for mem32 ops
- if (insn.modrm().is_register()) {
- fpu_set(0, fpu_get(insn.modrm().register_index()) + fpu_get(0));
- } else {
- auto new_f32 = insn.modrm().read32(*this, insn);
- // FIXME: Respect shadow values
- auto f32 = bit_cast<float>(new_f32.value());
- fpu_set(0, fpu_get(0) + f32);
- }
-}
-
-void SoftCPU::FMUL_RM32(const X86::Instruction& insn)
-{
- // XXX look at ::INC_foo for how mem/reg stuff is handled, and use that here too to make sure this is only called for mem32 ops
- if (insn.modrm().is_register()) {
- fpu_set(0, fpu_get(0) * fpu_get(insn.modrm().register_index()));
- } else {
- auto new_f32 = insn.modrm().read32(*this, insn);
- // FIXME: Respect shadow values
- auto f32 = bit_cast<float>(new_f32.value());
- fpu_set(0, fpu_get(0) * f32);
- }
-}
-
-void SoftCPU::FCOM_RM32(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FCOMP_RM32(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FSUB_RM32(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- fpu_set(0, fpu_get(0) - fpu_get(insn.modrm().register_index()));
- } else {
- auto new_f32 = insn.modrm().read32(*this, insn);
- // FIXME: Respect shadow values
- auto f32 = bit_cast<float>(new_f32.value());
- fpu_set(0, fpu_get(0) - f32);
- }
-}
-
-void SoftCPU::FSUBR_RM32(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- fpu_set(0, fpu_get(insn.modrm().register_index()) - fpu_get(0));
- } else {
- auto new_f32 = insn.modrm().read32(*this, insn);
- // FIXME: Respect shadow values
- auto f32 = bit_cast<float>(new_f32.value());
- fpu_set(0, f32 - fpu_get(0));
- }
-}
-
-void SoftCPU::FDIV_RM32(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- fpu_set(0, fpu_get(0) / fpu_get(insn.modrm().register_index()));
- } else {
- auto new_f32 = insn.modrm().read32(*this, insn);
- // FIXME: Respect shadow values
- auto f32 = bit_cast<float>(new_f32.value());
- // FIXME: Raise IA on + infinity / +-infinity, +-0 / +-0, raise Z on finite / +-0
- fpu_set(0, fpu_get(0) / f32);
- }
-}
-
-void SoftCPU::FDIVR_RM32(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- fpu_set(0, fpu_get(insn.modrm().register_index()) / fpu_get(0));
- } else {
- auto new_f32 = insn.modrm().read32(*this, insn);
- // FIXME: Respect shadow values
- auto f32 = bit_cast<float>(new_f32.value());
- // FIXME: Raise IA on + infinity / +-infinity, +-0 / +-0, raise Z on finite / +-0
- fpu_set(0, f32 / fpu_get(0));
- }
-}
-
-void SoftCPU::FLD_RM32(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- fpu_push(fpu_get(insn.modrm().register_index()));
- } else {
- auto new_f32 = insn.modrm().read32(*this, insn);
- // FIXME: Respect shadow values
- fpu_push(bit_cast<float>(new_f32.value()));
- }
-}
-
-void SoftCPU::FXCH(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- auto tmp = fpu_get(0);
- fpu_set(0, fpu_get(insn.modrm().register_index()));
- fpu_set(insn.modrm().register_index(), tmp);
-}
-
-void SoftCPU::FST_RM32(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- float f32 = (float)fpu_get(0);
- // FIXME: Respect shadow values
- insn.modrm().write32(*this, insn, shadow_wrap_as_initialized(bit_cast<u32>(f32)));
-}
-
-void SoftCPU::FNOP(const X86::Instruction&)
-{
-}
-
-void SoftCPU::FSTP_RM32(const X86::Instruction& insn)
-{
- FST_RM32(insn);
- fpu_pop();
-}
-
-void SoftCPU::FLDENV(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FCHS(const X86::Instruction&)
-{
- fpu_set(0, -fpu_get(0));
-}
-
-void SoftCPU::FABS(const X86::Instruction&)
-{
- fpu_set(0, __builtin_fabsl(fpu_get(0)));
-}
-
-void SoftCPU::FTST(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FXAM(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FLDCW(const X86::Instruction& insn)
-{
- m_fpu_cw = insn.modrm().read16(*this, insn);
-}
-
-void SoftCPU::FLD1(const X86::Instruction&)
-{
- fpu_push(1.0);
-}
-
-void SoftCPU::FLDL2T(const X86::Instruction&)
-{
- fpu_push(log2f(10.0f));
-}
-
-void SoftCPU::FLDL2E(const X86::Instruction&)
-{
- fpu_push(log2f(M_E));
-}
-
-void SoftCPU::FLDPI(const X86::Instruction&)
-{
- fpu_push(M_PI);
-}
-
-void SoftCPU::FLDLG2(const X86::Instruction&)
-{
- fpu_push(log10f(2.0f));
-}
-
-void SoftCPU::FLDLN2(const X86::Instruction&)
-{
- fpu_push(M_LN2);
-}
-
-void SoftCPU::FLDZ(const X86::Instruction&)
-{
- fpu_push(0.0);
-}
-
-void SoftCPU::FNSTENV(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::F2XM1(const X86::Instruction&)
-{
- // FIXME: validate ST(0) is in range –1.0 to +1.0
- auto f32 = fpu_get(0);
- // FIXME: Set C0, C2, C3 in FPU status word.
- fpu_set(0, powf(2, f32) - 1.0f);
-}
-
-void SoftCPU::FYL2X(const X86::Instruction&)
-{
- // FIXME: Raise IA on +-infinity, +-0, raise Z on +-0
- auto f32 = fpu_get(0);
- // FIXME: Set C0, C2, C3 in FPU status word.
- fpu_set(1, fpu_get(1) * log2f(f32));
- fpu_pop();
-}
-
-void SoftCPU::FYL2XP1(const X86::Instruction&)
-{
- // FIXME: validate ST(0) range
- auto f32 = fpu_get(0);
- // FIXME: Set C0, C2, C3 in FPU status word.
- fpu_set(1, (fpu_get(1) * log2f(f32 + 1.0f)));
- fpu_pop();
-}
-
-void SoftCPU::FPTAN(const X86::Instruction&)
-{
- // FIXME: set C1 upon stack overflow or if result was rounded
- // FIXME: Set C2 to 1 if ST(0) is outside range of -2^63 to +2^63; else set to 0
- fpu_set(0, tanf(fpu_get(0)));
- fpu_push(1.0f);
-}
-
-void SoftCPU::FPATAN(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FXTRACT(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FPREM1(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FDECSTP(const X86::Instruction&)
-{
- m_fpu_top = (m_fpu_top == 0) ? 7 : m_fpu_top - 1;
- set_cf(0);
-}
-
-void SoftCPU::FINCSTP(const X86::Instruction&)
-{
- m_fpu_top = (m_fpu_top == 7) ? 0 : m_fpu_top + 1;
- set_cf(0);
-}
-
-void SoftCPU::FNSTCW(const X86::Instruction& insn)
-{
- insn.modrm().write16(*this, insn, m_fpu_cw);
-}
-
-void SoftCPU::FPREM(const X86::Instruction&)
-{
- fpu_set(0,
- fmodl(fpu_get(0), fpu_get(1)));
-}
-
-void SoftCPU::FSQRT(const X86::Instruction&)
-{
- fpu_set(0, sqrt(fpu_get(0)));
-}
-
-void SoftCPU::FSINCOS(const X86::Instruction&)
-{
- long double sin = sinl(fpu_get(0));
- long double cos = cosl(fpu_get(0));
- fpu_set(0, sin);
- fpu_push(cos);
-}
-
-void SoftCPU::FRNDINT(const X86::Instruction&)
-{
- // FIXME: support rounding mode
- fpu_set(0, round(fpu_get(0)));
-}
-
-void SoftCPU::FSCALE(const X86::Instruction&)
-{
- // FIXME: set C1 upon stack overflow or if result was rounded
- fpu_set(0, fpu_get(0) * powf(2, floorf(fpu_get(1))));
-}
-
-void SoftCPU::FSIN(const X86::Instruction&)
-{
- fpu_set(0, sin(fpu_get(0)));
-}
-
-void SoftCPU::FCOS(const X86::Instruction&)
-{
- fpu_set(0, cos(fpu_get(0)));
-}
-
-void SoftCPU::FIADD_RM32(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m32int = (i32)insn.modrm().read32(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_set(0, fpu_get(0) + (long double)m32int);
-}
-
-void SoftCPU::FCMOVB(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- if (cf())
- fpu_set(0, fpu_get(insn.modrm().rm()));
-}
-
-void SoftCPU::FIMUL_RM32(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m32int = (i32)insn.modrm().read32(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_set(0, fpu_get(0) * (long double)m32int);
-}
-
-void SoftCPU::FCMOVE(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- if (zf())
- fpu_set(0, fpu_get(insn.modrm().rm()));
-}
-
-void SoftCPU::FICOM_RM32(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FCMOVBE(const X86::Instruction& insn)
-{
- if (evaluate_condition(6))
- fpu_set(0, fpu_get(insn.modrm().rm()));
-}
-
-void SoftCPU::FICOMP_RM32(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FCMOVU(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- if (pf())
- fpu_set(0, fpu_get((insn.modrm().reg_fpu())));
-}
-
-void SoftCPU::FISUB_RM32(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m32int = (i32)insn.modrm().read32(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_set(0, fpu_get(0) - (long double)m32int);
-}
-
-void SoftCPU::FISUBR_RM32(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m32int = (i32)insn.modrm().read32(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_set(0, (long double)m32int - fpu_get(0));
-}
-
-void SoftCPU::FIDIV_RM32(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m32int = (i32)insn.modrm().read32(*this, insn).value();
- // FIXME: Respect shadow values
- // FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0
- fpu_set(0, fpu_get(0) / (long double)m32int);
-}
-
-void SoftCPU::FIDIVR_RM32(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m32int = (i32)insn.modrm().read32(*this, insn).value();
- // FIXME: Respect shadow values
- // FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0
- fpu_set(0, (long double)m32int / fpu_get(0));
-}
-
-void SoftCPU::FILD_RM32(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m32int = (i32)insn.modrm().read32(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_push((long double)m32int);
-}
-
-void SoftCPU::FCMOVNB(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- if (!cf())
- fpu_set(0, fpu_get((insn.modrm().reg_fpu())));
-}
-
-void SoftCPU::FISTTP_RM32(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- i32 value = static_cast<i32>(fpu_pop());
- insn.modrm().write32(*this, insn, shadow_wrap_as_initialized(bit_cast<u32>(value)));
-}
-
-void SoftCPU::FCMOVNE(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- if (!zf())
- fpu_set(0, fpu_get((insn.modrm().reg_fpu())));
-}
-
-void SoftCPU::FIST_RM32(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto f = fpu_get(0);
- // FIXME: Respect rounding mode in m_fpu_cw.
- auto value = static_cast<i32>(f);
- // FIXME: Respect shadow values
- insn.modrm().write32(*this, insn, shadow_wrap_as_initialized(bit_cast<u32>(value)));
-}
-
-void SoftCPU::FCMOVNBE(const X86::Instruction& insn)
-{
- if (evaluate_condition(7))
- fpu_set(0, fpu_get(insn.modrm().rm()));
-}
-
-void SoftCPU::FISTP_RM32(const X86::Instruction& insn)
-{
- FIST_RM32(insn);
- fpu_pop();
-}
-
-void SoftCPU::FCMOVNU(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- if (!pf())
- fpu_set(0, fpu_get((insn.modrm().reg_fpu())));
-}
-
-void SoftCPU::FNENI(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FNDISI(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FNCLEX(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FNINIT(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FNSETPM(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FLD_RM80(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
-
- // long doubles can be up to 128 bits wide in memory for reasons (alignment) and only uses 80 bits of precision
- // GCC uses 12 bytes in 32 bit and 16 bytes in 64 bit mode
- // so in the 32 bit case we read a bit to much, but that shouldn't be an issue.
- // FIXME: Respect shadow values
- auto new_f80 = insn.modrm().read128(*this, insn).value();
-
- fpu_push(*(long double*)new_f80.bytes().data());
-}
-
-void SoftCPU::FUCOMI(const X86::Instruction& insn)
-{
- auto i = insn.modrm().rm();
- // FIXME: Unordered comparison checks.
- // FIXME: QNaN / exception handling.
- // FIXME: Set C0, C2, C3 in FPU status word.
- if (__builtin_isnan(fpu_get(0)) || __builtin_isnan(fpu_get(i))) {
- set_zf(true);
- set_pf(true);
- set_cf(true);
- } else {
- set_zf(fpu_get(0) == fpu_get(i));
- set_pf(false);
- set_cf(fpu_get(0) < fpu_get(i));
- set_of(false);
- }
-
- // FIXME: Taint should be based on ST(0) and ST(i)
- m_flags_tainted = false;
-}
-
-void SoftCPU::FCOMI(const X86::Instruction& insn)
-{
- auto i = insn.modrm().rm();
- // FIXME: QNaN / exception handling.
- // FIXME: Set C0, C2, C3 in FPU status word.
- set_zf(fpu_get(0) == fpu_get(i));
- set_pf(false);
- set_cf(fpu_get(0) < fpu_get(i));
- set_of(false);
-
- // FIXME: Taint should be based on ST(0) and ST(i)
- m_flags_tainted = false;
-}
-
-void SoftCPU::FSTP_RM80(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- fpu_set(insn.modrm().register_index(), fpu_pop());
- } else {
- // FIXME: Respect shadow values
- // long doubles can be up to 128 bits wide in memory for reasons (alignment) and only uses 80 bits of precision
- // gcc uses 12 byte in 32 bit and 16 byte in 64 bit mode
- // so in the 32 bit case we have to read first, to not override data on the overly big write
- u128 f80 {};
- if constexpr (sizeof(long double) == 12)
- f80 = insn.modrm().read128(*this, insn).value();
-
- *(long double*)f80.bytes().data() = fpu_pop();
-
- insn.modrm().write128(*this, insn, shadow_wrap_as_initialized(f80));
- }
-}
-
-void SoftCPU::FADD_RM64(const X86::Instruction& insn)
-{
- // XXX look at ::INC_foo for how mem/reg stuff is handled, and use that here too to make sure this is only called for mem64 ops
- if (insn.modrm().is_register()) {
- fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) + fpu_get(0));
- } else {
- auto new_f64 = insn.modrm().read64(*this, insn);
- // FIXME: Respect shadow values
- auto f64 = bit_cast<double>(new_f64.value());
- fpu_set(0, fpu_get(0) + f64);
- }
-}
-
-void SoftCPU::FMUL_RM64(const X86::Instruction& insn)
-{
- // XXX look at ::INC_foo for how mem/reg stuff is handled, and use that here too to make sure this is only called for mem64 ops
- if (insn.modrm().is_register()) {
- fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) * fpu_get(0));
- } else {
- auto new_f64 = insn.modrm().read64(*this, insn);
- // FIXME: Respect shadow values
- auto f64 = bit_cast<double>(new_f64.value());
- fpu_set(0, fpu_get(0) * f64);
- }
-}
-
-void SoftCPU::FCOM_RM64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FCOMP_RM64(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FSUB_RM64(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) - fpu_get(0));
- } else {
- auto new_f64 = insn.modrm().read64(*this, insn);
- // FIXME: Respect shadow values
- auto f64 = bit_cast<double>(new_f64.value());
- fpu_set(0, fpu_get(0) - f64);
- }
-}
-
-void SoftCPU::FSUBR_RM64(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) - fpu_get(0));
- } else {
- auto new_f64 = insn.modrm().read64(*this, insn);
- // FIXME: Respect shadow values
- auto f64 = bit_cast<double>(new_f64.value());
- fpu_set(0, f64 - fpu_get(0));
- }
-}
-
-void SoftCPU::FDIV_RM64(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) / fpu_get(0));
- } else {
- auto new_f64 = insn.modrm().read64(*this, insn);
- // FIXME: Respect shadow values
- auto f64 = bit_cast<double>(new_f64.value());
- // FIXME: Raise IA on + infinity / +-infinity, +-0 / +-0, raise Z on finite / +-0
- fpu_set(0, fpu_get(0) / f64);
- }
-}
-
-void SoftCPU::FDIVR_RM64(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- // XXX this is FDIVR, Instruction decodes this weirdly
- //fpu_set(insn.modrm().register_index(), fpu_get(0) / fpu_get(insn.modrm().register_index()));
- fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) / fpu_get(0));
- } else {
- auto new_f64 = insn.modrm().read64(*this, insn);
- // FIXME: Respect shadow values
- auto f64 = bit_cast<double>(new_f64.value());
- // FIXME: Raise IA on + infinity / +-infinity, +-0 / +-0, raise Z on finite / +-0
- fpu_set(0, f64 / fpu_get(0));
- }
-}
-
-void SoftCPU::FLD_RM64(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto new_f64 = insn.modrm().read64(*this, insn);
- // FIXME: Respect shadow values
- fpu_push(bit_cast<double>(new_f64.value()));
-}
-
-void SoftCPU::FFREE(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FISTTP_RM64(const X86::Instruction& insn)
-{
- // is this allowed to be a register?
- VERIFY(!insn.modrm().is_register());
- i64 value = static_cast<i64>(fpu_pop());
- insn.modrm().write64(*this, insn, shadow_wrap_as_initialized(bit_cast<u64>(value)));
-}
-
-void SoftCPU::FST_RM64(const X86::Instruction& insn)
-{
- if (insn.modrm().is_register()) {
- fpu_set(insn.modrm().register_index(), fpu_get(0));
- } else {
- // FIXME: Respect shadow values
- double f64 = (double)fpu_get(0);
- insn.modrm().write64(*this, insn, shadow_wrap_as_initialized(bit_cast<u64>(f64)));
- }
-}
-
-void SoftCPU::FSTP_RM64(const X86::Instruction& insn)
-{
- FST_RM64(insn);
- fpu_pop();
-}
-
-void SoftCPU::FRSTOR(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FUCOM(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FUCOMP(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FUCOMPP(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FNSAVE(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FNSTSW(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FIADD_RM16(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m16int = (i16)insn.modrm().read16(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_set(0, fpu_get(0) + (long double)m16int);
-}
-
-void SoftCPU::FADDP(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) + fpu_get(0));
- fpu_pop();
-}
-
-void SoftCPU::FIMUL_RM16(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m16int = (i16)insn.modrm().read16(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_set(0, fpu_get(0) * (long double)m16int);
-}
-
-void SoftCPU::FMULP(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) * fpu_get(0));
- fpu_pop();
-}
-
-void SoftCPU::FICOM_RM16(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FICOMP_RM16(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FCOMPP(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FISUB_RM16(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m16int = (i16)insn.modrm().read16(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_set(0, fpu_get(0) - (long double)m16int);
-}
-
-void SoftCPU::FSUBRP(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- fpu_set(insn.modrm().register_index(), fpu_get(0) - fpu_get(insn.modrm().register_index()));
- fpu_pop();
-}
-
-void SoftCPU::FISUBR_RM16(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m16int = (i16)insn.modrm().read16(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_set(0, (long double)m16int - fpu_get(0));
-}
-
-void SoftCPU::FSUBP(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) - fpu_get(0));
- fpu_pop();
-}
-
-void SoftCPU::FIDIV_RM16(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m16int = (i16)insn.modrm().read16(*this, insn).value();
- // FIXME: Respect shadow values
- // FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0
- fpu_set(0, fpu_get(0) / (long double)m16int);
-}
-
-void SoftCPU::FDIVRP(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- // FIXME: Raise IA on + infinity / +-infinity, +-0 / +-0, raise Z on finite / +-0
- fpu_set(insn.modrm().register_index(), fpu_get(0) / fpu_get(insn.modrm().register_index()));
- fpu_pop();
-}
-
-void SoftCPU::FIDIVR_RM16(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m16int = (i16)insn.modrm().read16(*this, insn).value();
- // FIXME: Respect shadow values
- // FIXME: Raise IA on 0 / _=0, raise Z on finite / +-0
- fpu_set(0, (long double)m16int / fpu_get(0));
-}
-
-void SoftCPU::FDIVP(const X86::Instruction& insn)
-{
- VERIFY(insn.modrm().is_register());
- // FIXME: Raise IA on + infinity / +-infinity, +-0 / +-0, raise Z on finite / +-0
- fpu_set(insn.modrm().register_index(), fpu_get(insn.modrm().register_index()) / fpu_get(0));
- fpu_pop();
-}
-
-void SoftCPU::FILD_RM16(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m16int = (i16)insn.modrm().read16(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_push((long double)m16int);
-}
-
-void SoftCPU::FFREEP(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FISTTP_RM16(const X86::Instruction& insn)
-{
- // is this allowed to be a register?
- VERIFY(!insn.modrm().is_register());
- i16 value = static_cast<i16>(fpu_pop());
- insn.modrm().write16(*this, insn, shadow_wrap_as_initialized(bit_cast<u16>(value)));
-}
-
-void SoftCPU::FIST_RM16(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto f = fpu_get(0);
- // FIXME: Respect rounding mode in m_fpu_cw.
- auto value = static_cast<i16>(f);
- // FIXME: Respect shadow values
- insn.modrm().write16(*this, insn, shadow_wrap_as_initialized(bit_cast<u16>(value)));
-}
-
-void SoftCPU::FISTP_RM16(const X86::Instruction& insn)
-{
- FIST_RM16(insn);
- fpu_pop();
-}
-
-void SoftCPU::FBLD_M80(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::FNSTSW_AX(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FILD_RM64(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto m64int = (i64)insn.modrm().read64(*this, insn).value();
- // FIXME: Respect shadow values
- fpu_push((long double)m64int);
-}
-
-void SoftCPU::FUCOMIP(const X86::Instruction& insn)
-{
- FUCOMI(insn);
- fpu_pop();
-}
-
-void SoftCPU::FBSTP_M80(const X86::Instruction&) { TODO_INSN(); }
-
-void SoftCPU::FCOMIP(const X86::Instruction& insn)
-{
- FCOMI(insn);
- fpu_pop();
-}
-
-void SoftCPU::FISTP_RM64(const X86::Instruction& insn)
-{
- VERIFY(!insn.modrm().is_register());
- auto f = fpu_pop();
- // FIXME: Respect rounding mode in m_fpu_cw.
- auto value = static_cast<i64>(f);
- // FIXME: Respect shadow values
- insn.modrm().write64(*this, insn, shadow_wrap_as_initialized(bit_cast<u64>(value)));
-}
void SoftCPU::HLT(const X86::Instruction&) { TODO_INSN(); }
void SoftCPU::IDIV_RM16(const X86::Instruction& insn)
@@ -2815,27 +2171,28 @@ void SoftCPU::OUT_DX_EAX(const X86::Instruction&) { TODO_INSN(); }
void SoftCPU::OUT_imm8_AL(const X86::Instruction&) { TODO_INSN(); }
void SoftCPU::OUT_imm8_AX(const X86::Instruction&) { TODO_INSN(); }
void SoftCPU::OUT_imm8_EAX(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PACKSSDW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PACKSSWB_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PACKUSWB_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PADDB_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PADDW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PADDD_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PADDSB_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PADDSW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PADDUSB_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PADDUSW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PAND_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PANDN_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PCMPEQB_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PCMPEQW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PCMPEQD_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PCMPGTB_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PCMPGTW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PCMPGTD_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PMADDWD_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PMULHW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
-void SoftCPU::PMULLW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); }
+
+FPU_INSTRUCTION(PACKSSDW_mm1_mm2m64);
+FPU_INSTRUCTION(PACKSSWB_mm1_mm2m64);
+FPU_INSTRUCTION(PACKUSWB_mm1_mm2m64);
+FPU_INSTRUCTION(PADDB_mm1_mm2m64);
+FPU_INSTRUCTION(PADDW_mm1_mm2m64);
+FPU_INSTRUCTION(PADDD_mm1_mm2m64);
+FPU_INSTRUCTION(PADDSB_mm1_mm2m64);
+FPU_INSTRUCTION(PADDSW_mm1_mm2m64);
+FPU_INSTRUCTION(PADDUSB_mm1_mm2m64);
+FPU_INSTRUCTION(PADDUSW_mm1_mm2m64);
+FPU_INSTRUCTION(PAND_mm1_mm2m64);
+FPU_INSTRUCTION(PANDN_mm1_mm2m64);
+FPU_INSTRUCTION(PCMPEQB_mm1_mm2m64);
+FPU_INSTRUCTION(PCMPEQW_mm1_mm2m64);
+FPU_INSTRUCTION(PCMPEQD_mm1_mm2m64);
+FPU_INSTRUCTION(PCMPGTB_mm1_mm2m64);
+FPU_INSTRUCTION(PCMPGTW_mm1_mm2m64);
+FPU_INSTRUCTION(PCMPGTD_mm1_mm2m64);
+FPU_INSTRUCTION(PMADDWD_mm1_mm2m64);
+FPU_INSTRUCTION(PMULHW_mm1_mm2m64);
+FPU_INSTRUCTION(PMULLW_mm1_mm2m64);
void SoftCPU::POPA(const X86::Instruction&)
{
@@ -2908,36 +2265,36 @@ void SoftCPU::POP_reg32(const X86::Instruction& insn)
gpr32(insn.reg32()) = pop32();
}
-void SoftCPU::POR_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSLLW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSLLW_mm1_imm8(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSLLD_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSLLD_mm1_imm8(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSLLQ_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSLLQ_mm1_imm8(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSRAW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSRAW_mm1_imm8(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSRAD_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSRAD_mm1_imm8(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSRLW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSRLW_mm1_imm8(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSRLD_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSRLD_mm1_imm8(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSRLQ_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSRLQ_mm1_imm8(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSUBB_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSUBW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSUBD_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSUBSB_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSUBSW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSUBUSB_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PSUBUSW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PUNPCKHBW_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PUNPCKHWD_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PUNPCKHDQ_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PUNPCKLBW_mm1_mm2m32(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PUNPCKLWD_mm1_mm2m32(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::PUNPCKLDQ_mm1_mm2m32(const X86::Instruction&) { TODO_INSN(); };
+FPU_INSTRUCTION(POR_mm1_mm2m64);
+FPU_INSTRUCTION(PSLLW_mm1_mm2m64);
+FPU_INSTRUCTION(PSLLW_mm1_imm8);
+FPU_INSTRUCTION(PSLLD_mm1_mm2m64);
+FPU_INSTRUCTION(PSLLD_mm1_imm8);
+FPU_INSTRUCTION(PSLLQ_mm1_mm2m64);
+FPU_INSTRUCTION(PSLLQ_mm1_imm8);
+FPU_INSTRUCTION(PSRAW_mm1_mm2m64);
+FPU_INSTRUCTION(PSRAW_mm1_imm8);
+FPU_INSTRUCTION(PSRAD_mm1_mm2m64);
+FPU_INSTRUCTION(PSRAD_mm1_imm8);
+FPU_INSTRUCTION(PSRLW_mm1_mm2m64);
+FPU_INSTRUCTION(PSRLW_mm1_imm8);
+FPU_INSTRUCTION(PSRLD_mm1_mm2m64);
+FPU_INSTRUCTION(PSRLD_mm1_imm8);
+FPU_INSTRUCTION(PSRLQ_mm1_mm2m64);
+FPU_INSTRUCTION(PSRLQ_mm1_imm8);
+FPU_INSTRUCTION(PSUBB_mm1_mm2m64);
+FPU_INSTRUCTION(PSUBW_mm1_mm2m64);
+FPU_INSTRUCTION(PSUBD_mm1_mm2m64);
+FPU_INSTRUCTION(PSUBSB_mm1_mm2m64);
+FPU_INSTRUCTION(PSUBSW_mm1_mm2m64);
+FPU_INSTRUCTION(PSUBUSB_mm1_mm2m64);
+FPU_INSTRUCTION(PSUBUSW_mm1_mm2m64);
+FPU_INSTRUCTION(PUNPCKHBW_mm1_mm2m64);
+FPU_INSTRUCTION(PUNPCKHWD_mm1_mm2m64);
+FPU_INSTRUCTION(PUNPCKHDQ_mm1_mm2m64);
+FPU_INSTRUCTION(PUNPCKLBW_mm1_mm2m32);
+FPU_INSTRUCTION(PUNPCKLWD_mm1_mm2m32);
+FPU_INSTRUCTION(PUNPCKLDQ_mm1_mm2m32);
void SoftCPU::PUSHA(const X86::Instruction&)
{
@@ -3028,7 +2385,7 @@ void SoftCPU::PUSH_reg32(const X86::Instruction& insn)
push32(gpr32(insn.reg32()));
}
-void SoftCPU::PXOR_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
+FPU_INSTRUCTION(PXOR_mm1_mm2m64);
template<typename T, bool cf>
ALWAYS_INLINE static T op_rcl_impl(SoftCPU& cpu, T data, ValueWithShadow<u8> steps)
@@ -3528,13 +2885,14 @@ DEFINE_GENERIC_INSN_HANDLERS(AND, op_and, true, false, false)
DEFINE_GENERIC_INSN_HANDLERS(CMP, op_sub, false, false, false)
DEFINE_GENERIC_INSN_HANDLERS_PARTIAL(TEST, op_and, false, false, false)
-void SoftCPU::MOVQ_mm1_mm2m64(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::MOVQ_mm1m64_mm2(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::MOVD_mm1_rm32(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::MOVQ_mm1_rm64(const X86::Instruction&) { TODO_INSN(); }; // long mode
-void SoftCPU::MOVD_rm32_mm2(const X86::Instruction&) { TODO_INSN(); };
-void SoftCPU::MOVQ_rm64_mm2(const X86::Instruction&) { TODO_INSN(); }; // long mode
-void SoftCPU::EMMS(const X86::Instruction&) { TODO_INSN(); }
+FPU_INSTRUCTION(MOVQ_mm1_mm2m64);
+FPU_INSTRUCTION(MOVQ_mm1m64_mm2);
+FPU_INSTRUCTION(MOVD_mm1_rm32);
+FPU_INSTRUCTION(MOVQ_mm1_rm64); // long mode
+FPU_INSTRUCTION(MOVD_rm32_mm2);
+FPU_INSTRUCTION(MOVQ_rm64_mm2); // long mode
+FPU_INSTRUCTION(EMMS);
+
void SoftCPU::wrap_0xC0(const X86::Instruction&) { TODO_INSN(); }
void SoftCPU::wrap_0xC1_16(const X86::Instruction&) { TODO_INSN(); }
void SoftCPU::wrap_0xC1_32(const X86::Instruction&) { TODO_INSN(); }
diff --git a/Userland/DevTools/UserspaceEmulator/SoftCPU.h b/Userland/DevTools/UserspaceEmulator/SoftCPU.h
index 601d7f82c023..1eed1e3e174b 100644
--- a/Userland/DevTools/UserspaceEmulator/SoftCPU.h
+++ b/Userland/DevTools/UserspaceEmulator/SoftCPU.h
@@ -7,6 +7,7 @@
#pragma once
#include "Region.h"
+#include "SoftFPU.h"
#include "ValueWithShadow.h"
#include <AK/ByteReader.h>
#include <LibX86/Instruction.h>
@@ -35,6 +36,8 @@ union PartAddressableRegister {
class SoftCPU final
: public X86::Interpreter
, public X86::InstructionStream {
+ friend SoftFPU;
+
public:
using ValueWithShadowType8 = ValueWithShadow<u8>;
using ValueWithShadowType16 = ValueWithShadow<u16>;
@@ -264,6 +267,10 @@ class SoftCPU final
ValueWithShadow<u8> dl() const { return const_gpr8(X86::RegisterDL); }
ValueWithShadow<u8> dh() const { return const_gpr8(X86::RegisterDH); }
+ long double fpu_get(u8 index) const { return m_fpu.fpu_get(index); }
+ long double fpu_pop() { return m_fpu.fpu_pop(); }
+ MMX mmx_get(u8 index) const { return m_fpu.mmx_get(index); };
+
void set_eax(ValueWithShadow<u32> value) { gpr32(X86::RegisterEAX) = value; }
void set_ebx(ValueWithShadow<u32> value) { gpr32(X86::RegisterEBX) = value; }
void set_ecx(ValueWithShadow<u32> value) { gpr32(X86::RegisterECX) = value; }
@@ -291,6 +298,10 @@ class SoftCPU final
void set_dl(ValueWithShadow<u8> value) { gpr8(X86::RegisterDL) = value; }
void set_dh(ValueWithShadow<u8> value) { gpr8(X86::RegisterDH) = value; }
+ void fpu_push(long double value) { m_fpu.fpu_push(value); }
+ void fpu_set(u8 index, long double value) { m_fpu.fpu_set(index, value); }
+ void mmx_set(u8 index, MMX value) { m_fpu.mmx_set(index, value); }
+
bool of() const { return m_eflags & Flags::OF; }
bool sf() const { return m_eflags & Flags::SF; }
bool zf() const { return m_eflags & Flags::ZF; }
@@ -1160,6 +1171,7 @@ class SoftCPU final
private:
Emulator& m_emulator;
+ SoftFPU m_fpu;
PartAddressableRegister m_gpr[8];
PartAddressableRegister m_gpr_shadow[8];
@@ -1172,44 +1184,6 @@ class SoftCPU final
u32 m_eip { 0 };
u32 m_base_eip { 0 };
- long double m_fpu[8];
- // FIXME: Shadow for m_fpu.
-
- // FIXME: Use bits 11 to 13 in the FPU status word for this.
- int m_fpu_top { -1 };
-
- void fpu_push(long double n)
- {
- ++m_fpu_top;
- fpu_set(0, n);
- }
- long double fpu_pop()
- {
- auto n = fpu_get(0);
- m_fpu_top--;
- return n;
- }
- long double fpu_get(int i)
- {
- VERIFY(i >= 0 && i <= m_fpu_top);
- return m_fpu[m_fpu_top - i];
- }
- void fpu_set(int i, long double n)
- {
- VERIFY(i >= 0 && i <= m_fpu_top);
- m_fpu[m_fpu_top - i] = n;
- }
-
- // FIXME: Or just something like m_flags_tainted?
- ValueWithShadow<u16> m_fpu_cw { 0, 0 };
-
- // FIXME: Make FPU/MMX memory its own struct
- // FIXME: FPU Status word
- // FIXME: FPU Tag Word
- // FIXME: FPU Data Pointer
- // FIXME: FPU Instruction Pointer ?
- // FIXME: FPU Last OP Code ?
-
Region* m_cached_code_region { nullptr };
u8* m_cached_code_base_ptr { nullptr };
};
|
3879e5b9d454e08b301721ad3044f90d03026db3
|
2020-02-03 00:56:27
|
Andreas Kling
|
kernel: Start working on a syscall for logging performance events
| false
|
Start working on a syscall for logging performance events
|
kernel
|
diff --git a/Kernel/Makefile b/Kernel/Makefile
index 92ccf9467ecd..e648405877d2 100644
--- a/Kernel/Makefile
+++ b/Kernel/Makefile
@@ -75,6 +75,7 @@ OBJS = \
PCI/IOAccess.o \
PCI/MMIOAccess.o \
PCI/Initializer.o \
+ PerformanceEventBuffer.o \
Process.o \
ProcessTracer.o \
Profiling.o \
diff --git a/Kernel/PerformanceEventBuffer.cpp b/Kernel/PerformanceEventBuffer.cpp
new file mode 100644
index 000000000000..dc0618101e02
--- /dev/null
+++ b/Kernel/PerformanceEventBuffer.cpp
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <[email protected]>
+ * 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 <AK/JsonArraySerializer.h>
+#include <AK/JsonObjectSerializer.h>
+#include <Kernel/KBufferBuilder.h>
+#include <Kernel/PerformanceEventBuffer.h>
+
+PerformanceEventBuffer::PerformanceEventBuffer()
+ : m_buffer(KBuffer::create_with_size(4 * MB))
+{
+}
+
+KResult PerformanceEventBuffer::append(int type, uintptr_t arg1, uintptr_t arg2)
+{
+ if (count() >= capacity())
+ return KResult(-ENOBUFS);
+
+ PerformanceEvent event;
+ event.type = type;
+
+ switch (type) {
+ case PERF_EVENT_MALLOC:
+ event.data.malloc.size = arg1;
+ event.data.malloc.ptr = arg2;
+#ifdef VERY_DEBUG
+ dbg() << "PERF_EVENT_MALLOC: " << (void*)event.data.malloc.ptr << " (" << event.data.malloc.size << ")";
+#endif
+ break;
+ case PERF_EVENT_FREE:
+ event.data.free.ptr = arg1;
+#ifdef VERY_DEBUG
+ dbg() << "PERF_EVENT_FREE: " << (void*)event.data.free.ptr;
+#endif
+ break;
+ default:
+ return KResult(-EINVAL);
+ }
+
+ uintptr_t ebp;
+ asm volatile("movl %%ebp, %%eax"
+ : "=a"(ebp));
+ //copy_from_user(&ebp, (uintptr_t*)current->get_register_dump_from_stack().ebp);
+ Vector<uintptr_t> backtrace;
+ {
+ SmapDisabler disabler;
+ backtrace = current->raw_backtrace(ebp);
+ }
+ event.stack_size = min(sizeof(event.stack) / sizeof(uintptr_t), static_cast<size_t>(backtrace.size()));
+ memcpy(event.stack, backtrace.data(), event.stack_size * sizeof(uintptr_t));
+
+#ifdef VERY_DEBUG
+ for (size_t i = 0; i < event.stack_size; ++i)
+ dbg() << " " << (void*)event.stack[i];
+#endif
+
+ event.timestamp = g_uptime;
+ at(m_count++) = event;
+ return KSuccess;
+}
+
+PerformanceEvent& PerformanceEventBuffer::at(size_t index)
+{
+ ASSERT(index < capacity());
+ auto* events = reinterpret_cast<PerformanceEvent*>(m_buffer.data());
+ return events[index];
+}
+
+KBuffer PerformanceEventBuffer::to_json(pid_t pid, const String& executable_path) const
+{
+ KBufferBuilder builder;
+
+ JsonObjectSerializer object(builder);
+ object.add("pid", pid);
+ object.add("executable", executable_path);
+
+ auto array = object.add_array("events");
+ for (size_t i = 0; i < m_count; ++i) {
+ auto& event = at(i);
+ auto object = array.add_object();
+ switch (event.type) {
+ case PERF_EVENT_MALLOC:
+ object.add("type", "malloc");
+ object.add("ptr", static_cast<u64>(event.data.malloc.ptr));
+ object.add("size", static_cast<u64>(event.data.malloc.size));
+ break;
+ case PERF_EVENT_FREE:
+ object.add("type", "free");
+ object.add("ptr", static_cast<u64>(event.data.free.ptr));
+ break;
+ }
+ object.add("timestamp", event.timestamp);
+ auto stack_array = object.add_array("stack");
+ for (size_t j = 0; j < event.stack_size; ++j) {
+ stack_array.add(event.stack[j]);
+ }
+ stack_array.finish();
+ object.finish();
+ }
+ array.finish();
+ object.finish();
+ return builder.build();
+}
diff --git a/Kernel/PerformanceEventBuffer.h b/Kernel/PerformanceEventBuffer.h
new file mode 100644
index 000000000000..eb4f24baedc4
--- /dev/null
+++ b/Kernel/PerformanceEventBuffer.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <[email protected]>
+ * 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 <Kernel/KBuffer.h>
+#include <Kernel/KResult.h>
+
+struct [[gnu::packed]] MallocPerformanceEvent {
+ size_t size;
+ uintptr_t ptr;
+};
+
+struct [[gnu::packed]] FreePerformanceEvent {
+ size_t size;
+ uintptr_t ptr;
+};
+
+struct [[gnu::packed]] PerformanceEvent {
+ u8 type { 0 };
+ u8 stack_size { 0 };
+ u64 timestamp;
+ union {
+ MallocPerformanceEvent malloc;
+ FreePerformanceEvent free;
+ } data;
+ uintptr_t stack[32];
+};
+
+class PerformanceEventBuffer {
+public:
+ PerformanceEventBuffer();
+
+ KResult append(int type, uintptr_t arg1, uintptr_t arg2);
+
+ size_t capacity() const { return m_buffer.size() / sizeof(PerformanceEvent); }
+ size_t count() const { return m_count; }
+ const PerformanceEvent& at(size_t index) const
+ {
+ return const_cast<PerformanceEventBuffer&>(*this).at(index);
+ }
+
+ KBuffer to_json(pid_t, const String& executable_path) const;
+
+private:
+ PerformanceEvent& at(size_t index);
+
+ size_t m_count { 0 };
+ KBuffer m_buffer;
+};
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index acac5fb086d7..484147c12c4c 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -2940,6 +2940,15 @@ void Process::finalize()
dbg() << "Finalizing process " << *this;
#endif
+ if (m_perf_event_buffer) {
+ auto description_or_error = VFS::the().open("perfcore", O_CREAT | O_EXCL, 0400, current_directory(), UidAndGid { m_uid, m_gid });
+ if (!description_or_error.is_error()) {
+ auto& description = description_or_error.value();
+ auto json = m_perf_event_buffer->to_json(m_pid, m_executable ? m_executable->absolute_path() : "");
+ description->write(json.data(), json.size());
+ }
+ }
+
m_fds.clear();
m_tty = nullptr;
m_executable = nullptr;
@@ -4670,3 +4679,10 @@ int Process::sys$unveil(const Syscall::SC_unveil_params* user_params)
m_veil_state = VeilState::Dropped;
return 0;
}
+
+int Process::sys$perf_event(int type, uintptr_t arg1, uintptr_t arg2)
+{
+ if (!m_perf_event_buffer)
+ m_perf_event_buffer = make<PerformanceEventBuffer>();
+ return m_perf_event_buffer->append(type, arg1, arg2);
+}
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 0e05096c7fd1..9dc4538fb7f8 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -35,6 +35,7 @@
#include <AK/Weakable.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/Lock.h>
+#include <Kernel/PerformanceEventBuffer.h>
#include <Kernel/Syscall.h>
#include <Kernel/TTY/TTY.h>
#include <Kernel/Thread.h>
@@ -301,6 +302,7 @@ class Process : public InlineLinkedListNode<Process>
int sys$chroot(const char* path, size_t path_length, int mount_flags);
int sys$pledge(const Syscall::SC_pledge_params*);
int sys$unveil(const Syscall::SC_unveil_params*);
+ int sys$perf_event(int type, uintptr_t arg1, uintptr_t arg2);
template<bool sockname, typename Params>
int get_sock_or_peer_name(const Params&);
@@ -511,6 +513,8 @@ class Process : public InlineLinkedListNode<Process>
WaitQueue& futex_queue(i32*);
HashMap<u32, OwnPtr<WaitQueue>> m_futex_queues;
+
+ OwnPtr<PerformanceEventBuffer> m_perf_event_buffer;
};
class ProcessInspectionHandle {
diff --git a/Kernel/Syscall.h b/Kernel/Syscall.h
index a5541ab68c85..19f755a99eaf 100644
--- a/Kernel/Syscall.h
+++ b/Kernel/Syscall.h
@@ -175,7 +175,8 @@ typedef u32 socklen_t;
__ENUMERATE_SYSCALL(set_process_boost) \
__ENUMERATE_SYSCALL(chroot) \
__ENUMERATE_SYSCALL(pledge) \
- __ENUMERATE_SYSCALL(unveil)
+ __ENUMERATE_SYSCALL(unveil) \
+ __ENUMERATE_SYSCALL(perf_event)
namespace Syscall {
diff --git a/Kernel/UnixTypes.h b/Kernel/UnixTypes.h
index 6b5492f7ac6b..1c638e6910e1 100644
--- a/Kernel/UnixTypes.h
+++ b/Kernel/UnixTypes.h
@@ -28,6 +28,9 @@
#include <AK/Types.h>
+#define PERF_EVENT_MALLOC 1
+#define PERF_EVENT_FREE 2
+
#define WNOHANG 1
#define WUNTRACED 2
#define WSTOPPED WUNTRACED
|
c27abaabc449e20e8cffac245d1e2686f94e2ba6
|
2021-08-15 18:44:19
|
Lenny Maiorani
|
ak: Stop publishing detail namespaced functions
| false
|
Stop publishing detail namespaced functions
|
ak
|
diff --git a/AK/Array.h b/AK/Array.h
index 22964c7803f8..0393aa6d5663 100644
--- a/AK/Array.h
+++ b/AK/Array.h
@@ -111,4 +111,3 @@ constexpr static auto iota_array(T const offset = {})
using AK::Array;
using AK::iota_array;
-using AK::Detail::integer_sequence_generate_array;
|
18a2685c6a4802a8ca920702e15ac63564af5c9c
|
2022-01-09 03:24:05
|
creator1creeper1
|
ak: Reorder access in FixedArray so that m_size comes before m_elements
| false
|
Reorder access in FixedArray so that m_size comes before m_elements
|
ak
|
diff --git a/AK/FixedArray.h b/AK/FixedArray.h
index a3485d85b35b..310b2ff7394e 100644
--- a/AK/FixedArray.h
+++ b/AK/FixedArray.h
@@ -79,8 +79,8 @@ class FixedArray {
for (size_t i = 0; i < m_size; ++i)
m_elements[i].~T();
kfree_sized(m_elements, sizeof(T) * m_size);
- m_elements = nullptr;
m_size = 0;
+ m_elements = nullptr;
}
size_t size() const { return m_size; }
@@ -110,8 +110,8 @@ class FixedArray {
void swap(FixedArray<T>& other)
{
- ::swap(m_elements, other.m_elements);
::swap(m_size, other.m_size);
+ ::swap(m_elements, other.m_elements);
}
using ConstIterator = SimpleIterator<FixedArray const, T const>;
|
7d3c8d066ffa05e401b23586b49bf09639ae64b0
|
2020-06-28 18:55:32
|
Andreas Kling
|
libweb: Support "pt" length units :^)
| false
|
Support "pt" length units :^)
|
libweb
|
diff --git a/Libraries/LibWeb/CSS/Length.cpp b/Libraries/LibWeb/CSS/Length.cpp
index 7ed66c3f141a..e71cffda40c6 100644
--- a/Libraries/LibWeb/CSS/Length.cpp
+++ b/Libraries/LibWeb/CSS/Length.cpp
@@ -47,6 +47,8 @@ const char* Length::unit_name() const
switch (m_type) {
case Type::Px:
return "px";
+ case Type::Pt:
+ return "pt";
case Type::Em:
return "em";
case Type::Rem:
diff --git a/Libraries/LibWeb/CSS/Length.h b/Libraries/LibWeb/CSS/Length.h
index 023c5ae70269..61ca914a7cc9 100644
--- a/Libraries/LibWeb/CSS/Length.h
+++ b/Libraries/LibWeb/CSS/Length.h
@@ -38,6 +38,7 @@ class Length {
Percentage,
Auto,
Px,
+ Pt,
Em,
Rem,
};
@@ -82,7 +83,7 @@ class Length {
bool is_undefined() const { return m_type == Type::Undefined; }
bool is_percentage() const { return m_type == Type::Percentage; }
bool is_auto() const { return m_type == Type::Auto; }
- bool is_absolute() const { return m_type == Type::Px; }
+ bool is_absolute() const { return m_type == Type::Px || m_type == Type::Pt; }
bool is_relative() const { return m_type == Type::Em || m_type == Type::Rem; }
float raw_value() const { return m_value; }
@@ -95,6 +96,8 @@ class Length {
return 0;
case Type::Px:
return m_value;
+ case Type::Pt:
+ return m_value * 1.33333333f;
case Type::Undefined:
case Type::Percentage:
default:
diff --git a/Libraries/LibWeb/Parser/CSSParser.cpp b/Libraries/LibWeb/Parser/CSSParser.cpp
index c044a5e8f5b3..9bc89980b015 100644
--- a/Libraries/LibWeb/Parser/CSSParser.cpp
+++ b/Libraries/LibWeb/Parser/CSSParser.cpp
@@ -264,28 +264,6 @@ static Optional<float> try_parse_float(const StringView& string)
return is_negative ? -value : value;
}
-static Optional<float> parse_number(const CSS::ParsingContext& context, const StringView& view)
-{
- if (view.ends_with('%'))
- return parse_number(context, view.substring_view(0, view.length() - 1));
-
- // FIXME: Maybe we should have "ends_with_ignoring_case()" ?
- if (view.to_string().to_lowercase().ends_with("px"))
- return parse_number(context, view.substring_view(0, view.length() - 2));
- if (view.to_string().to_lowercase().ends_with("rem"))
- return parse_number(context, view.substring_view(0, view.length() - 3));
- if (view.to_string().to_lowercase().ends_with("em"))
- return parse_number(context, view.substring_view(0, view.length() - 2));
- if (view == "0")
- return 0;
-
- // NOTE: We don't allow things like "width: 100" in standards mode.
- if (!context.in_quirks_mode())
- return {};
-
- return try_parse_float(view);
-}
-
static Length parse_length(const CSS::ParsingContext& context, const StringView& view, bool& is_bad_length)
{
Length::Type type = Length::Type::Undefined;
@@ -297,6 +275,9 @@ static Length parse_length(const CSS::ParsingContext& context, const StringView&
} else if (view.to_string().to_lowercase().ends_with("px")) {
type = Length::Type::Px;
value = try_parse_float(view.substring_view(0, view.length() - 2));
+ } else if (view.to_string().to_lowercase().ends_with("pt")) {
+ type = Length::Type::Pt;
+ value = try_parse_float(view.substring_view(0, view.length() - 2));
} else if (view.to_string().to_lowercase().ends_with("rem")) {
type = Length::Type::Rem;
value = try_parse_float(view.substring_view(0, view.length() - 3));
|
42176d37fce566cf0df09251e4cd11e091562458
|
2021-11-25 03:27:46
|
Sam Atkins
|
libweb: Implement independent GeneralEnclosed class
| false
|
Implement independent GeneralEnclosed class
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/CSS/GeneralEnclosed.h b/Userland/Libraries/LibWeb/CSS/GeneralEnclosed.h
new file mode 100644
index 000000000000..05788ca7136d
--- /dev/null
+++ b/Userland/Libraries/LibWeb/CSS/GeneralEnclosed.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2021, Sam Atkins <[email protected]>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/String.h>
+
+namespace Web::CSS {
+
+// Corresponds to Kleene 3-valued logic.
+// https://www.w3.org/TR/mediaqueries-4/#evaluating
+enum class MatchResult {
+ False,
+ True,
+ Unknown,
+};
+
+inline MatchResult as_match_result(bool value)
+{
+ return value ? MatchResult::True : MatchResult::False;
+}
+
+inline MatchResult negate(MatchResult value)
+{
+ switch (value) {
+ case MatchResult::False:
+ return MatchResult::True;
+ case MatchResult::True:
+ return MatchResult::False;
+ case MatchResult::Unknown:
+ return MatchResult::Unknown;
+ }
+ VERIFY_NOT_REACHED();
+}
+
+template<typename Collection, typename Evaluate>
+inline MatchResult evaluate_and(Collection& collection, Evaluate evaluate)
+{
+ size_t true_results = 0;
+ for (auto& item : collection) {
+ auto item_match = evaluate(item);
+ if (item_match == MatchResult::False)
+ return MatchResult::False;
+ if (item_match == MatchResult::True)
+ true_results++;
+ }
+ if (true_results == collection.size())
+ return MatchResult::True;
+ return MatchResult::Unknown;
+}
+
+template<typename Collection, typename Evaluate>
+inline MatchResult evaluate_or(Collection& collection, Evaluate evaluate)
+{
+ size_t false_results = 0;
+ for (auto& item : collection) {
+ auto item_match = evaluate(item);
+ if (item_match == MatchResult::True)
+ return MatchResult::True;
+ if (item_match == MatchResult::False)
+ false_results++;
+ }
+ if (false_results == collection.size())
+ return MatchResult::False;
+ return MatchResult::Unknown;
+}
+
+// https://www.w3.org/TR/mediaqueries-4/#typedef-general-enclosed
+class GeneralEnclosed {
+public:
+ GeneralEnclosed(String serialized_contents)
+ : m_serialized_contents(move(serialized_contents))
+ {
+ }
+
+ MatchResult evaluate() const { return MatchResult::Unknown; }
+ StringView to_string() const { return m_serialized_contents.view(); }
+
+private:
+ String m_serialized_contents;
+};
+}
|
fd68e606e707e4c932c75f1840452ec1424e5754
|
2021-05-23 21:39:54
|
Idan Horowitz
|
ci: Make BuggieBot reply to pull requests that fail the commit linter
| false
|
Make BuggieBot reply to pull requests that fail the commit linter
|
ci
|
diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
index b52a24378b87..9bc0d674f43a 100644
--- a/.github/workflows/cmake.yml
+++ b/.github/workflows/cmake.yml
@@ -245,50 +245,8 @@ jobs:
UBSAN_OPTIONS: "halt_on_error=1"
if: ${{ matrix.with-fuzzers == 'NO_FUZZ' }}
- lint_commits:
- runs-on: ubuntu-20.04
- if: always() && github.event_name == 'pull_request'
-
- steps:
- - name: Get PR Commits
- id: 'get-pr-commits'
- uses: tim-actions/get-pr-commits@55b867b9b28954e6f5c1a0fe2f729dc926c306d0
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Check linebreaks
- if: ${{ success() || failure() }}
- uses: tim-actions/[email protected]
- with:
- commits: ${{ steps.get-pr-commits.outputs.commits }}
- pattern: '^[^\r]*$'
- error: 'Commit message contains CRLF line breaks (only unix-style LF linebreaks are allowed)'
-
- - name: Check Line Length
- uses: tim-actions/[email protected]
- with:
- commits: ${{ steps.get-pr-commits.outputs.commits }}
- pattern: '^.{0,72}(\n.{0,72})*$'
- error: 'Commit message lines are too long (maximum allowed is 72 characters)'
-
- - name: Check subsystem
- if: ${{ success() || failure() }}
- uses: tim-actions/[email protected]
- with:
- commits: ${{ steps.get-pr-commits.outputs.commits }}
- pattern: '^\S.*?: .+'
- error: 'Missing category in commit title (if this is a fix up of a previous commit, it should be squashed)'
-
- - name: Check title
- if: ${{ success() || failure() }}
- uses: tim-actions/[email protected]
- with:
- commits: ${{ steps.get-pr-commits.outputs.commits }}
- pattern: '^.+[^.\n](\n.*)*$'
- error: 'Commit title ends in a period'
-
notify_irc:
- needs: [build_and_test_serenity, build_and_test_lagom, lint_commits]
+ needs: [build_and_test_serenity, build_and_test_lagom]
runs-on: ubuntu-20.04
if: always() && github.repository == 'SerenityOS/serenity' && (github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/master'))
diff --git a/.github/workflows/lintcommits.yml b/.github/workflows/lintcommits.yml
new file mode 100644
index 000000000000..9e00ea67ae7b
--- /dev/null
+++ b/.github/workflows/lintcommits.yml
@@ -0,0 +1,54 @@
+name: Commit linter
+
+on: [pull_request_target]
+
+jobs:
+ lint_commits:
+ runs-on: ubuntu-20.04
+ if: always() && github.repository == 'SerenityOS/serenity'
+
+ steps:
+ - name: Get PR Commits
+ id: 'get-pr-commits'
+ uses: IdanHo/get-pr-commits@d94b66d146a31ef91e54a2597dee4fb523157232
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Check linebreaks
+ if: ${{ success() || failure() }}
+ uses: tim-actions/[email protected]
+ with:
+ commits: ${{ steps.get-pr-commits.outputs.commits }}
+ pattern: '^[^\r]*$'
+ error: 'Commit message contains CRLF line breaks (only unix-style LF linebreaks are allowed)'
+
+ - name: Check Line Length
+ uses: tim-actions/[email protected]
+ with:
+ commits: ${{ steps.get-pr-commits.outputs.commits }}
+ pattern: '^.{0,72}(\n.{0,72})*$'
+ error: 'Commit message lines are too long (maximum allowed is 72 characters)'
+
+ - name: Check subsystem
+ if: ${{ success() || failure() }}
+ uses: tim-actions/[email protected]
+ with:
+ commits: ${{ steps.get-pr-commits.outputs.commits }}
+ pattern: '^\S.*?: .+'
+ error: 'Missing category in commit title (if this is a fix up of a previous commit, it should be squashed)'
+
+ - name: Check title
+ if: ${{ success() || failure() }}
+ uses: tim-actions/[email protected]
+ with:
+ commits: ${{ steps.get-pr-commits.outputs.commits }}
+ pattern: '^.+[^.\n](\n.*)*$'
+ error: 'Commit title ends in a period'
+
+ - name: Comment on PR
+ if: ${{ failure() }}
+ uses: unsplash/comment-on-pr@85a56be792d927ac4bfa2f4326607d38e80e6e60
+ env:
+ GITHUB_TOKEN: ${{ secrets.BUGGIEBOT }}
+ with:
+ msg: "One or more of the commits in this PR do not match the [code submission policy](https://github.com/SerenityOS/serenity/blob/master/CONTRIBUTING.md#code-submission-policy), please check the `lint_commits` CI job for more details."
|
50a2cb38e5498079707f786a9fdf381d448fefd0
|
2021-01-24 05:36:24
|
Luke
|
kernel: Fix two error codes being returned as positive in Process::exec
| false
|
Fix two error codes being returned as positive in Process::exec
|
kernel
|
diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp
index c42e3bb02d9f..1c66a48db110 100644
--- a/Kernel/Syscalls/execve.cpp
+++ b/Kernel/Syscalls/execve.cpp
@@ -819,12 +819,12 @@ int Process::exec(String path, Vector<String> arguments, Vector<String> environm
// #2) ELF32 for i386
if (nread_or_error.value() < (int)sizeof(Elf32_Ehdr))
- return ENOEXEC;
+ return -ENOEXEC;
auto main_program_header = (Elf32_Ehdr*)first_page;
if (!ELF::validate_elf_header(*main_program_header, metadata.size)) {
dbgln("exec({}): File has invalid ELF header", path);
- return ENOEXEC;
+ return -ENOEXEC;
}
auto elf_result = find_elf_interpreter_for_executable(path, *main_program_header, nread_or_error.value(), metadata.size);
|
2189cc6bf1d15bf39c8b5b571044a53dd2813602
|
2021-11-24 18:16:09
|
Vyacheslav Pukhanov
|
libgui: Reverse FilteringProxyModel update propagation flow
| false
|
Reverse FilteringProxyModel update propagation flow
|
libgui
|
diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp
index 23df13616cae..8c80f7318fcd 100644
--- a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp
+++ b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp
@@ -46,7 +46,6 @@ Variant FilteringProxyModel::data(ModelIndex const& index, ModelRole role) const
void FilteringProxyModel::invalidate()
{
- m_model.invalidate();
filter();
did_update();
}
diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.h b/Userland/Libraries/LibGUI/FilteringProxyModel.h
index b642e55b0777..55c3fea3f329 100644
--- a/Userland/Libraries/LibGUI/FilteringProxyModel.h
+++ b/Userland/Libraries/LibGUI/FilteringProxyModel.h
@@ -14,14 +14,18 @@
namespace GUI {
-class FilteringProxyModel final : public Model {
+class FilteringProxyModel final : public Model
+ , public ModelClient {
public:
static NonnullRefPtr<FilteringProxyModel> construct(Model& model)
{
return adopt_ref(*new FilteringProxyModel(model));
}
- virtual ~FilteringProxyModel() override {};
+ virtual ~FilteringProxyModel() override
+ {
+ m_model.unregister_client(*this);
+ };
virtual int row_count(ModelIndex const& = ModelIndex()) const override;
virtual int column_count(ModelIndex const& = ModelIndex()) const override;
@@ -35,11 +39,15 @@ class FilteringProxyModel final : public Model {
ModelIndex map(ModelIndex const&) const;
+protected:
+ virtual void model_did_update([[maybe_unused]] unsigned flags) override { invalidate(); }
+
private:
void filter();
explicit FilteringProxyModel(Model& model)
: m_model(model)
{
+ m_model.register_client(*this);
}
Model& m_model;
|
f2aa5efbeb6884b51b22319c30fe69ebc09eff9f
|
2021-06-20 18:46:26
|
Marcus Nilsson
|
pixelpaint: Add basic support for closing tabs
| false
|
Add basic support for closing tabs
|
pixelpaint
|
diff --git a/Userland/Applications/PixelPaint/main.cpp b/Userland/Applications/PixelPaint/main.cpp
index d42f702d0f7f..6aa591ad2d85 100644
--- a/Userland/Applications/PixelPaint/main.cpp
+++ b/Userland/Applications/PixelPaint/main.cpp
@@ -61,6 +61,7 @@ int main(int argc, char** argv)
auto& toolbox = *main_widget.find_descendant_of_type_named<PixelPaint::ToolboxWidget>("toolbox");
auto& tab_widget = *main_widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
tab_widget.set_container_margins({ 4, 4, 5, 5 });
+ tab_widget.set_close_button_enabled(true);
auto& palette_widget = *main_widget.find_descendant_of_type_named<PixelPaint::PaletteWidget>("palette_widget");
@@ -524,6 +525,13 @@ int main(int argc, char** argv)
return image_editor;
};
+ tab_widget.on_tab_close_click = [&](auto& widget) {
+ auto& image_editor = downcast<PixelPaint::ImageEditor>(widget);
+ tab_widget.deferred_invoke([&](auto&) {
+ tab_widget.remove_tab(image_editor);
+ });
+ };
+
tab_widget.on_change = [&](auto& widget) {
auto& image_editor = downcast<PixelPaint::ImageEditor>(widget);
palette_widget.set_image_editor(image_editor);
|
274ac3c6288b42c7464e0e60966b5c5bc2c158ac
|
2020-07-12 19:05:01
|
Andreas Kling
|
userspaceemulator: Implement the XADD instruction
| false
|
Implement the XADD instruction
|
userspaceemulator
|
diff --git a/DevTools/UserspaceEmulator/SoftCPU.cpp b/DevTools/UserspaceEmulator/SoftCPU.cpp
index 57f4677bd9ad..61d7ce136d7d 100644
--- a/DevTools/UserspaceEmulator/SoftCPU.cpp
+++ b/DevTools/UserspaceEmulator/SoftCPU.cpp
@@ -1603,9 +1603,33 @@ void SoftCPU::VERR_RM16(const X86::Instruction&) { TODO(); }
void SoftCPU::VERW_RM16(const X86::Instruction&) { TODO(); }
void SoftCPU::WAIT(const X86::Instruction&) { TODO(); }
void SoftCPU::WBINVD(const X86::Instruction&) { TODO(); }
-void SoftCPU::XADD_RM16_reg16(const X86::Instruction&) { TODO(); }
-void SoftCPU::XADD_RM32_reg32(const X86::Instruction&) { TODO(); }
-void SoftCPU::XADD_RM8_reg8(const X86::Instruction&) { TODO(); }
+
+void SoftCPU::XADD_RM16_reg16(const X86::Instruction& insn)
+{
+ auto dest = insn.modrm().read16(*this, insn);
+ auto src = gpr16(insn.reg16());
+ auto result = op_add(*this, dest, src);
+ gpr16(insn.reg16()) = dest;
+ insn.modrm().write16(*this, insn, result);
+}
+
+void SoftCPU::XADD_RM32_reg32(const X86::Instruction& insn)
+{
+ auto dest = insn.modrm().read32(*this, insn);
+ auto src = gpr32(insn.reg32());
+ auto result = op_add(*this, dest, src);
+ gpr32(insn.reg32()) = dest;
+ insn.modrm().write32(*this, insn, result);
+}
+
+void SoftCPU::XADD_RM8_reg8(const X86::Instruction& insn)
+{
+ auto dest = insn.modrm().read8(*this, insn);
+ auto src = gpr8(insn.reg8());
+ auto result = op_add(*this, dest, src);
+ gpr8(insn.reg8()) = dest;
+ insn.modrm().write8(*this, insn, result);
+}
void SoftCPU::XCHG_AX_reg16(const X86::Instruction& insn)
{
|
9559682f5c1b6bfdbeb202e96de64a7324f233fe
|
2022-11-14 05:28:54
|
Liav A
|
kernel: Disallow jail creation from a process within a jail
| false
|
Disallow jail creation from a process within a jail
|
kernel
|
diff --git a/Kernel/Syscalls/jail.cpp b/Kernel/Syscalls/jail.cpp
index 3ac5453106ce..68497bf515aa 100644
--- a/Kernel/Syscalls/jail.cpp
+++ b/Kernel/Syscalls/jail.cpp
@@ -25,9 +25,17 @@ ErrorOr<FlatPtr> Process::sys$jail_create(Userspace<Syscall::SC_jail_create_para
if (jail_name->length() > jail_name_max_size)
return ENAMETOOLONG;
- auto jail = TRY(JailManagement::the().create_jail(move(jail_name)));
- params.index = jail->index().value();
-
+ params.index = TRY(m_attached_jail.with([&](auto& my_jail) -> ErrorOr<u64> {
+ // Note: If we are already in a jail, don't let the process to be able to create other jails
+ // even if it will not be able to join them later on. The reason for this is to prevent as much as possible
+ // any info leak about the "outside world" jail metadata.
+ if (my_jail)
+ return Error::from_errno(EPERM);
+ auto jail = TRY(JailManagement::the().create_jail(move(jail_name)));
+ return jail->index().value();
+ }));
+ // Note: We do the copy_to_user outside of the m_attached_jail Spinlock locked scope because
+ // we rely on page faults to work properly.
TRY(copy_to_user(user_params, ¶ms));
return 0;
}
|
839c23417dfc1dcb341ed4c27b96f10089ab4484
|
2023-02-09 00:36:42
|
Julian Offenhäuser
|
ports: Add speexdsp
| false
|
Add speexdsp
|
ports
|
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md
index 90cdc07afa7a..e239c9caaaba 100644
--- a/Ports/AvailablePorts.md
+++ b/Ports/AvailablePorts.md
@@ -247,6 +247,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
| [`sl`](sl/) | Steam Locomotive (SL) | | https://github.com/mtoyoda/sl |
| [`soltys`](soltys/) | Soltys | 1.0 | https://www.scummvm.org/games/#games-soltys |
| [`sparsehash`](sparsehash/) | Google's C++ associative containers | 2.0.4 | https://github.com/sparsehash/sparsehash |
+| [`speexdsp`](speexdsp/) | Speex audio processing library | 1.2.1 | https://www.speex.org/ |
| [`sqlite`](sqlite/) | SQLite | 3380500 | https://www.sqlite.org/ |
| [`stb`](stb/) | stb single-file public domain libraries for C/C++ | af1a5bc | https://github.com/nothings/stb |
| [`stpuzzles`](stpuzzles/) | Simon Tatham's Portable Puzzle Collection | | https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ |
diff --git a/Ports/speexdsp/package.sh b/Ports/speexdsp/package.sh
new file mode 100755
index 000000000000..8e60f769f4b1
--- /dev/null
+++ b/Ports/speexdsp/package.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env -S bash ../.port_include.sh
+port='speexdsp'
+version='1.2.1'
+auth_type='sha256'
+useconfigure='true'
+files="https://downloads.xiph.org/releases/speex/speexdsp-${version}.tar.gz speexdsp-${version}.tar.gz 8c777343e4a6399569c72abc38a95b24db56882c83dbdb6c6424a5f4aeb54d3d"
|
00b84249d6e25c43efb40fa1d8c1f76c80a40019
|
2021-09-13 01:04:57
|
Sam Atkins
|
libweb: Rename CSS::Parser::SelectorParsingResult => ParsingResult
| false
|
Rename CSS::Parser::SelectorParsingResult => ParsingResult
|
libweb
|
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index 0f3e40349a96..9379d0f78320 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -187,7 +187,7 @@ Optional<SelectorList> Parser::parse_as_selector()
}
template<typename T>
-Result<SelectorList, Parser::SelectorParsingResult> Parser::parse_a_selector(TokenStream<T>& tokens)
+Result<SelectorList, Parser::ParsingResult> Parser::parse_a_selector(TokenStream<T>& tokens)
{
return parse_a_selector_list(tokens);
}
@@ -202,13 +202,13 @@ Optional<SelectorList> Parser::parse_as_relative_selector()
}
template<typename T>
-Result<SelectorList, Parser::SelectorParsingResult> Parser::parse_a_relative_selector(TokenStream<T>& tokens)
+Result<SelectorList, Parser::ParsingResult> Parser::parse_a_relative_selector(TokenStream<T>& tokens)
{
return parse_a_relative_selector_list(tokens);
}
template<typename T>
-Result<SelectorList, Parser::SelectorParsingResult> Parser::parse_a_selector_list(TokenStream<T>& tokens)
+Result<SelectorList, Parser::ParsingResult> Parser::parse_a_selector_list(TokenStream<T>& tokens)
{
auto comma_separated_lists = parse_a_comma_separated_list_of_component_values(tokens);
@@ -222,13 +222,13 @@ Result<SelectorList, Parser::SelectorParsingResult> Parser::parse_a_selector_lis
}
if (selectors.is_empty())
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
return selectors;
}
template<typename T>
-Result<SelectorList, Parser::SelectorParsingResult> Parser::parse_a_relative_selector_list(TokenStream<T>& tokens)
+Result<SelectorList, Parser::ParsingResult> Parser::parse_a_relative_selector_list(TokenStream<T>& tokens)
{
auto comma_separated_lists = parse_a_comma_separated_list_of_component_values(tokens);
@@ -242,12 +242,12 @@ Result<SelectorList, Parser::SelectorParsingResult> Parser::parse_a_relative_sel
}
if (selectors.is_empty())
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
return selectors;
}
-Result<NonnullRefPtr<Selector>, Parser::SelectorParsingResult> Parser::parse_complex_selector(TokenStream<StyleComponentValueRule>& tokens, bool allow_starting_combinator)
+Result<NonnullRefPtr<Selector>, Parser::ParsingResult> Parser::parse_complex_selector(TokenStream<StyleComponentValueRule>& tokens, bool allow_starting_combinator)
{
Vector<Selector::CompoundSelector> compound_selectors;
@@ -256,7 +256,7 @@ Result<NonnullRefPtr<Selector>, Parser::SelectorParsingResult> Parser::parse_com
return first_selector.error();
if (!allow_starting_combinator) {
if (first_selector.value().combinator != Selector::Combinator::Descendant)
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
first_selector.value().combinator = Selector::Combinator::None;
}
compound_selectors.append(first_selector.value());
@@ -264,7 +264,7 @@ Result<NonnullRefPtr<Selector>, Parser::SelectorParsingResult> Parser::parse_com
while (tokens.has_next_token()) {
auto compound_selector = parse_compound_selector(tokens);
if (compound_selector.is_error()) {
- if (compound_selector.error() == SelectorParsingResult::Done)
+ if (compound_selector.error() == ParsingResult::Done)
break;
else
return compound_selector.error();
@@ -273,12 +273,12 @@ Result<NonnullRefPtr<Selector>, Parser::SelectorParsingResult> Parser::parse_com
}
if (compound_selectors.is_empty())
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
return Selector::create(move(compound_selectors));
}
-Result<Selector::CompoundSelector, Parser::SelectorParsingResult> Parser::parse_compound_selector(TokenStream<StyleComponentValueRule>& tokens)
+Result<Selector::CompoundSelector, Parser::ParsingResult> Parser::parse_compound_selector(TokenStream<StyleComponentValueRule>& tokens)
{
tokens.skip_whitespace();
@@ -291,7 +291,7 @@ Result<Selector::CompoundSelector, Parser::SelectorParsingResult> Parser::parse_
while (tokens.has_next_token()) {
auto component = parse_simple_selector(tokens);
if (component.is_error()) {
- if (component.error() == SelectorParsingResult::Done)
+ if (component.error() == ParsingResult::Done)
break;
else
return component.error();
@@ -301,7 +301,7 @@ Result<Selector::CompoundSelector, Parser::SelectorParsingResult> Parser::parse_
}
if (simple_selectors.is_empty())
- return SelectorParsingResult::Done;
+ return ParsingResult::Done;
return Selector::CompoundSelector { combinator, move(simple_selectors) };
}
@@ -333,7 +333,7 @@ Optional<Selector::Combinator> Parser::parse_selector_combinator(TokenStream<Sty
return {};
}
-Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_simple_selector(TokenStream<StyleComponentValueRule>& tokens)
+Result<Selector::SimpleSelector, Parser::ParsingResult> Parser::parse_simple_selector(TokenStream<StyleComponentValueRule>& tokens)
{
auto peek_token_ends_selector = [&]() -> bool {
auto& value = tokens.peek_token();
@@ -341,7 +341,7 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
};
if (peek_token_ends_selector())
- return SelectorParsingResult::Done;
+ return ParsingResult::Done;
auto& first_value = tokens.next_token();
@@ -353,7 +353,7 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
} else if (first_value.is(Token::Type::Hash)) {
if (first_value.token().hash_type() != Token::HashType::Id) {
dbgln_if(CSS_PARSER_DEBUG, "Selector contains hash token that is not an id: {}", first_value.to_debug_string());
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
return Selector::SimpleSelector {
.type = Selector::SimpleSelector::Type::Id,
@@ -362,12 +362,12 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
} else if (first_value.is(Token::Type::Delim) && first_value.token().delim() == "."sv) {
if (peek_token_ends_selector())
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
auto& class_name_value = tokens.next_token();
if (!class_name_value.is(Token::Type::Ident)) {
dbgln_if(CSS_PARSER_DEBUG, "Expected an ident after '.', got: {}", class_name_value.to_debug_string());
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
return Selector::SimpleSelector {
.type = Selector::SimpleSelector::Type::Class,
@@ -385,14 +385,14 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
if (attribute_parts.is_empty()) {
dbgln_if(CSS_PARSER_DEBUG, "CSS attribute selector is empty!");
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
// FIXME: Handle namespace prefix for attribute name.
auto& attribute_part = attribute_parts.first();
if (!attribute_part.is(Token::Type::Ident)) {
dbgln_if(CSS_PARSER_DEBUG, "Expected ident for attribute name, got: '{}'", attribute_part.to_debug_string());
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
Selector::SimpleSelector simple_selector {
@@ -415,7 +415,7 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
auto& delim_part = attribute_parts.at(attribute_index);
if (!delim_part.is(Token::Type::Delim)) {
dbgln_if(CSS_PARSER_DEBUG, "Expected a delim for attribute comparison, got: '{}'", delim_part.to_debug_string());
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
if (delim_part.token().delim() == "="sv) {
@@ -425,13 +425,13 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
attribute_index++;
if (attribute_index >= attribute_parts.size()) {
dbgln_if(CSS_PARSER_DEBUG, "Attribute selector ended part way through a match type.");
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
auto& delim_second_part = attribute_parts.at(attribute_index);
if (!(delim_second_part.is(Token::Type::Delim) && delim_second_part.token().delim() == "=")) {
dbgln_if(CSS_PARSER_DEBUG, "Expected a double delim for attribute comparison, got: '{}{}'", delim_part.to_debug_string(), delim_second_part.to_debug_string());
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
if (delim_part.token().delim() == "~"sv) {
@@ -454,13 +454,13 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
if (attribute_index >= attribute_parts.size()) {
dbgln_if(CSS_PARSER_DEBUG, "Attribute selector ended without a value to match.");
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
auto& value_part = attribute_parts.at(attribute_index);
if (!value_part.is(Token::Type::Ident) && !value_part.is(Token::Type::String)) {
dbgln_if(CSS_PARSER_DEBUG, "Expected a string or ident for the value to match attribute against, got: '{}'", value_part.to_debug_string());
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
simple_selector.attribute.value = value_part.token().is(Token::Type::Ident) ? value_part.token().ident() : value_part.token().string();
@@ -469,14 +469,14 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
} else if (first_value.is(Token::Type::Colon)) {
if (peek_token_ends_selector())
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
bool is_pseudo = false;
if (tokens.peek_token().is(Token::Type::Colon)) {
is_pseudo = true;
tokens.next_token();
if (peek_token_ends_selector())
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
if (is_pseudo) {
@@ -487,12 +487,12 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
auto& name_token = tokens.next_token();
if (!name_token.is(Token::Type::Ident)) {
dbgln_if(CSS_PARSER_DEBUG, "Expected an ident for pseudo-element, got: '{}'", name_token.to_debug_string());
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
auto pseudo_name = name_token.token().ident();
if (has_ignored_vendor_prefix(pseudo_name))
- return SelectorParsingResult::IncludesIgnoredVendorPrefix;
+ return ParsingResult::IncludesIgnoredVendorPrefix;
if (pseudo_name.equals_ignoring_case("after")) {
simple_selector.pseudo_element = Selector::SimpleSelector::PseudoElement::After;
@@ -504,14 +504,14 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
simple_selector.pseudo_element = Selector::SimpleSelector::PseudoElement::FirstLine;
} else {
dbgln_if(CSS_PARSER_DEBUG, "Unrecognized pseudo-element: '{}'", pseudo_name);
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
return simple_selector;
}
if (peek_token_ends_selector())
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
auto& pseudo_class_token = tokens.next_token();
Selector::SimpleSelector simple_selector {
@@ -521,7 +521,7 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
if (pseudo_class_token.is(Token::Type::Ident)) {
auto pseudo_name = pseudo_class_token.token().ident();
if (has_ignored_vendor_prefix(pseudo_name))
- return SelectorParsingResult::IncludesIgnoredVendorPrefix;
+ return ParsingResult::IncludesIgnoredVendorPrefix;
if (pseudo_name.equals_ignoring_case("active")) {
simple_selector.pseudo_class.type = Selector::SimpleSelector::PseudoClass::Type::Active;
@@ -572,7 +572,7 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
simple_selector.pseudo_element = Selector::SimpleSelector::PseudoElement::FirstLine;
} else {
dbgln_if(CSS_PARSER_DEBUG, "Unknown pseudo class: '{}'", pseudo_name);
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
return simple_selector;
@@ -586,7 +586,7 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
auto not_selector = parse_a_selector(function_token_stream);
if (not_selector.is_error()) {
dbgln_if(CSS_PARSER_DEBUG, "Invalid selector in :not() clause");
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
simple_selector.pseudo_class.not_selector = not_selector.release_value();
} else if (pseudo_function.name().equals_ignoring_case("nth-child")) {
@@ -597,7 +597,7 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
simple_selector.pseudo_class.nth_child_pattern = nth_child_pattern.value();
} else {
dbgln_if(CSS_PARSER_DEBUG, "!!! Invalid nth-child format");
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
} else if (pseudo_function.name().equals_ignoring_case("nth-last-child")) {
simple_selector.pseudo_class.type = Selector::SimpleSelector::PseudoClass::Type::NthLastChild;
@@ -607,18 +607,18 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
simple_selector.pseudo_class.nth_child_pattern = nth_child_pattern.value();
} else {
dbgln_if(CSS_PARSER_DEBUG, "!!! Invalid nth-child format");
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
} else {
dbgln_if(CSS_PARSER_DEBUG, "Unknown pseudo class: '{}'()", pseudo_function.name());
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
return simple_selector;
} else {
dbgln_if(CSS_PARSER_DEBUG, "Unexpected Block in pseudo-class name, expected a function or identifier. '{}'", pseudo_class_token.to_debug_string());
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
}
@@ -628,12 +628,12 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
auto delim = first_value.token().delim();
if ((delim == ">"sv) || (delim == "+"sv) || (delim == "~"sv) || (delim == "|"sv)) {
tokens.reconsume_current_input_token();
- return SelectorParsingResult::Done;
+ return ParsingResult::Done;
}
}
dbgln_if(CSS_PARSER_DEBUG, "!!! Invalid simple selector!");
- return SelectorParsingResult::SyntaxError;
+ return ParsingResult::SyntaxError;
}
NonnullRefPtrVector<StyleRule> Parser::consume_a_list_of_rules(bool top_level)
@@ -1232,7 +1232,7 @@ RefPtr<CSSRule> Parser::convert_to_rule(NonnullRefPtr<StyleRule> rule)
auto selectors = parse_a_selector(prelude_stream);
if (selectors.is_error()) {
- if (selectors.error() != SelectorParsingResult::IncludesIgnoredVendorPrefix) {
+ if (selectors.error() != ParsingResult::IncludesIgnoredVendorPrefix) {
dbgln("CSSParser: style rule selectors invalid; discarding.");
prelude_stream.dump_all_tokens();
}
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
index 50a344ce4d3a..254db66e743b 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
@@ -100,7 +100,7 @@ class Parser {
RefPtr<StyleValue> parse_as_css_value(PropertyID);
private:
- enum class SelectorParsingResult {
+ enum class ParsingResult {
Done,
IncludesIgnoredVendorPrefix,
SyntaxError,
@@ -123,13 +123,13 @@ class Parser {
template<typename T>
Vector<Vector<StyleComponentValueRule>> parse_a_comma_separated_list_of_component_values(TokenStream<T>&);
template<typename T>
- Result<SelectorList, SelectorParsingResult> parse_a_selector(TokenStream<T>&);
+ Result<SelectorList, ParsingResult> parse_a_selector(TokenStream<T>&);
template<typename T>
- Result<SelectorList, SelectorParsingResult> parse_a_relative_selector(TokenStream<T>&);
+ Result<SelectorList, ParsingResult> parse_a_relative_selector(TokenStream<T>&);
template<typename T>
- Result<SelectorList, SelectorParsingResult> parse_a_selector_list(TokenStream<T>&);
+ Result<SelectorList, ParsingResult> parse_a_selector_list(TokenStream<T>&);
template<typename T>
- Result<SelectorList, SelectorParsingResult> parse_a_relative_selector_list(TokenStream<T>&);
+ Result<SelectorList, ParsingResult> parse_a_relative_selector_list(TokenStream<T>&);
Optional<Selector::SimpleSelector::ANPlusBPattern> parse_a_n_plus_b_pattern(TokenStream<StyleComponentValueRule>&);
@@ -212,10 +212,10 @@ class Parser {
static OwnPtr<CalculatedStyleValue::CalcNumberSumPartWithOperator> parse_calc_number_sum_part_with_operator(ParsingContext const&, TokenStream<StyleComponentValueRule>&);
static OwnPtr<CalculatedStyleValue::CalcSum> parse_calc_expression(ParsingContext const&, Vector<StyleComponentValueRule> const&);
- Result<NonnullRefPtr<Selector>, SelectorParsingResult> parse_complex_selector(TokenStream<StyleComponentValueRule>&, bool allow_starting_combinator);
- Result<Selector::CompoundSelector, SelectorParsingResult> parse_compound_selector(TokenStream<StyleComponentValueRule>&);
+ Result<NonnullRefPtr<Selector>, ParsingResult> parse_complex_selector(TokenStream<StyleComponentValueRule>&, bool allow_starting_combinator);
+ Result<Selector::CompoundSelector, ParsingResult> parse_compound_selector(TokenStream<StyleComponentValueRule>&);
Optional<Selector::Combinator> parse_selector_combinator(TokenStream<StyleComponentValueRule>&);
- Result<Selector::SimpleSelector, SelectorParsingResult> parse_simple_selector(TokenStream<StyleComponentValueRule>&);
+ Result<Selector::SimpleSelector, ParsingResult> parse_simple_selector(TokenStream<StyleComponentValueRule>&);
static bool has_ignored_vendor_prefix(StringView const&);
|
b5e70908aa874d63860076c0c5e9f850a508bba4
|
2025-01-28 05:42:45
|
Andreas Kling
|
libweb: Segregate StyleComputer rule caches per Document-or-ShadowRoot
| false
|
Segregate StyleComputer rule caches per Document-or-ShadowRoot
|
libweb
|
diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cpp
index 7fa6fe2c23bb..53820b8577da 100644
--- a/Libraries/LibWeb/CSS/StyleComputer.cpp
+++ b/Libraries/LibWeb/CSS/StyleComputer.cpp
@@ -381,20 +381,30 @@ void StyleComputer::for_each_stylesheet(CascadeOrigin cascade_origin, Callback c
}
}
-StyleComputer::RuleCache const* StyleComputer::rule_cache_for_cascade_origin(CascadeOrigin cascade_origin, FlyString const& qualified_layer_name) const
+StyleComputer::RuleCache const* StyleComputer::rule_cache_for_cascade_origin(CascadeOrigin cascade_origin, FlyString const& qualified_layer_name, GC::Ptr<DOM::ShadowRoot const> shadow_root) const
{
- switch (cascade_origin) {
- case CascadeOrigin::Author:
- if (qualified_layer_name.is_empty())
+ auto const* rule_caches_for_document_and_shadow_roots = [&]() -> RuleCachesForDocumentAndShadowRoots const* {
+ switch (cascade_origin) {
+ case CascadeOrigin::Author:
return m_author_rule_cache;
- return m_layer_rule_caches.get(qualified_layer_name).value_or(nullptr);
- case CascadeOrigin::User:
- return m_user_rule_cache;
- case CascadeOrigin::UserAgent:
- return m_user_agent_rule_cache;
- default:
- TODO();
- }
+ case CascadeOrigin::User:
+ return m_user_rule_cache;
+ case CascadeOrigin::UserAgent:
+ return m_user_agent_rule_cache;
+ default:
+ VERIFY_NOT_REACHED();
+ }
+ }();
+ auto const* rule_caches_by_layer = [&]() -> RuleCaches const* {
+ if (shadow_root)
+ return rule_caches_for_document_and_shadow_roots->for_shadow_roots.get(*shadow_root).value_or(nullptr);
+ return &rule_caches_for_document_and_shadow_roots->for_document;
+ }();
+ if (!rule_caches_by_layer)
+ return nullptr;
+ if (qualified_layer_name.is_empty())
+ return &rule_caches_by_layer->main;
+ return rule_caches_by_layer->by_layer.get(qualified_layer_name).value_or(nullptr);
}
[[nodiscard]] static bool filter_namespace_rule(Optional<FlyString> const& element_namespace_uri, MatchingRule const& rule)
@@ -478,11 +488,6 @@ Vector<MatchingRule const*> StyleComputer::collect_matching_rules(DOM::Element c
else if (shadow_root)
shadow_host = shadow_root->host();
- auto const* maybe_rule_cache = rule_cache_for_cascade_origin(cascade_origin, qualified_layer_name);
- if (!maybe_rule_cache)
- return {};
- auto& rule_cache = *maybe_rule_cache;
-
Vector<MatchingRule const&, 512> rules_to_run;
auto add_rule_to_run = [&](MatchingRule const& rule_to_run) {
@@ -524,34 +529,48 @@ Vector<MatchingRule const*> StyleComputer::collect_matching_rules(DOM::Element c
}
};
- for (auto const& class_name : element.class_names()) {
- if (auto it = rule_cache.rules_by_class.find(class_name); it != rule_cache.rules_by_class.end())
- add_rules_to_run(it->value);
- }
- if (auto id = element.id(); id.has_value()) {
- if (auto it = rule_cache.rules_by_id.find(id.value()); it != rule_cache.rules_by_id.end())
+ auto add_rules_from_cache = [&](RuleCache const& rule_cache) {
+ for (auto const& class_name : element.class_names()) {
+ if (auto it = rule_cache.rules_by_class.find(class_name); it != rule_cache.rules_by_class.end())
+ add_rules_to_run(it->value);
+ }
+ if (auto id = element.id(); id.has_value()) {
+ if (auto it = rule_cache.rules_by_id.find(id.value()); it != rule_cache.rules_by_id.end())
+ add_rules_to_run(it->value);
+ }
+ if (auto it = rule_cache.rules_by_tag_name.find(element.local_name()); it != rule_cache.rules_by_tag_name.end())
add_rules_to_run(it->value);
- }
- if (auto it = rule_cache.rules_by_tag_name.find(element.local_name()); it != rule_cache.rules_by_tag_name.end())
- add_rules_to_run(it->value);
- if (pseudo_element.has_value()) {
- if (CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value())) {
- add_rules_to_run(rule_cache.rules_by_pseudo_element.at(to_underlying(pseudo_element.value())));
- } else {
- // NOTE: We don't cache rules for unknown pseudo-elements. They can't match anything anyway.
+ if (pseudo_element.has_value()) {
+ if (CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value())) {
+ add_rules_to_run(rule_cache.rules_by_pseudo_element.at(to_underlying(pseudo_element.value())));
+ } else {
+ // NOTE: We don't cache rules for unknown pseudo-elements. They can't match anything anyway.
+ }
}
- }
- if (element.is_document_element())
- add_rules_to_run(rule_cache.root_rules);
+ if (element.is_document_element())
+ add_rules_to_run(rule_cache.root_rules);
- element.for_each_attribute([&](auto& name, auto&) {
- if (auto it = rule_cache.rules_by_attribute_name.find(name); it != rule_cache.rules_by_attribute_name.end()) {
- add_rules_to_run(it->value);
- }
- });
+ element.for_each_attribute([&](auto& name, auto&) {
+ if (auto it = rule_cache.rules_by_attribute_name.find(name); it != rule_cache.rules_by_attribute_name.end())
+ add_rules_to_run(it->value);
+ });
+
+ add_rules_to_run(rule_cache.other_rules);
+ };
- add_rules_to_run(rule_cache.other_rules);
+ if (auto const* rule_cache = rule_cache_for_cascade_origin(cascade_origin, qualified_layer_name, nullptr))
+ add_rules_from_cache(*rule_cache);
+
+ if (shadow_root) {
+ if (auto const* rule_cache = rule_cache_for_cascade_origin(cascade_origin, qualified_layer_name, shadow_root))
+ add_rules_from_cache(*rule_cache);
+ }
+
+ if (element_shadow_root) {
+ if (auto const* rule_cache = rule_cache_for_cascade_origin(cascade_origin, qualified_layer_name, element_shadow_root))
+ add_rules_from_cache(*rule_cache);
+ }
Vector<MatchingRule const*> matching_rules;
matching_rules.ensure_capacity(rules_to_run.size());
@@ -2450,8 +2469,10 @@ GC::Ref<ComputedProperties> StyleComputer::compute_properties(DOM::Element& elem
if (pseudo_element.has_value())
effect->set_pseudo_element(Selector::PseudoElement { pseudo_element.value() });
- if (auto keyframe_set = m_author_rule_cache->rules_by_animation_keyframes.get(animation->id()); keyframe_set.has_value())
- effect->set_key_frame_set(keyframe_set.value());
+ if (auto* rule_cache = rule_cache_for_cascade_origin(CascadeOrigin::Author, {}, {})) {
+ if (auto keyframe_set = rule_cache->rules_by_animation_keyframes.get(animation->id()); keyframe_set.has_value())
+ effect->set_key_frame_set(keyframe_set.value());
+ }
effect->set_target(&element);
element.set_cached_animation_name_animation(animation, pseudo_element);
@@ -2579,13 +2600,8 @@ void StyleComputer::collect_selector_insights(Selector const& selector, Selector
}
}
-StyleComputer::BuiltRuleCaches StyleComputer::make_rule_cache_for_cascade_origin(CascadeOrigin cascade_origin, SelectorInsights& insights, Vector<MatchingRule>& hover_rules)
+void StyleComputer::make_rule_cache_for_cascade_origin(CascadeOrigin cascade_origin, SelectorInsights& insights, Vector<MatchingRule>& hover_rules)
{
- auto caches = BuiltRuleCaches {
- .main_rules = make<RuleCache>(),
- .layer_rules = {},
- };
-
size_t num_class_rules = 0;
size_t num_id_rules = 0;
size_t num_tag_name_rules = 0;
@@ -2597,6 +2613,26 @@ StyleComputer::BuiltRuleCaches StyleComputer::make_rule_cache_for_cascade_origin
Vector<MatchingRule> matching_rules;
size_t style_sheet_index = 0;
for_each_stylesheet(cascade_origin, [&](auto& sheet, GC::Ptr<DOM::ShadowRoot> shadow_root) {
+ auto& rule_caches = [&] -> RuleCaches& {
+ RuleCachesForDocumentAndShadowRoots* rule_caches_for_document_or_shadow_root = nullptr;
+ switch (cascade_origin) {
+ case CascadeOrigin::Author:
+ rule_caches_for_document_or_shadow_root = m_author_rule_cache;
+ break;
+ case CascadeOrigin::User:
+ rule_caches_for_document_or_shadow_root = m_user_rule_cache;
+ break;
+ case CascadeOrigin::UserAgent:
+ rule_caches_for_document_or_shadow_root = m_user_agent_rule_cache;
+ break;
+ default:
+ VERIFY_NOT_REACHED();
+ }
+ if (!shadow_root)
+ return rule_caches_for_document_or_shadow_root->for_document;
+ return *rule_caches_for_document_or_shadow_root->for_shadow_roots.ensure(*shadow_root, [] { return make<RuleCaches>(); });
+ }();
+
size_t rule_index = 0;
sheet.for_each_effective_style_producing_rule([&](auto const& rule) {
SelectorList const& absolutized_selectors = [&]() {
@@ -2628,7 +2664,7 @@ StyleComputer::BuiltRuleCaches StyleComputer::make_rule_cache_for_cascade_origin
};
auto const& qualified_layer_name = matching_rule.qualified_layer_name();
- auto& rule_cache = qualified_layer_name.is_empty() ? caches.main_rules : caches.layer_rules.ensure(qualified_layer_name, [] { return make<RuleCache>(); });
+ auto& rule_cache = qualified_layer_name.is_empty() ? rule_caches.main : *rule_caches.by_layer.ensure(qualified_layer_name, [] { return make<RuleCache>(); });
bool contains_root_pseudo_class = false;
Optional<CSS::Selector::PseudoElement::Type> pseudo_element;
@@ -2682,19 +2718,19 @@ StyleComputer::BuiltRuleCaches StyleComputer::make_rule_cache_for_cascade_origin
bool added_to_bucket = false;
auto add_to_id_bucket = [&](FlyString const& name) {
- rule_cache->rules_by_id.ensure(name).append(move(matching_rule));
+ rule_cache.rules_by_id.ensure(name).append(move(matching_rule));
++num_id_rules;
added_to_bucket = true;
};
auto add_to_class_bucket = [&](FlyString const& name) {
- rule_cache->rules_by_class.ensure(name).append(move(matching_rule));
+ rule_cache.rules_by_class.ensure(name).append(move(matching_rule));
++num_class_rules;
added_to_bucket = true;
};
auto add_to_tag_name_bucket = [&](FlyString const& name) {
- rule_cache->rules_by_tag_name.ensure(name).append(move(matching_rule));
+ rule_cache.rules_by_tag_name.ensure(name).append(move(matching_rule));
++num_tag_name_rules;
added_to_bucket = true;
};
@@ -2731,23 +2767,23 @@ StyleComputer::BuiltRuleCaches StyleComputer::make_rule_cache_for_cascade_origin
if (!added_to_bucket) {
if (matching_rule.contains_pseudo_element) {
if (CSS::Selector::PseudoElement::is_known_pseudo_element_type(pseudo_element.value())) {
- rule_cache->rules_by_pseudo_element[to_underlying(pseudo_element.value())].append(move(matching_rule));
+ rule_cache.rules_by_pseudo_element[to_underlying(pseudo_element.value())].append(move(matching_rule));
} else {
// NOTE: We don't cache rules for unknown pseudo-elements. They can't match anything anyway.
}
} else if (contains_root_pseudo_class) {
- rule_cache->root_rules.append(move(matching_rule));
+ rule_cache.root_rules.append(move(matching_rule));
} else {
for (auto const& simple_selector : selector.compound_selectors().last().simple_selectors) {
if (simple_selector.type == CSS::Selector::SimpleSelector::Type::Attribute) {
- rule_cache->rules_by_attribute_name.ensure(simple_selector.attribute().qualified_name.name.lowercase_name).append(move(matching_rule));
+ rule_cache.rules_by_attribute_name.ensure(simple_selector.attribute().qualified_name.name.lowercase_name).append(move(matching_rule));
++num_attribute_rules;
added_to_bucket = true;
break;
}
}
if (!added_to_bucket) {
- rule_cache->other_rules.append(move(matching_rule));
+ rule_cache.other_rules.append(move(matching_rule));
}
}
}
@@ -2786,12 +2822,10 @@ StyleComputer::BuiltRuleCaches StyleComputer::make_rule_cache_for_cascade_origin
dbgln(" - keyframe {}: {} properties", it.key(), it->properties.size());
}
- caches.main_rules->rules_by_animation_keyframes.set(rule.name(), move(keyframe_set));
+ rule_caches.main.rules_by_animation_keyframes.set(rule.name(), move(keyframe_set));
});
++style_sheet_index;
});
-
- return caches;
}
struct LayerNode {
@@ -2866,6 +2900,10 @@ void StyleComputer::build_qualified_layer_names_cache()
void StyleComputer::build_rule_cache()
{
+ m_author_rule_cache = make<RuleCachesForDocumentAndShadowRoots>();
+ m_user_rule_cache = make<RuleCachesForDocumentAndShadowRoots>();
+ m_user_agent_rule_cache = make<RuleCachesForDocumentAndShadowRoots>();
+
m_selector_insights = make<SelectorInsights>();
m_style_invalidation_data = make<StyleInvalidationData>();
@@ -2875,11 +2913,9 @@ void StyleComputer::build_rule_cache()
build_qualified_layer_names_cache();
- auto author_rules = make_rule_cache_for_cascade_origin(CascadeOrigin::Author, *m_selector_insights, m_hover_rules);
- m_author_rule_cache = move(author_rules.main_rules);
- m_layer_rule_caches = move(author_rules.layer_rules);
- m_user_rule_cache = make_rule_cache_for_cascade_origin(CascadeOrigin::User, *m_selector_insights, m_hover_rules).main_rules;
- m_user_agent_rule_cache = make_rule_cache_for_cascade_origin(CascadeOrigin::UserAgent, *m_selector_insights, m_hover_rules).main_rules;
+ make_rule_cache_for_cascade_origin(CascadeOrigin::Author, *m_selector_insights, m_hover_rules);
+ make_rule_cache_for_cascade_origin(CascadeOrigin::User, *m_selector_insights, m_hover_rules);
+ make_rule_cache_for_cascade_origin(CascadeOrigin::UserAgent, *m_selector_insights, m_hover_rules);
}
void StyleComputer::invalidate_rule_cache()
diff --git a/Libraries/LibWeb/CSS/StyleComputer.h b/Libraries/LibWeb/CSS/StyleComputer.h
index c83a63a689ac..78f16c71cd1c 100644
--- a/Libraries/LibWeb/CSS/StyleComputer.h
+++ b/Libraries/LibWeb/CSS/StyleComputer.h
@@ -273,23 +273,28 @@ class StyleComputer {
HashMap<FlyString, NonnullRefPtr<Animations::KeyframeEffect::KeyFrameSet>> rules_by_animation_keyframes;
};
- struct BuiltRuleCaches {
- NonnullOwnPtr<RuleCache> main_rules;
- HashMap<FlyString, NonnullOwnPtr<RuleCache>> layer_rules;
+ struct RuleCaches {
+ RuleCache main;
+ HashMap<FlyString, NonnullOwnPtr<RuleCache>> by_layer;
};
- [[nodiscard]] BuiltRuleCaches make_rule_cache_for_cascade_origin(CascadeOrigin, SelectorInsights&, Vector<MatchingRule>& hover_rules);
- [[nodiscard]] RuleCache const* rule_cache_for_cascade_origin(CascadeOrigin, FlyString const& qualified_layer_name) const;
+ struct RuleCachesForDocumentAndShadowRoots {
+ RuleCaches for_document;
+ HashMap<GC::Ref<DOM::ShadowRoot const>, NonnullOwnPtr<RuleCaches>> for_shadow_roots;
+ };
+
+ void make_rule_cache_for_cascade_origin(CascadeOrigin, SelectorInsights&, Vector<MatchingRule>& hover_rules);
+
+ [[nodiscard]] RuleCache const* rule_cache_for_cascade_origin(CascadeOrigin, FlyString const& qualified_layer_name, GC::Ptr<DOM::ShadowRoot const>) const;
static void collect_selector_insights(Selector const&, SelectorInsights&);
OwnPtr<SelectorInsights> m_selector_insights;
Vector<MatchingRule> m_hover_rules;
OwnPtr<StyleInvalidationData> m_style_invalidation_data;
- OwnPtr<RuleCache> m_author_rule_cache;
- HashMap<FlyString, NonnullOwnPtr<RuleCache>> m_layer_rule_caches;
- OwnPtr<RuleCache> m_user_rule_cache;
- OwnPtr<RuleCache> m_user_agent_rule_cache;
+ OwnPtr<RuleCachesForDocumentAndShadowRoots> m_author_rule_cache;
+ OwnPtr<RuleCachesForDocumentAndShadowRoots> m_user_rule_cache;
+ OwnPtr<RuleCachesForDocumentAndShadowRoots> m_user_agent_rule_cache;
GC::Root<CSSStyleSheet> m_user_style_sheet;
using FontLoaderList = Vector<NonnullOwnPtr<FontLoader>>;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.