Commit graph

65759 commits

Author SHA1 Message Date
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
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
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
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 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
Andreas Kling
0ed5278772 Tests: Rebaseline a recently-added editing test 2024-12-03 00:19:15 +01:00
Shannon Booth
6ac018bcb6 LibWeb: Fix crash accessing 'empty' PromiseRejectionEvent reason
The 'reason' was getting initialized to 'empty' state when not
provided through the constructor, which results in a crash when
accessed through throw_dom_exception_if_needed in the generated
IDL getter.
2024-12-03 00:18:11 +01:00
Shannon Booth
05b4676917 LibWeb: Ensure global objects are an event target
All global objects current need to be event targets so that they
can have events dispatched to them. This allows for removing of
verify_cast for these global objects.
2024-12-03 00:18:11 +01:00
Jelle Raaijmakers
6a85677f70 LibWeb: Expose HTMLElement's content editable state 2024-12-03 00:18:03 +01:00
Jelle Raaijmakers
c9a6bac57f LibWeb: Fix always-enabled copy command in queryCommandEnabled()
The "copy" command is not in the Miscellaneous commands section. The
"defaultParagraphSeparator" command is, however. Let the accompanying
comment reflect that.
2024-12-03 00:18:03 +01:00
Jelle Raaijmakers
3f1523b16c LibWeb: Disable execCommand() commands in plaintext-only editing state 2024-12-03 00:18:03 +01:00
Jelle Raaijmakers
217567981a LibWeb: Implement "plaintext-only" state for contenteditable 2024-12-03 00:18:03 +01:00
Jelle Raaijmakers
7e406ac668 LibWeb: Simplify editing algorithm for "ends in space" condition
Checking if a string ends in a space does not require converting UTF-8
to UTF-16 and reading out its code points.
2024-12-03 00:18:03 +01:00
Milo van der Tier
2ee7e555f2 LibWeb/CSS: Do not ignore self-start/self-end alignment in flex layout
This makes these values the same as `start` and `end`. While this is not
entirely correct, it is better than centering which is what we did
previously.

This fixes misaligned images on https://nos.nl
2024-12-03 00:17:53 +01:00
Sam Atkins
432bbb4a56 CI: Keep test artifacts around longer
From this action's documentation, "0 means using default retention."
There's no reason for this to have a different retention duration than
the CI results themselves.
2024-12-02 18:04:43 -05:00
Sam Atkins
4fd42313ae CI: Ensure uploaded test artifacts have a unique name
Without this, if two CI runs on Linux both fail and want to upload
screenshots, we get an error like this on the second:

> Error: Failed to CreateArtifact: Received non-retryable error: Failed
> request: (409) Conflict: an artifact with this name already exists on
> the workflow run

Using all the inputs as part of the name should make this kind of
conflict impossible.
2024-12-02 18:04:43 -05:00