mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-03 14:50:18 +00:00
LibWeb: Redefine WebIDL types in terms of Infra spec
Corresponds to https://github.com/whatwg/webidl/pull/1452
This commit is contained in:
parent
87c8ae31d3
commit
0168ee22ad
Notes:
github-actions[bot]
2024-12-05 16:35:04 +00:00
Author: https://github.com/AtkinsSJ
Commit: 0168ee22ad
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2566
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/shannonbooth
2 changed files with 75 additions and 17 deletions
54
Libraries/LibWeb/Infra/Types.h
Normal file
54
Libraries/LibWeb/Infra/Types.h
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024, Sam Atkins <sam@ladybird.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/Types.h>
|
||||||
|
#include <AK/UFixedBigInt.h>
|
||||||
|
|
||||||
|
namespace Web::Infra {
|
||||||
|
|
||||||
|
// https://infra.spec.whatwg.org/#booleans
|
||||||
|
// A boolean is either true or false.
|
||||||
|
using Boolean = bool;
|
||||||
|
|
||||||
|
// https://infra.spec.whatwg.org/#8-bit-unsigned-integer
|
||||||
|
// An 8-bit unsigned integer is an integer in the range 0 to 255 (0 to 2^8 − 1), inclusive.
|
||||||
|
using Unsigned8BitInteger = u8;
|
||||||
|
|
||||||
|
// https://infra.spec.whatwg.org/#16-bit-unsigned-integer
|
||||||
|
// A 16-bit unsigned integer is an integer in the range 0 to 65535 (0 to 2^16 − 1), inclusive.
|
||||||
|
using Unsigned16BitInteger = u16;
|
||||||
|
|
||||||
|
// https://infra.spec.whatwg.org/#32-bit-unsigned-integer
|
||||||
|
// A 32-bit unsigned integer is an integer in the range 0 to 4294967295 (0 to 2^32 − 1), inclusive.
|
||||||
|
using Unsigned32BitInteger = u32;
|
||||||
|
|
||||||
|
// https://infra.spec.whatwg.org/#64-bit-unsigned-integer
|
||||||
|
// A 64-bit unsigned integer is an integer in the range 0 to 18446744073709551615 (0 to 2^64 − 1), inclusive.
|
||||||
|
using Unsigned64BitInteger = u64;
|
||||||
|
|
||||||
|
// https://infra.spec.whatwg.org/#128-bit-unsigned-integer
|
||||||
|
// A 128-bit unsigned integer is an integer in the range 0 to 340282366920938463463374607431768211455 (0 to 2^128 − 1), inclusive.
|
||||||
|
using Unsigned128BitInteger = u128;
|
||||||
|
|
||||||
|
// https://infra.spec.whatwg.org/#8-bit-signed-integer
|
||||||
|
// An 8-bit signed integer is an integer in the range −128 to 127 (−2^7 to 2^7 − 1), inclusive.
|
||||||
|
using Signed8BitInteger = i8;
|
||||||
|
|
||||||
|
// https://infra.spec.whatwg.org/#16-bit-signed-integer
|
||||||
|
// A 16-bit signed integer is an integer in the range −32768 to 32767 (−2^15 to 2^15 − 1), inclusive.
|
||||||
|
using Signed16BitInteger = i16;
|
||||||
|
|
||||||
|
// https://infra.spec.whatwg.org/#32-bit-signed-integer
|
||||||
|
// A 32-bit signed integer is an integer in the range −2147483648 to 2147483647 (−2^31 to 2^31 − 1), inclusive.
|
||||||
|
using Signed32BitInteger = i32;
|
||||||
|
|
||||||
|
// https://infra.spec.whatwg.org/#64-bit-signed-integer
|
||||||
|
// A 64-bit signed integer is an integer in the range −9223372036854775808 to 9223372036854775807 (−2^63 to 2^63 − 1), inclusive.
|
||||||
|
using Signed64BitInteger = i64;
|
||||||
|
|
||||||
|
}
|
|
@ -6,41 +6,45 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Types.h>
|
#include <LibWeb/Infra/Types.h>
|
||||||
|
|
||||||
namespace Web::WebIDL {
|
namespace Web::WebIDL {
|
||||||
|
|
||||||
|
// https://webidl.spec.whatwg.org/#idl-boolean
|
||||||
|
// The boolean type corresponds to booleans.
|
||||||
|
using Boolean = Infra::Boolean;
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#idl-byte
|
// https://webidl.spec.whatwg.org/#idl-byte
|
||||||
// The byte type is a signed integer type that has values in the range [−128, 127].
|
// The byte type corresponds to 8-bit signed integers.
|
||||||
using Byte = i8;
|
using Byte = Infra::Signed8BitInteger;
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#idl-octet
|
// https://webidl.spec.whatwg.org/#idl-octet
|
||||||
// The octet type is an unsigned integer type that has values in the range [0, 255].
|
// The octet type corresponds to 8-bit unsigned integers.
|
||||||
using Octet = u8;
|
using Octet = Infra::Unsigned8BitInteger;
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#idl-short
|
// https://webidl.spec.whatwg.org/#idl-short
|
||||||
// The short type is a signed integer type that has values in the range [−32768, 32767].
|
// The short type corresponds to 16-bit signed integers.
|
||||||
using Short = i16;
|
using Short = Infra::Signed16BitInteger;
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#idl-unsigned-short
|
// https://webidl.spec.whatwg.org/#idl-unsigned-short
|
||||||
// The unsigned short type is an unsigned integer type that has values in the range [0, 65535].
|
// The unsigned short type corresponds to 16-bit unsigned integers.
|
||||||
using UnsignedShort = u16;
|
using UnsignedShort = Infra::Unsigned16BitInteger;
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#idl-long
|
// https://webidl.spec.whatwg.org/#idl-long
|
||||||
// The long type is a signed integer type that has values in the range [−2147483648, 2147483647].
|
// The long type corresponds to 32-bit signed integers.
|
||||||
using Long = i32;
|
using Long = Infra::Signed32BitInteger;
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#idl-unsigned-long
|
// https://webidl.spec.whatwg.org/#idl-unsigned-long
|
||||||
// The unsigned long type is an unsigned integer type that has values in the range [0, 4294967295].
|
// The unsigned long type corresponds to 32-bit unsigned integers.
|
||||||
using UnsignedLong = u32;
|
using UnsignedLong = Infra::Unsigned32BitInteger;
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#idl-long-long
|
// https://webidl.spec.whatwg.org/#idl-long-long
|
||||||
// The long long type is a signed integer type that has values in the range [−9223372036854775808, 9223372036854775807].
|
// The long long type corresponds to 64-bit signed integers.
|
||||||
using LongLong = i64;
|
using LongLong = Infra::Signed64BitInteger;
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#idl-unsigned-long-long
|
// https://webidl.spec.whatwg.org/#idl-unsigned-long-long
|
||||||
// The unsigned long long type is an unsigned integer type that has values in the range [0, 18446744073709551615].
|
// The unsigned long long type corresponds to 64-bit unsigned integers.
|
||||||
using UnsignedLongLong = u64;
|
using UnsignedLongLong = Infra::Unsigned64BitInteger;
|
||||||
|
|
||||||
// https://webidl.spec.whatwg.org/#idl-double
|
// https://webidl.spec.whatwg.org/#idl-double
|
||||||
// The double type is a floating point numeric type that corresponds to the set of finite
|
// The double type is a floating point numeric type that corresponds to the set of finite
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue