Commit graph

65770 commits

Author SHA1 Message Date
Timothy Flynn
3c64e4595a LibJS: Use exact mathematical values for Intl.DurationFormat
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
We can't use doubles due to precision loss for extremely large values.
2024-12-04 08:01:35 -05:00
Timothy Flynn
912e38c5fb LibCrypto: Add a BigFraction::is_zero helper 2024-12-04 08:01:35 -05:00
Timothy Flynn
e6c96ce57e LibCrypto: Convert BigFraction stringification to String 2024-12-04 08:01:35 -05:00
Timothy Flynn
5cfd50224c LibJS: Use enums instead of strings in Intl.DurationFormat AOs 2024-12-04 08:01:35 -05:00
Timothy Flynn
37fc9b6511 LibJS: Apply editorial updates to Intl.DurationFormat
To help prepare for its stage 4 promotion, this applies the editorial
updates made to Intl.DurationFormat over the last few months.
2024-12-04 08:01:35 -05:00
Milo van der Tier
1882a2e19b LibWeb/CSS: Pass Length::ResolutionContext to resolve_integer
The length resolution context might be needed even when resolving an
integer value, since it might contain a sign() function with length
values inside. This fixes a WPT subtest.
2024-12-04 12:26:50 +00:00
Milo van der Tier
8bec80ac47 LibWeb/CSS: Allow calc() values in media queries
It was initially thought that the spec disallows them, but this turned
out to be incorrect. This fixes several WPT tests.
2024-12-04 12:26:50 +00:00
Lucas CHOLLET
ad3dd547b7 LibWeb/CSS: Shorten the length of srgb serialization
The WPT tests require the shortest possible serialization that support
an 8 bits roundtrip.

As an example, `128` is serialized to `0.5` while `127` needs more
precision and thus will be serialized to `0.498`.

This commit fixes 33 WPT subtests in css/css-color.
2024-12-04 11:30:44 +00:00
Lucas CHOLLET
ded6695c52 LibWeb/CSS: Remove unused serialization helpers 2024-12-04 11:30:44 +00:00
Christoffer Sandberg
879af72850 LibWeb: Improve painting of nested inline elements
PaintableWithLines created from inline nodes need to examine their
children to fully compute their size and offset as nested children
might have textnodes that are placed before their parent.

Fixes #1286
2024-12-04 11:23:54 +00:00
Andrew Kaster
e20a887a8d Toolchain: Actually disable vcpkg metrics
In the move to a python version of this script, I didn't notice that
running the bootstrap script in shell mode precluded it from actually
accepting the -disableMetrics argument.

Existing vcpkg installs can be un-metrics'd by re-running the bootstrap
script with the disable argument, or by adding a vcpkg.disable-metrics
file in $VCPKG_ROOT
2024-12-04 11:15:32 +01:00
Pavel Shliak
2d0fdf804e Documentation: Minor rewordings in Porting.md 2024-12-04 10:26:24 +01:00
Jonne Ransijn
acaf01bf7b LibWeb: Do not normalize border radii containing their initial values
Most computed border-radii contain their initial values, and since the
normalized initial border radii are always zero, there is no need to do
expensive floating point math to normalize them.
2024-12-04 08:30:22 +00:00
Jelle Raaijmakers
9b446df7f5 LibWeb: Replace local name checks with simpler is<T> in editing API 2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
e308a3fd3f LibWeb: Be more defensive while traversing ancestors in editing API
In all these cases there should be an ancestor available, but it
definitely cannot hurt to be a bit more defensive about this and prevent
nullptr dereferences.
2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
b6939c8035 LibWeb: Use wrap algorithm in "fix disallowed ancestors"
We have the wrap algorithm implemented now, so resolve the FIXME.
2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
4f76cec096 LibWeb: Implement document.execCommand("insertParagraph") 2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
2e29d3fb57 LibWeb: Fix is_allowed_child_of_node() for non-element parent node
When passing a DOM::Node that is not a DOM::Element, this method would
always try to cast to a DOM::Element.
2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
a62b664d0d LibWeb: Put editing command "styleWithCSS" in alphabetical order 2024-12-04 06:51:59 +01:00
Jelle Raaijmakers
98df4c2b3c LibWeb: Make Editing::fix_disallowed_ancestors_of_node() take a GC::Ref 2024-12-04 06:51:59 +01:00
Jonne Ransijn
211dc5659c LibWeb: Fix stack-use-after-scope
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Build Dev Container Image / build (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
The refactor in the previous commit was storing a reference to a stack
allocated `Infrastructure::Request::BodyType` which was then immediately
freed. To fix this, we can store the `Infrastructure::Request::BodyType`
in a variable beforehand, so it becomes safe to reference.
2024-12-04 01:58:22 +01:00
Jonne Ransijn
d7596a0a61 AK: Don't implicitly convert Optional<T&> to Optional<T>
C++ will jovially select the implicit conversion operator, even if it's
complete bogus, such as for unknown-size types or non-destructible
types. Therefore, all such conversions (which incur a copy) must
(unfortunately) be explicit so that non-copyable types continue to work.

NOTE: We make an exception for trivially copyable types, since they
are, well, trivially copyable.

Co-authored-by: kleines Filmröllchen <filmroellchen@serenityos.org>
2024-12-04 01:58:22 +01:00
kleines Filmröllchen
8468fb9ae5 AK: Use StringView as its own peek type
StringView is already a reference type, and copying it is cheap, so we
should use it as its own peek type.
2024-12-04 01:58:22 +01:00
Jonne Ransijn
d7a721951e LibWasm: Fix UB in LibWasm
Now that `Optional<T&>` are trivially copyable/movable, it is
triggering Undefined Behaviour checks on GCC. We can resolve those
by using an union.
2024-12-04 01:58:22 +01:00
Jonne Ransijn
55383998b1 AK: Use Noncopyable.h in Optional<T&>
This makes them trivially copyable/movable, silencing

> "parameter is copied for each invocation"

warnings on `Optional<T&>`, which are unnecessairy,
since `Optional<T&>` is just a trivially copyable pointer.

This creates a slight change in behaviour when moving out of an
`Optional<T&>`, since the moved-from optional no longer gets cleared.

Moved-from values should be considered to be in an undefined state,
and if clearing a moved-from `Optional<T&>` is desired, you should be
using `Optional<T&>::release_value()` instead.
2024-12-04 01:58:22 +01:00
Aliaksandr Kalenik
7e78d7d332 LibWeb/WebGL+Meta: Stub getSupportedExtensions() and getExtension() 2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
64fec8b2de LibWeb/WebGL: Implement texImage2D() 2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
3c2ac309ca LibWeb/WebGL: Implement getActiveAttrib() and getActiveUniform() 2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
f3a24d1569 LibWeb: Implement more WebGL calls 2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
cfb394cad3 LibWeb: Save OpenGL handle in WebGLObject 2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
46cbbda944 LibWeb: Increase SkSurface's generation id when it's modified by WebGL
Skia is not aware of surface modifications done by WebGL, so we need to
manually increase generation id whenver WebGL invokes a writing
function.
2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
e2e54dccc3 LibWeb: Generate WebGLRenderingContext implementation 2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
45e0f50463 LibWeb: Flip vertically PaintingSurface attached to WebGL context
OpenGL's origin is at the bottom-left corner, while Skia's origin is at
the top-left corner. This change adds a transformation to compensate for
this difference when rendering PaintingSurface attached to WebGL
context.
2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
38488b9ef3 LibWeb: Implement GLES2 context creation
For now only macOS is supported.

IOSurface is used as a backing store because it will allow us to read
it from Skia and write to it from OpenGL without any extra copying:
- ANGLE_metal_texture_client_buffer extension is used to create
  EGLSurface from IOSurface.
- Then the same IOSurface is wrapped into Metal texture and passed to
  Skia allowing to share the same memory between Skia Metal backend and
  ANGLE.
2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
d133b0aded LibWeb: Delete OpenGL function wrappers in OpenGLContext
It's going to be replaced by code genration in upcoming changes.
2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
4bf9bf7972 LibWeb: Merge WebGLRenderingContextBase into WebGLRenderingContext
There is no need to have a separate class for WebGLRenderingContextBase
mixin.
2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
4f219f46ee LibWeb: Add ANGLE
ANGLE is going to be used for WebGL implementation in upcoming changes.
2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
f719b05ab9 LibWeb: Delegate painting surface allocation to canvas's active context
This change prepares for the addition of WebGL support, where painting
surface allocation process will differ from that of context2d.
2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
e683700fe6 LibWeb: Allow construction of PaintingSurface directly from IOSurface
Previously, constructing a PaintingSurface from an IOSurface required
wrapping IOSurface into a Metal texture before passing it to the
PaintingSurface constructor. This process was cumbersome, as the caller
needed access to a MetalContext to perform the wrapping.

With this change SkiaBackendContext maintains a reference to the
MetalContext which makes it possible to do:
IOSurface -> MetalTexture -> SkSurface within a PaintingSurface
constructor.
2024-12-03 23:35:45 +01:00
Aliaksandr Kalenik
bfdf52701f LibWeb: Treat min{max}-height as none if available is intrinsic [GFC]
Fixes infinite recursion in following cases:
- max-height: fit-content
- max-height: min-content
- max-height: max-content
2024-12-03 23:10:08 +01:00
Konstantin Konstantin
9dad8f55a4 LibWeb: Implement transfer for Resizable/ArrayBuffer
Implement transfer logic for ArrayBuffer and ResizableArrayBuffer.

Change TransferDataHolder data type to Vector<u32> to reuse existing
serialization infrastructure.

Fix 5 WPT tests in `window-postmessage.window.html` that relates to
transport.
Fix `LibWeb/Text/input/Worker/Worker-postMessage-transfer.html`.
The latter is currently ignored due to flakiness, no rebaseline is
needed.

During serialization with transfer, initialize memory with known index
and initialize Serializer at position that dependent on the memory.
This is mandatory to make ArrayBuffer transport to work. It also happens
to fix 4 WPT tests, that are related to curcular references during
serialization.
2024-12-03 21:32:01 +00:00
Tim Ledbetter
163b8a69e3 LibWeb: Assert that nodes share shadow-including root in BP calculation
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Previously, it was assumed that nodes must share the same root, prior
to the calculation of their relative boundary point positions. This is
no longer the case, since `Selection.setBaseAndExtent()` now accepts
anchor and focus nodes that may be in different shadow trees.
2024-12-03 15:31:41 +01:00
Andreas Kling
a7b3360fb6 LibWeb: Make HTMLIFrameElement.sandbox.supports() not throw
We have to list the set of allowed values for the DOMTokenList to not
throw when asking if one is supported.

This fixes an issue where YouTube embeds would hang indefinitely trying
to report an endless series of exceptions, seen on https://null.com/
2024-12-03 15:30:18 +01:00
Andreas Kling
b1796ebd2c Tests: Import a WPT test that uses HTMLIFrameElement.sandbox.supports() 2024-12-03 15:30:18 +01:00
devgianlu
dace140b0d LibCrypto+LibWeb: Implement ECDSA.sign
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Gained ~20 tests, failing only on P-521.
2024-12-03 13:20:51 +01:00
devgianlu
1d11448f00 LibCrypto+LibWeb: Refactor integer conversions in SECPxxxr1
Little effort to refactor the chaos of integers / bytes / ASN.1 that
is inside `SECPxxxr1`. More love is needed.
2024-12-03 13:20:51 +01:00
devgianlu
0c60f7c995 LibWeb: Migrate ECDSA.generateKey and ECDSA.verify away from ByteBuffer
Use instances of `ECPublicKey` and `ECPrivateKey` instead of
`ByteBuffer` for ECDSA. Fixes another ~200 tests.
2024-12-03 13:20:51 +01:00
devgianlu
f0fbd50c66 LibWeb: Implement ECDSA.importKey and ECDSA.exportKey
Very similar implementation to ECDH. Fixes ~700 tests!
2024-12-03 13:20:51 +01:00
Andreas Kling
940cdc7cf9 Tests: Rebaseline tests after changes to imported WPT harness
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-12-03 00:26:03 +01:00
Jonne Ransijn
edb3b10d11 LibJS: Align AsyncBlockStart with the latest drafts
`AsyncBlockStart` was still doing a `DisposeResources` call as
specified in older drafts of the `explicit-resource-management`
proposal, but the latest draft no longer does this, and it is
causing crashes when combined with the `array-from-async` proposal.
2024-12-02 18:20:56 -05:00