Commit graph

6502 commits

Author SHA1 Message Date
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
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
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
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
Gingeh
0afd7f166a LibWeb: Improve grid-template-area parsing and serialization 2024-12-02 16:19:47 +00:00
Gingeh
e1f4e8e6c2 LibWeb: Move CSS character type definitions to new header 2024-12-02 16:19:47 +00:00
Jonne Ransijn
1b3f8e1e9a LibJS: Cache source code positions more often
The source code position cache was moved from a line based approach
to a "chunk"-based approach to improve performance on large, minified
JavaScript files with few lines, but this has had an adverse effect
on _multi-line_ source files.

Reintroduce some of the old behaviour by caching lines again, with
some added sanity limits to avoid caching empty/overly small lines.

Source code positions in files with few lines will still be cached
less often, since minified JavaScript files can be assumed to be
unusually large, and since stack traces for minified JavaScript
are less useful as well.

On WPT tests with large JavaScript dependencies like
`css/css-masking/animations/clip-interpolation.html` this reduces the
amount of time spent in `SourceCode::range_from_offsets` by as much as
99.98%, for the small small price of 80KB extra memory usage.
2024-12-02 11:42:11 +01:00
Tim Ledbetter
44cf457fd2 LibWeb: Limit HTMLTableColElement span to allowed values
This change ensures that `span` is clamped to the maximum value of 1000
if the given value is larger than 2147483647.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
9fc2a63131 LibWeb: Limit HTMLTableCellElement rowSpan to allowed values
This change ensures that `rowSpan` is clamped to the maximum value of
65534 if the given value is larger than 2147483647.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
4630b1a44b LibWeb: Limit HTMLTableCellElement colSpan to allowed values
This change ensures that `colSpan` is clamped to the maximum value of
1000 if the given value is larger than 2147483647.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
d02b763cd6 LibWeb: Add parse_integer_digits methods
The rules for parsing integers don't specify an upper bound on the
value that can be returned, so the `parse_integer_digits` method can be
used to check whether the given arbitrarily-large StringView is valid
according to these rules. The `parse_integer` and
`parse_non_negative_integer` methods would fail for values larger than
2147483647 when they shouldn't have.
2024-12-02 10:25:27 +01:00
Tim Ledbetter
7097152ebc LibWeb: Restrict HTMLTextAreaElement::min_length to the range of i32 2024-12-02 10:25:27 +01:00
Tim Ledbetter
ac7fad52f6 LibWeb: Restrict HTMLTextAreaElement::max_length to the range of i32 2024-12-02 10:25:27 +01:00
Tim Ledbetter
bc484258c2 LibWeb: Restrict HTMLInputElement::min_length to the range of i32 2024-12-02 10:25:27 +01:00
Tim Ledbetter
40d6b9d44e LibWeb: Restrict HTMLInputElement::max_length to the range of i32 2024-12-02 10:25:27 +01:00
stasoid
163ec18593 LibCore: Fix link error in EventLoopImplementationWindows.cpp 2024-12-02 10:12:57 +01:00
Konstantin Konstantin
1915574165 LibWeb: Fix NavigationType enum to string conversion
Convert NavigationType to lowercase strings, as described in the spec.

Import related WPT test.
2024-12-02 06:47:49 +00:00
Pavel Shliak
4d5acc7a00 LibWeb: Remove IDBRequest.idl FIXME 2024-12-01 22:04:05 +01:00
Aliaksandr Kalenik
86f1c03c06 LibWeb: Fix CSS filters painting
restore() corresponding to ApplyFilters should be called after stacking
context content is painted, not before.

Fixes regression introduced in c94b4316e7
2024-12-01 21:27:29 +01:00
Aliaksandr Kalenik
a7bd3704c5 LibWeb: Use separate restore() for each ApplyOpacity display list item
ApplyOpacity internally calls canvas.saveLayer() which requires a
matching canvas.restore() to be called.

Fixes missing header on https://supabase.com/
2024-12-01 16:33:16 +01:00
Tim Ledbetter
a486c86eee LibWeb: Limit HTMLCanvasElement width and height to allowed values
Setting the `width` or `height` properties of `HTMLCanvasElement` to a
value greater than 2147483647 will now cause the property to be set to
its default value.
2024-12-01 15:12:04 +00:00
Tim Ledbetter
b05bc71002 LibWeb: Limit HTMLImageElement width and height to allowed values
Setting the `width` or `height` properties of `HTMLImageElement` to a
value greater than 2147483647 will now cause the property to be set to
0.
2024-12-01 15:12:04 +00:00
Aliaksandr Kalenik
c94b4316e7 LibWeb: Use separate restore() for each ApplyFilters display list item
ApplyFilter internally calls canvas.saveLayer() which requires a
matching canvas.restore() to be called.

Fixes painting on https://supabase.com/ regressed by
8562b0e33b
2024-12-01 15:49:32 +01:00
Shannon Booth
30c8510725 LibWeb: Ensure requests modules is not empty before indexing into it
Regression from 5af613aa65

Fixes: #2676
2024-12-01 15:49:16 +01:00
Shannon Booth
2ff03ea7d2 LibWeb: Remove module validation in "create a JavaScript module script"
This is uneeded and not present for this function in the spec now that
HostLoadImportedModule performs this validation.
2024-12-01 11:56:18 +01:00
Shannon Booth
bb68f09855 LibWeb: Remove irrelevant FIXMEs about implementing some module hooks
Both of these module-related host hooks are not present in the latest
version of the HTML spec.
2024-12-01 11:56:18 +01:00
Shannon Booth
5af613aa65 LibWeb: Implement early validation of modules
This is part of a normative change to the HTML space for WebAssembly JS
module integration and the source phase import proposal, see:

https://github.com/whatwg/html/commit/10ed38ee7

Further changes are required, but this is a start :^)
2024-12-01 11:56:18 +01:00
Shannon Booth
1a15e2cec6 LibJS: Allow comparing module records by equality 2024-12-01 11:56:18 +01:00
Shannon Booth
431faa1044 LibWeb: Throw an error on DynamicImport for Worklets or ServiceWorkers
We can't actually create either of these yet, but let's just get this
check out of the way while it is convenient.
2024-12-01 11:56:18 +01:00