mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-25 04:22:50 +00:00
LibWeb+Meta: Add wrapper for the BufferSource/ArrayBufferView IDL types
These wrappers will make it much easier to do various operations on the different ArrayBuffer-related classes in LibWeb compared to the current solution, which is to just accept a Handle<Object> everywhere (and use "any" in the *.idl files). Co-Authored-By: Matthew Olsson <mattco@serenityos.org>
This commit is contained in:
parent
54d0aafff0
commit
04c094343f
Notes:
sideshowbarker
2024-07-17 04:34:25 +09:00
Author: https://github.com/shannonbooth
Commit: 04c094343f
Pull-request: https://github.com/SerenityOS/serenity/pull/22027
27 changed files with 286 additions and 71 deletions
|
@ -50,10 +50,9 @@ JS::NonnullGCPtr<JS::Uint8Array> TextEncoder::encode(String const& input) const
|
|||
}
|
||||
|
||||
// https://encoding.spec.whatwg.org/#dom-textencoder-encodeinto
|
||||
TextEncoderEncodeIntoResult TextEncoder::encode_into(String const& source, JS::Handle<JS::Object> const& destination) const
|
||||
TextEncoderEncodeIntoResult TextEncoder::encode_into(String const& source, JS::Handle<WebIDL::BufferSource> const& destination) const
|
||||
{
|
||||
auto& destination_array = static_cast<JS::Uint8Array&>(*destination);
|
||||
auto data = destination_array.data();
|
||||
auto& data = destination->viewed_array_buffer()->buffer();
|
||||
|
||||
// 1. Let read be 0.
|
||||
unsigned long long read = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue