Commit Graph

33845 Commits

Author SHA1 Message Date
Matthew Olsson
2bd8093449 LibWeb: Detect explicit null timeline given in KeyframeAnimationOptions
We already do this for the timeline argument in the KeyframeEffect
constructor
2024-05-29 08:18:24 +02:00
Matthew Olsson
7bd62809a9 LibWeb: Include leading colons in KeyframeEffect::pseudo_element() 2024-05-29 08:18:24 +02:00
Matthew Olsson
854d02fe10 LibWeb: Reject more invalid pseudo-element selectors in KeyframeEffect
The old way this was written wouldn't actually check for the presence of
the two initial colons in the pseudo-element string.
2024-05-29 08:18:24 +02:00
Matthew Olsson
e188ab1493 LibWeb: Add missing spec links to KeyframeEffect 2024-05-29 08:18:24 +02:00
Tim Ledbetter
d0f88d4958 LibProtocol: Retry reading if read errors with EAGAIN
This fixes an issue where fetch requests to HTTP(s) addresses would
fail inside workers.
2024-05-29 08:17:18 +02:00
Tim Ledbetter
bb923983fc LibWeb: Implement WorkerGlobalScope.importScripts()
This method allows workers to synchronously import one or more scripts.
2024-05-29 08:17:18 +02:00
Tim Ledbetter
975a067f58 LibWeb: Align worker ESO getters with the specification
The `api_base_url()` and `policy_container()` getters now get their
respective objects from the global scope.
2024-05-29 08:17:18 +02:00
Tim Ledbetter
2d487ee5ab LibWeb: Add spec comments to WorkerEnvironmentSettingsObject::setup()
No behavior change.
2024-05-29 08:17:18 +02:00
MacDue
9c711bc868 LibWeb+Ladybird: Add option to enable the AffineCommandExecutorCPU
This adds a `--experimental-cpu-transforms` option to Ladybird and
WebContent (which defaults to false/off).

When enabled the AffineCommandExecutorCPU will be used to handle
painting transformed stacking contexts (i.e. stacking contexts where
the transform is something other than a simple translation). The regular
command executor will still handle the non-transformed cases.

This is hidden under a flag as the `AffineCommandExecutorCPU` is very
incomplete now. It missing support for clipping, text, and other basic
commands. Once most common commands have been implemented this flag
will be removed.
2024-05-29 08:17:01 +02:00
MacDue
b9db9013f5 LibWeb: Add (initial) AffineCommandExecutorCPU
This CommandExecutor is intended to provide better support for painting
stacking contexts where the transform is not a simple translation. It
is not intended to replace the CPU command executor (as its methods of
painting will likely be slower for the non-transformed case), instead,
it will function as a companion executor to handle transformations.

This is only intended to properly handle 2D transformations (skews,
rotations, scaling, etc). Full support for 3D transformations would
need further changes in LibGfx.

As it stands this is (very) incomplete and experimental, but hopefully,
this can be fleshed out to the point where it supports most common
painting commands.
2024-05-29 08:17:01 +02:00
MacDue
6333159108 LibWeb: Add support for nested painting command executors
This adds two new CommandResults: ContinueWithNestedExecutor and
ContinueWithParentExecutor.

ContinueWithNestedExecutor switches the command executor to the result
of calling `.nested_executor()` on the current CommandExecutor.

ContinueWithParentExecutor returns to the previous command executor
(i.e. what it was before the last ContinueWithNestedExecutor).
2024-05-29 08:17:01 +02:00
MacDue
a5442ad70d LibGfx: Add shortcut to draw_scaled_bitmap_with_transform() for scales
Using `draw_scaled_bitmap()` for simple scales is almost always better
than using `draw_scaled_bitmap_with_transform()` which does not respect
the scaling mode.
2024-05-29 08:17:01 +02:00
MacDue
f7bf14605c LibWeb: Remove PaintBorders recording painter command
`Painting::paint_all_borders()` only uses `.draw_line()` for simple
borders and `.fill_path()` for more complex cases. These are both
already supported by the `RecordingPainter` so removing this command
simplifies the painting API.

Two test changes:

css-background-clip-text: Borders are now drawn via the AA painter
(which makes them closer to how they appear in other browsers).

corner-clip-inside-scrollable: Borders removed (does not change test)
due to imperceptible sub-pixel changes.
2024-05-29 08:17:01 +02:00
Nico Weber
0ae36b9524 LibGfx/WebPWriter: Write correct alpha use hint in animation VP8L header
Since we now compute this for free, might as well fill it in.

As far as I can tell, no observable behavior difference anywhere.
2024-05-29 07:10:00 +01:00
Nico Weber
2d80a5c6ca LibGfx/WebPWriter: Let compress_VP8L_image*() return if image was opaque
We compute that as part of compression there anyways, so let's compute
it only once.

No behavior change.
2024-05-29 07:10:00 +01:00
Nico Weber
99d280a927 LibGfx/WebPLoader: Relax vp8x / vp8l alpha check
The check from 0805319d1e is too strict for animated images: It's
possible that an animation has alpha, but a frame doesn't.

(For example, if the animation is 10x10 pixels, but one frame updates
just 1x1 pixels. But even a full-sized frame could just not have alpha.)

If the VP8X header claims that the animation has alpha, we could check
that at least one frame has alpha, but for now we just don't do any
checking for animated images.
2024-05-29 07:10:00 +01:00
Nico Weber
c71b9fe6f8 LibGfx/WebPWriter: Add a comment explaining a file offset 2024-05-29 07:10:00 +01:00
Aliaksandr Kalenik
b8d18ebcf7 LibWeb+WebContent: Change event loop to synchronously paint next frame
...instead of scheduling repaint timer in PageClient.

This change fixes flickering on Discord that happened because:
- Event loop schedules repainting by activating repaint timer
- `Document::tear_down_layout_tree()` destroys paintable tree
- Repaint timer invokes callback and renders an empty frame because
  paintable tree was destroyed
2024-05-28 18:21:18 +02:00
Aliaksandr Kalenik
e806136116 LibWeb: Refresh clip and scroll state only when needed
Although refreshing is cheap, it was performed before each hit-testing
and was 2-4% in profiles on Discord and Twitter.

Now clip and scroll states are refreshed only if scroll offset has
changed.
2024-05-28 17:45:49 +02:00
Tim Ledbetter
d6297ec074 LibWeb: Cast to the correct type in Element::auto_directionality()
Previously, we always cast to a HTMLInputElement when getting the value
of an auto directionality form associated element. This caused
undefined behavior when determining the directionality of an element
that wasn't a HTMLInputElement.
2024-05-28 09:51:07 +02:00
Tim Ledbetter
0b0ad5c9db LibWeb: Calculate width property resolved value correctly
This means that relative width values are now correctly resolved when
calling `getComputedStyle()`.
2024-05-28 08:08:31 +02:00
Tim Ledbetter
7d192ed8c1 LibWeb: Don't crash on clicking a label with an associated text input
Previously, we assumed that all label control paintables were of type
`LabelablePaintable`. This caused a crash when clicking on a label with
a text input control.
2024-05-28 08:07:05 +02:00
Shannon Booth
6466fca20a LibWeb: Implement BaseAudioContext.createGain 2024-05-28 08:06:09 +02:00
Shannon Booth
1fa7235fec LibWeb: Add Implement GainNode interface
As with all other current audio nodes we still need to wire up the
inputs and outputs so it can be properly used in an audio context - but
this is enough to implement the public IDL interface.
2024-05-28 08:06:09 +02:00
Shannon Booth
97bf9e7953 LibWeb: Stub out Window-Management proposal extensions to Screen API
As defined in https://w3c.github.io/window-management
2024-05-27 17:24:51 -06:00
Simon Wanner
b79815c5a5 LibTextCodec: Add x-mac-cyrillic decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
07a9435da5 LibTextCodec: Add windows-1258 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
275b89720b LibTextCodec: Add windows-1257 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
c76308c7e6 LibTextCodec: Add windows-1256 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
eb9ed10573 LibTextCodec: Add windows-1253 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
2d35687db0 LibTextCodec: Add windows-874 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
1b6878b6ca LibTextCodec: Add KOI8-U decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
1fd3a6f48c LibTextCodec: Add ISO-8859-16 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
3e882f26db LibTextCodec: Sort checks in decoder_for mostly alphabetically
Keeps checks for common encodings (Latin1 & UTF-*) at the top.
2024-05-27 20:50:50 +02:00
Simon Wanner
56241df604 LibTextCodec: Add ISO-8859-14 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
4188e328ac LibTextCodec: Add ISO-8859-13 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
cc640f4363 LibTextCodec: Add ISO-8859-10 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
d73220837e LibTextCodec: Add ISO-8859-8(-I) decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
24028e353e LibTextCodec: Add ISO-8859-7 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
01c3b8091a LibTextCodec: Add ISO-8859-6 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
763d904ad5 LibTextCodec: Add ISO-8859-5 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
c6b17320db LibTextCodec: Add ISO-8859-4 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
6c84edaaa2 LibTextCodec: Add ISO-8859-3 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
fc783199f1 LibTextCodec: Add IBM866 decoder 2024-05-27 20:50:50 +02:00
Simon Wanner
96b3c35358 LibTextCodec: Implement table based decoders as SingleByteDecoder
Instead of copy-pasting the implementation, let's use a single class.
This "Single Byte Decoder" concept even exists in the Encoding Spec :^)
2024-05-27 20:50:50 +02:00
Simon Wanner
3029406c4b LibWeb: Handle TextDecoder's fatal flag 2024-05-27 20:50:50 +02:00
Diego
f8ac883fb4 LibWasm: Implement element section parsing 2024-05-27 19:38:45 +02:00
Idan Horowitz
95b9d77536 Kernel: Prevent reference to unaligned u32 in MBRPartitionTable init
This is technically UB, so triggers KUBSAN.
2024-05-27 17:35:42 +02:00
Jamie Mansfield
3095daa7c8 LibWeb: Implement HTMLImageElement.currentSrc
Removes some console noise from lner.co.uk :)
2024-05-27 17:34:59 +02:00
Jamie Mansfield
600daea544 LibWeb: Implement HTMLIFrameElement.loading 2024-05-27 17:34:59 +02:00
Jamie Mansfield
9ee061ea14 LibWeb: Implement HTMLImageElement.loading
Removes some console noise while loading mmu.ac.uk :)
2024-05-27 17:34:59 +02:00
Jamie Mansfield
c484625631 LibWeb: Add IDL enum for lazy loading attribute 2024-05-27 17:34:59 +02:00
Aliaksandr Kalenik
f989ebe180 LibWeb: Replace visit() with ifelseif chain in CommandList::execute()
Deeply nested stack traces caused by using visit() were really hard to
read in profiles.
2024-05-27 17:33:40 +02:00
Aliaksandr Kalenik
eff9bbf4c8 LibWeb: Pass whole command by reference into painting command executor
Now after making a change in a painting command we could avoid updating
method's parameters list across 3 classes.
2024-05-27 17:33:40 +02:00
Andreas Kling
2aab56bf71 LibJS: Null-check current executable in VM::dump_backtrace()
If there is no current executable (because we're in a native function
call), we shouldn't try to dereference it.
2024-05-27 17:33:29 +02:00
Andreas Kling
802af5ad9d LibWeb: Allow Element.insertAdjacentHTML on the document element
This fixes wpt/domparsing/insert_adjacent_html.html
2024-05-27 17:33:29 +02:00
Andreas Kling
f12dae7ea4 LibWeb: Update spec link & comments in Element.insertAdjacentHTML()
This has moved from DOM Parsing to HTML, and the comments are slightly
different.
2024-05-27 17:33:29 +02:00
Andreas Kling
e7febd347b LibWeb: Don't advertise the empty string as HTMLCollection property name
This fixes wpt/dom/collections/HTMLCollection-empty-name.html
2024-05-27 17:33:29 +02:00
MacDue
8988dce93d LibGfx: Add early bounds checking to accumulate_non_zero_scanline()
Nonzero fills are much more common (as the default fill rule), so if
this does result in any speed-up it makes sense to do it here too.
2024-05-27 13:02:17 +02:00
MacDue
9a3470c2c5 LibGfx: Fix bounds checking in accumulate_even_odd_scanline()
`edge_extent.max_x` is inclusive so it must be < `m_scanline.size()`.
2024-05-27 13:02:17 +02:00
Diego
e345d65def LibWasm: Use TRY macro when possible
This removes a lot of the error handling boilerplate, and is more
consistent with the rest of the codebase.
2024-05-27 12:44:21 +02:00
Aliaksandr Kalenik
0eeae7ff24 LibWeb: Use stack to represent blit/sample corners commands state
...instead of allocating separate BorderRadiusCornerClipper for each
executed sample/blit commands pair.

With this change a vector of BorderRadiusCornerClipper has far fewer
items. For example on twitter profile page its size goes down from
~3000 to ~3 items.
2024-05-27 04:26:17 +02:00
Aliaksandr Kalenik
9b65a2731b LibWeb: Remove clipper creation error check in sample_under_corners()
Before, this check was needed to prevent crashing when attempting to
allocate zero-size bitmap for sampled corners, which could have happened
if a corner had 0 radius in one axis.

Now, since SampleUnderCorners command is not emmited when radius is 0
in one axis, this check is no longer needed.
2024-05-27 04:26:17 +02:00
Aliaksandr Kalenik
9be65e35b5 Revert "LibGfx+LibWeb: Do not ignore corner radius if it is defined..."
This reverts commit 6b7b9ca1c4b32e76e0afef6bca0cb300e615b576.

The whole corner radius is invisible if it has 0 radius in any axis, so
the reverted commit was a mistake that led to error checking during
painting command execution b61aab66d9 to
avoid crashing on attempt to allocate 0 size bitmap.
2024-05-27 04:26:17 +02:00
Aliaksandr Kalenik
49f75d2c0f LibWeb: Verify each sample corners command has matching blit command 2024-05-27 04:26:17 +02:00
Aliaksandr Kalenik
1a6cf7fadc LibWeb: Fix blit corner clipping command recording order
Before:
- sample corners id = 0
- sample corners id = 1
- sample corners id = 2
- blit corners   id = 0
- blit corners   id = 1
- blit corners   id = 2

After:
 - sample corners id = 0
 - sample corners id = 1
 - sample corners id = 2
 - blit corners   id = 2
 - blit corners   id = 1
 - blit corners   id = 0
2024-05-27 04:26:17 +02:00
Nico Weber
1a9d8e8fbe LibCompress: When limiting huffman tree depth, sacrifice bottom of tree
Deflate and WebP can store at most 15 bits per symbol, meaning their
huffman trees can be at most 15 levels deep.

During construction, when we hit this level, we used to try again
with an ever lower frequency cap per symbol. This had the effect
of giving the symbols with the highest frequency lower frequencies
first, causing the most-frequent symbols to be merged. For example,
maybe the most-frequent symbol had 1 bit, and the 2nd-frequent
two bits (and everything else at least 3). With the cap, the two
most frequent symbols might both have 2 symbols, freeing up bits
for the lower levels of the tree.

This has the effect of making the most-frequent symbols longer at
first, which isn't great for file size.

Instead of using a frequency cap, ignore ever more of the low
bits of the frequency. This sacrifices resolution where it hurts
the lower levels of the tree first, and those are stored less
frequently.

For deflate, the 64 kiB block size means this doesn't have a big
effect, but for WebP it can have a big effect:

sunset-retro.png (876K): 2.02M -> 1.73M -- now (very slightly) smaller
than twice the input size! Maybe we'll be competitive one day.

(For wow.webp and 7z7c.webp, it has no effect, since we don't hit
the "tree too deep" case there, since those have relatively few
colors.)

No behavior change other than smaller file size. (No performance
cost either, and it's less code too.)
2024-05-26 21:00:55 +02:00
Nico Weber
2023e8d8d9 LibCompress: Use saturating add in generate_huffman_lengths()
For our deflate, block size is limited to less than 64 kiB, so the sum
of all byte frequencies always fits in a u16 by construction.

But while I haven't hit this in practice, but it can conceivably happen
when writing WebP files, which currently use a single huffman tree
(per channel) for a while image -- which is often much larger than
64 kiB.

No dramatic behavior change in practice, just feels more correct.
2024-05-26 21:00:55 +02:00
Nico Weber
0711e9d749 LibGfx/WebPWriter: Use huffman compression
This implements some of basic webp compression: Huffman coding.
(The other parts of the basics are backreferences, and color cache
entries; and after that there are the four transforms -- predictor,
subtract green, color indexing, color.)

How much huffman coding helps depends on the input's entropy.
Constant-color channels are now encoded in constant space, but
otherwise a huffman code always needs at least one bit per symbol.
This means just huffman coding can at the very best reduce output
size to 1/8th of input size.

For three test input files:

sunset-retro.png (876K): 2.25M -> 2.02M
(helps fairly little; from 2.6x as big as the png input to 2.36x)

giphy.gif (184k): 11M -> 4.9M
(pretty decent, from 61x as big as the gif input to 27x as big)

7z7c.gif (11K): 775K -> 118K
(almost as good as possible an improvement for just huffman coding,
from 70x as big as the gif input to 10.7x as big)

No measurable encoding perf impact for encoding.

The code is pretty similar to Deflate.cpp in LibCompress, with just
enough differences that sharing code doesn't look like it's worth
it to me. I left comments outlining similarities.
2024-05-26 19:02:49 +02:00
Nico Weber
a01fdca2de LibCompress: Use named EndOfBlock constant
No behavior change.
2024-05-26 19:02:49 +02:00
Nico Weber
ff6d58f321 LibCompress: Pass ReadonlyBytes to encode_huffman_lengths()
...instead of Array and length. No behavior change.
2024-05-26 19:02:49 +02:00
Nico Weber
5c81b4b269 LibCompress: Make encode_block_lengths() a bit less clever
No behavior change.
2024-05-26 19:02:49 +02:00
Nico Weber
756a8fa02d LibGfx/WebP: Move kCodeLengthCodeOrder to WebPSharedLossless.h
...and make it an Array while at it.

(This makes it look a little less like the spec, but that seems
worth it.)

No behavior change.
2024-05-26 19:02:49 +02:00
Nico Weber
d95e4831be LibCompress: Move generate_huffman_lengths() to a .h file
To be used in WebPWriter.

JPEGWriter currently hardcodes huffman tables; maybe it can use this
to build data-dependent huffman tables in the future as well.

Pure code move (except for removing the `DeflateCompressor::` prefix
on the function's name, and putting the default argument for the 4th
argument in the function's definition), no behavior change.
2024-05-26 19:02:49 +02:00
Lucas CHOLLET
f0269daeb6 LibGfx: Make Color::NamedColor be an enum class
As this is used extensively across the codebase, the change would add a
lot of noise. To prevent it, let's also add an `using enum` declaration.
2024-05-26 18:51:52 +02:00
Lucas CHOLLET
5b2356b452 WebContent+WebWorker: Don't set the color value to the index of an enum
The NamedColor would be casted to its underlying int to fit the ARGB on
the left hand side.
2024-05-26 18:51:52 +02:00
Timothy Flynn
eb3b8f8ee4 LibWeb: Implement EventSource for server-sent events
EventSource allows opening a persistent HTTP connection to a server over
which events are continuously streamed.

Unfortunately, our test infrastructure does not allow for automating any
tests of this feature yet. It only works with HTTP connections.
2024-05-26 18:29:24 +02:00
Timothy Flynn
79223f3e1b LibWeb: Correctly check the document's salvageable state during cleanup
The condition here was flipped.
2024-05-26 18:29:24 +02:00
Timothy Flynn
88d46b51ed LibWeb: Implement operation to error a ReadableStream 2024-05-26 18:29:24 +02:00
Timothy Flynn
2a2c59e74b LibWeb: Partially implement the ReadableStream pull-from-bytes AO
We do not handle BYOB request views yet, as they are not needed for the
upcoming usage of this AO.
2024-05-26 18:29:24 +02:00
Timothy Flynn
9cc186b929 LibWeb: Implement the "queue a task" steps as a distinct AO
This will be needed by EventSource.
2024-05-26 18:29:24 +02:00
Timothy Flynn
b6f824a313 Browser: Don't assume downloads have a "total size" available
Ran into a crash here while testing LibProtocol changes. The method we
invoke here (did_progress) already accepts an Optional, and handles when
that Optional is empty. So there's no need to assume `total_size` is
non-empty.
2024-05-26 18:29:24 +02:00
Timothy Flynn
6056428cb5 LibWeb: Support unbuffered fetch requests
Supporting unbuffered fetches is actually part of the fetch spec in its
HTTP-network-fetch algorithm. We had previously implemented this method
in a very ad-hoc manner as a simple wrapper around ResourceLoader. This
is still the case, but we now implement a good amount of these steps
according to spec, using ResourceLoader's unbuffered API. The response
data is forwarded through to the fetch response using streams.

This will eventually let us remove the use of ResourceLoader's buffered
API, as all responses should just be streamed this way. The streams spec
then supplies ways to wait for completion, thus allowing fully buffered
responses. However, we have more work to do to make the other parts of
our fetch implementation (namely, Body::fully_read) use streams before
we can do this.
2024-05-26 18:29:24 +02:00
Timothy Flynn
1e97ae66e5 LibWeb: Support unbuffered resource load requests
This adds an alternate API to ResourceLoader to load HTTP/HTTPS/Gemini
requests unbuffered. Most of the changes here are moving parts of the
existing ResourceLoader::load method to helper methods so they can be
re-used by the new ResourceLoader::load_unbuffered.
2024-05-26 18:29:24 +02:00
Timothy Flynn
168d28c15f LibProtocol+Userland: Support unbuffered protocol requests
LibWeb will need to use unbuffered requests to support server-sent
events. Connection for such events remain open and the remote end sends
data as HTTP bodies at its leisure. The browser needs to be able to
handle this data as it arrives, as the request essentially never
finishes.

To support this, this make Protocol::Request operate in one of two
modes: buffered or unbuffered. The existing mechanism for setting up a
buffered request was a bit awkward; you had to set specific callbacks,
but be sure not to set some others, and then set a flag. The new
mechanism is to set the mode and the callbacks that the mode needs in
one API.
2024-05-26 18:29:24 +02:00
Timothy Flynn
086ddd481d Ladybird+LibWeb: Move User-Agent definitions to their own file
This is to avoid including any LibProtocol header in Objective-C source
files, which will cause a conflict between the Protocol namespace and a
@Protocol interface.

See Ladybird/AppKit/Application/ApplicationBridge.cpp for why this
conflict unfortunately cannot be worked around.
2024-05-26 18:29:24 +02:00
Aliaksandr Kalenik
663cc753a7 LibWeb: Fix clip box calculation in PaintableWithLines
All painting commands except SetClipRect are shifted by scroll offset
before command list execution. This change removes scroll offset
translation for sample/blit corner commands in
`PaintableWithLines::paint` so it is only applied once in
`CommandList::apply_scroll_offsets()`.
2024-05-26 16:11:53 +01:00
Aliaksandr Kalenik
7855d4a8f5 LibWeb: Transform blit corner clipping rectangle to device pixels
Rectangle saved in this command is only used to filter by bounding box,
so the problem was not very visible before.
2024-05-26 16:11:53 +01:00
Aliaksandr Kalenik
3d8349eb88 LibWeb: Fix blit corner clip position in PaintableWithLines
Fixes the bug when blit and sample commands position didn't match.

Before:
1. Emit sample under corners
2. Apply scroll offset
3. Paint content
3. Blit corner clipping

After:
1. Emit sample under corners
2. Save state
3. Apply scroll offset
4. Paint content
5. Restore state
6. Blit corner clipping
2024-05-26 16:11:53 +01:00
Lucas CHOLLET
09f4032eeb LibGfx/PNG: Read metadata from the eXIf chunk
The test image comes from this WPT test:
http://wpt.live/png/exif-chunk.html
2024-05-26 14:54:43 +01:00
Shannon Booth
f28bb90d9b LibJS: Remove non-spec compliant code from internal_construct
It seems that we are now spec compliant enough to be able to remove this
code block :^)

Diff Tests:
    +2     -2 
2024-05-26 12:29:41 +02:00
MacDue
9e2c4f84fd LibWeb: Paint/apply basic-shape clip paths to PaintableBoxes
Currently, these only work when there are no CSS transforms (as the
stacking context painting is not set up to handle that case yet). This
is still enough to get most chat/comment markers working on GitHub
though :^)
2024-05-26 07:55:50 +02:00
MacDue
517379ff80 LibWeb: Resolve basic-shape clip-paths
These will be ignored within SVGs (for now SVGs only support <clipPath>
elements), but will allow clipping standard HTML elements.
2024-05-26 07:55:50 +02:00
MacDue
0135af6e60 Meta: Add basic-shape as a CSS property value type 2024-05-26 07:55:50 +02:00
MacDue
120915048c LibWeb: Parse the polygon() basic shape function 2024-05-26 07:55:50 +02:00
MacDue
5f17d9b34a LibWeb: Add BasicShapeStyleValue to represent CSS basic shapes
See: https://www.w3.org/TR/css-shapes-1/#basic-shape-functions

This patch only implements the `polygon()` basic shape (with the rest
left as FIXMEs).
2024-05-26 07:55:50 +02:00
Shannon Booth
71ccd8ad25 LibWeb: Implement BaseAudioContext.createBuffer
This is a simple factory function which effectively just calls the
AudioBuffer constructor.
2024-05-26 07:49:49 +02:00
Shannon Booth
17ae65cedc LibWeb: Implement AudioBuffer.copyToChannel 2024-05-26 07:48:37 +02:00
Shannon Booth
848d6f5074 LibWeb: Add const qualified BufferableObjectBase::raw_object 2024-05-26 07:48:37 +02:00
Shannon Booth
67b1f4af55 LibWeb: Implement HTMLFormElement.encoding 2024-05-26 07:47:59 +02:00
Shannon Booth
aeb815cc66 LibWeb: Implement HTMLFormElement.enctype 2024-05-26 07:47:59 +02:00
Matthew Olsson
a8ef84f8c3 LibWeb: Use LengthPercentage for calc values in Transformation matrix 2024-05-25 22:19:47 +02:00
Aliaksandr Kalenik
e2b2b2439c LibWeb: Apply corner clip before scroll offset for PaintableWithLines
Fixes bug when corner clip mask moves along with the scrolled text.
2024-05-25 22:19:40 +02:00
Diego
ba5192b2e7 LibWasm: Use u32's instead of size_t's when reading LEB128 numbers
The WebAssembly spec never relies on host system information, like
size_t. For consistency's sake, we should stick to the usage of u32's
instead of size_t's. This didn't cause issues before because
LEB128-encoded u64's are a superset of LEB128-encoded u32's.
2024-05-25 21:24:14 +02:00
Diego
ed8d036b41 LibWasm: Properly read data section tags
The previous version of the function read the tag as a u8. However, as
per the spec, the tag of the data section should be a u32, LEB128
encoded.

https://webassembly.github.io/spec/core/binary/modules.html#data-section
2024-05-25 16:13:15 +02:00
Lucas CHOLLET
fb79aa6159 LibGfx/GIF: Correctly write frames with a non-null position 2024-05-25 06:42:15 +01:00
Aliaksandr Kalenik
05f9733192 LibGfx: Make accumulate_even_odd_scanline() go faster
...by checking scanline vector bounds before entering the loop.
2024-05-24 12:34:52 +02:00
Aliaksandr Kalenik
c413cd0f74 LibWbe: Skip recording of empty painting commands
- Less allocations
- Optimization pass that skips unnecessary sample/blit corner commands
  could be more effecient by ignoring corner radius clipping for empty
  painting commands
2024-05-24 12:34:52 +02:00
Aliaksandr Kalenik
3f3f3766be LibWeb: Make sample_under_corners() go faster
Both page target bitmap and mask bitmap are always BGRA8888, so we can
use `get_pixel<StorageFormat::BGRA8888>` and
`set_pixel<StorageFormat::BGRA8888>` to avoid branching by not
checking a bitmap format.
2024-05-24 12:34:52 +02:00
Matthew Olsson
15a8baee03 LibWeb: Save time for animationcancel event before transitioning to idle
The if statement in the dispatch implies we are in the idle state, so of
course the active time will always be undefined. If this was cancelled
via a call to cancel(), we can save the time at that point. Otherwise,
just send 0.
2024-05-24 07:25:10 +02:00
Lucas CHOLLET
b30c361b08 LibWeb/Fetch: Implement logic to process a response from HTTP's cache
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2024-05-23 13:25:29 -04:00
Lucas CHOLLET
fcbc6123bb LibWeb/Fetch: Add freshness notion to HTTP::Response
Defined in RFC9111 "HTTP Caching".

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2024-05-23 13:25:29 -04:00
Andrew Kaster
c05f296014 LibWeb: Start adding infrastructure for an HTTP Cache 2024-05-23 13:25:29 -04:00
Andrew Kaster
a40b331f39 LibWeb: Update steps of HTTP-network-or-cache-fetch per the latest spec
One step was added since we last visited this AO.
2024-05-23 13:25:29 -04:00
Andreas Kling
9c205537e1 LibWeb: Add missing navigable null check in Document::open()
I saw a null pointer dereference here on GitHub once, but don't know how
to reproduce, or how we'd get here. Nevertheless, null-checking the
navigable is reasonable so let's do it.
2024-05-23 13:58:12 +02:00
Aliaksandr Kalenik
63a56a77a2 LibJS: Add fast ExecutionContext allocator
...that maintains a list of allocated execution contexts so malloc()
does not have to be called every time we need to get a new one.

20% improvement in Octane/typescript.js
16% improvement in Kraken/imaging-darkroom.js
2024-05-23 13:36:02 +02:00
Andreas Kling
f4636a0cf5 LibWeb: Stop spamming animation events on the wrong event target
This patch fixes two issues:

- Animation events that should go to the target element now do
  (some were previously being dispatched on the animation itself.)
- We update the "previous phase" and "previous iteration" fields of
  animation effects, so that we can actually detect phase changes.
  This means we stop thinking animations always just started,
  something that caused each animation to send 60 animationstart
  events every second (to the wrong target!)
2024-05-23 12:10:06 +02:00
Andrew Kaster
a68222f654 LibWeb: Enable callbacks in chunk steps for ReadableStreamDefaultTee
We enqueue a microtask for this readable stream AO, and the methods that
we call from the chunk steps manipulate promises. As such, we need to
enable callbacks for the entire microtask's temporary execution
context.
2024-05-23 11:22:44 +02:00
Andrew Kaster
bab546472e LibWeb: Mark FontFaceSet as a setlike IDL interface
And implement more of the constructor logic.
2024-05-23 10:57:34 +02:00
Andrew Kaster
7077e4d002 LibIDL+LibWeb: Add support for WebIDL setlike declarations on interfaces 2024-05-23 10:57:34 +02:00
Aliaksandr Kalenik
f29ac8517e LibJS: Skip ordinary_call_bind_this() when possible
If during parsing it was found that function won't use `this` then
there is no need to initialise `this_value` during call.
2024-05-23 09:53:31 +02:00
Aliaksandr Kalenik
e934132442 LibJS+LibWeb: Pass function metadata collected in parsing using a struct
By using separate struct we can avoid updating AST node and
ECMAScriptFunctionObject constructors every time there is a need to
add or remove some additional information colllected during parsing.
2024-05-23 09:53:31 +02:00
Ali Mohammad Pur
8b1341c77e LibWeb: Make exported Wasm functions keep the module instance alive
As it's not uncommon for users to drop the module instance on the floor
after having grabbed the few exports they need to hold on to.
Fixes a few UAFs that show up as "invalid" accesses to
memory/tables/etc.
2024-05-23 00:55:56 -06:00
dgaston
2d5cb1e02d Chess: Add display widget for moves
Adds a TextEditor widget to the chess application to display move
history. It is updated whenever Board::apply_move is called to reflect
the current board state.
2024-05-22 23:24:45 -06:00
Matthew Olsson
a98ad191c7 Userland: Add ESCAPING annotations to a bunch of places
This isn't comprehensive; just a result of a simple grep search.
2024-05-22 21:55:34 -06:00
Matthew Olsson
a5f4c9a632 AK+Userland: Remove NOESCAPE
See the next commit for an explanation
2024-05-22 21:55:34 -06:00
Andreas Kling
899c38d342 LibWeb: Mark IDBFactory.open() with FIXME extended attribute in IDL
The stub implementation broke x.com and probably other sites as well,
but let's at least mark it FIXME so we get some debug logging about it.
2024-05-22 21:46:08 +02:00
Andreas Kling
79870bc603 Revert "LibWeb: Add stub for IDBFactory.open"
This reverts commit f7beea1397.

This broke loading https://x.com/
2024-05-22 21:40:52 +02:00
Lucas CHOLLET
07446bbea1 LibGfx/GIF: Use the correct reference to seek before the trailer
This was working with files, but with pre-allocated buffers, the end
is not the same position as last written byte.
2024-05-22 13:29:05 -04:00
Lucas CHOLLET
3c4b8749f0 LibGfx/GIF: Write a Graphic Control Extension block
This allows us to write the duration of each frame.
2024-05-22 13:29:05 -04:00
Lucas CHOLLET
bee8dd76ee LibGfx/GIF: Write the netscape extension block
This allows us to encode the required number of loops in the file.
2024-05-22 13:29:05 -04:00
Aliaksandr Kalenik
ebb3d8025c LibJS: Get this from execution context for non-arrow functions
Allows to skip function environment allocation for non-arrow functions
if the only reason it is needed is to hold `this` binding.

The parser is changed to do following:
- If a function is an arrow function and uses `this` then all functions
  in a scope chain are marked to allocate function environment for
  `this` binding.
- If a function uses `new.target` then all functions in a scope chain
  are marked to allocate function environment.

`ordinary_call_bind_this()` is changed to put `this` value in execution
context when function environment allocation is skipped.

35% improvement in Octane/typescript.js
50% improvement in Octane/deltablue.js
19% improvement in Octane/raytrace.js
2024-05-22 18:30:13 +02:00
Dan Klishch
7ae990d2e5 LibCrypto: Don't compute 2*N remainders in Adler32
Otherwise Zlib decompression spends half of the time computing the
checksum.
2024-05-22 14:25:21 +02:00
Nico Weber
b7b51d01c3 LibGfx/AnimationWriter: Survive animations with two identical frames
Creating a completely empty bitmap fails. Just write a 1x1 bitmap
if the bitmap ends up empty for now.
2024-05-22 06:41:47 -04:00
Nico Weber
51617929dc LibGfx/GIFLoader: Add more debug logging output 2024-05-22 06:41:47 -04:00
Dan Klishch
5a85067b49 Revert "LibCore: Add Core::deferred_invoke_if(F, Condition)"
This reverts commit a362c37c8b.

The commit tried to add an unused function that continued our tradition
of not properly waiting for things but instead flooding event loop with
condition checks that delay firing of the event. I think this is a
fundamentally flawed approach. See also checks for
`fire_when_not_visible` in LibCore/EventLoopImplementationUnix.cpp.
2024-05-21 23:32:54 +02:00
Tim Ledbetter
c0e504fbdd LibWeb: Add some missing [FIXME] IDL attributes 2024-05-21 19:29:04 +02:00
Tim Ledbetter
58bb5e1f7a LibWeb: Use [Reflect] to implement HTMLPreElement.width 2024-05-21 19:28:43 +02:00
Tim Ledbetter
2a7cf1c588 LibWeb: Implement the width and height attributes where missing
This change adds the `width` and `height` properties to
`HTMLVideoElement` and `HTMLSourceElement`. These properties reflect
their respective content attribute values.
2024-05-21 19:28:43 +02:00
Tim Ledbetter
9f9aa62128 LibWeb: Implement the hspace and vspace attributes
These properties reflect their respective content attributes.
2024-05-21 19:28:43 +02:00
Aliaksandr Kalenik
4d37b9e715 LibJS: Do not count arguments as env binding when local variable is used
This is a follow up for 210a5d77dc that
actually allows to skip function environment allocation.
2024-05-21 15:49:29 +00:00
Dan Klishch
38b51b791e AK+Kernel+LibVideo: Include workarounds for missing P0960 only in Xcode
With this change, ".*make.*" function family now does error checking
earlier, which improves experience while using clangd. Note that the
change also make them instantiate classes a bit more eagerly, so in
LibVideo/PlaybackManager, we have to first define SeekingStateHandler
and only then make() it.

Co-Authored-By: stelar7 <dudedbz@gmail.com>
2024-05-21 14:24:59 +02:00
Ali Mohammad Pur
960a4b636c RequestServer: Account for null sockets in recreate_socket_if_needed()
A connection's socket is allowed to be null if it's being recreated
after a failed connect(), this was handled correctly in
request_did_finish but not in recreate_socket_if_needed; this commit
fixes this oversight.
2024-05-21 11:25:08 +02:00
Aliaksandr Kalenik
210a5d77dc LibJS: Use a local variable for arguments object when possible
This allows us to skip allocating a function environment in cases where
it was previously impossible because the arguments object needed a
binding.

This change does not bring visible improvement in Kraken or Octane
benchmarks but seems useful to have anyway.
2024-05-21 11:24:50 +02:00
Lucas CHOLLET
777e84b09b LibGfx+animation: Support writing animated GIF files 2024-05-21 09:47:46 +02:00
Lucas CHOLLET
6a5f8b5163 LibGfx/GIF: Make write_logical_descriptor() take an IntSize
The bitmap was only needed for its size.
2024-05-21 09:47:46 +02:00
Kenneth Myhra
29112f7365 LibWeb: Integrate Streams in XHR::send() 2024-05-20 16:57:52 -04:00
Kenneth Myhra
76418f3ffa LibWeb: Implement the concept incrementally read a body 2024-05-20 16:57:52 -04:00
Kenneth Myhra
34ecc59508 LibWeb: Implement read a chunk concept for ReadableStreamDefaultReader 2024-05-20 16:57:52 -04:00
Kenneth Myhra
50f454fdd5 LibWeb: Enqueue body chunks in Fetch::extract_body()
Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2024-05-20 16:57:52 -04:00
Kenneth Myhra
f119ac1a9d LibWeb: Integrate TransformStream into fetch_response_handover() 2024-05-20 16:57:52 -04:00
Kenneth Myhra
5a3e603b3d LibWeb: Implement AO transform_stream_set_up() 2024-05-20 16:57:52 -04:00
Kenneth Myhra
f3ecdb22d5 LibWeb: Implement ReadableStream::close() 2024-05-20 16:57:52 -04:00
Kenneth Myhra
e2c4019bfc LibWeb: Close acquired writer in AO readable_stream_pipe_to()
Also adds a test to prove that the WritableStream's close callback is
called.
2024-05-20 16:57:52 -04:00
Kenneth Myhra
15b677385c LibWeb: Provide an UInt8Array to AO writable_stream_default_writer_write
ReadLoopReadRequest::on_chunk expects an UInt8Array, so make sure we
convert the passed in ByteBuffer to an UInt8Array before passing it to
the AO writable_stream_default_writer_write.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2024-05-20 16:57:52 -04:00
Timothy Flynn
b5ba60f1d1 LibWeb: Change Fetch's ProcessBodyError to accept a plain JS value
This callback is meant to be triggered by streams, which does not always
provide a WebIDL::DOMException. Pass a plain value instead. Of all the
users of this callback, only one actually uses the value, and already
converts the DOMException to a plain value.
2024-05-20 16:57:52 -04:00
Timothy Flynn
fb9c8324d9 LibThreading: Remove extra spammy log message upon starting a thread 2024-05-20 11:28:34 -06:00
Lucas CHOLLET
a8bac0adc1 LibGfx/WebP: Use default initializer for CanonicalCode::m_code
No behavior change.
2024-05-20 13:17:34 -04:00
Nico Weber
d294f150ed LibGfx+LibCompress: WebPWriter performance regression reduction
This moves both Gfx::CanonicalCode::write_symbol() and
Compress::CanonicalCode::write_symbol() inline.

It also adds `__attribute__((always_inline))` on the arguments
to visit() in the latter. (ALWAYS_INLINE doesn't work on lambdas.)

Numbers with `ministat`: I ran once:

    Build/lagom/bin/image -o test.bmp Base/res/wallpapers/sunset-retro.png

and then ran to bench:

    ~/src/hack/bench.py -n 20 -o bench_foo1.txt \
        Build/lagom/bin/image -o test.webp test.bmp

...and then `ministat bench_foo1.txt bench_foo2.txt` to compare.

The previous commit increased the time for this command by 38% compared
to the before state.

With this, it's an 8.6% regression. So still a regression, but a smaller
one.

Or, in other words, this commit reduces times by 21% compared to the
previous commit.

Numbers with hyperfine are similar -- with this on top of the previous
commit, this is a 7-11% regression, instead of an almost 50% regression.

(A local branch that changes how we compute CanonicalCodes so that we
actually compress a bit is perf-neutral since the image writing code
doesn't change.)

`hyperfine 'image -o test.webp test.bmp'`:
* Before:          23.7 ms ± 0.7 ms (116 runs)
* Previous commit: 33.2 ms ± 0.8 ms (82 runs)
* This commit:     25.5 ms ± 0.7 ms (102 runs)

`hyperfine 'animation -o wow.webp giphy.gif'`:
* Before:           85.5 ms ± 2.0 ms (34 runs)
* Previous commit: 127.7 ms ± 4.4 ms (22 runs)
* This commit:      95.3 ms ± 2.1 ms (31 runs)

`hyperfine 'animation -o wow.webp 7z7c.gif'`:
* Before:          12.6 ms ± 0.6 ms (198 runs)
* Previous commit: 16.5 ms ± 0.9 ms (153 runs)
* This commit:     13.5 ms ± 0.6 ms (186 runs)
2024-05-20 13:17:34 -04:00
Nico Weber
7aa61ca49b LibGfx/WebP: Add CanonicalCode::write_symbol(), use it in writer
We still construct the code length codes manually, and now we also
construct a PrefixCodeGroup manually that assigns 8 bits to all
symbols (except for fully-opaque alpha channels, and for the
unused distance codes, like before). But now we use the CanonicalCodes
from that PrefixCodeGroup for writing.

No behavior change at all, the output is bit-for-bit identical to
before. But this is a step towards actually huffman-coding symbols.

This is however a pretty big perf regression. For
`image -o test.webp test.bmp` (where test.bmp is retro-sunset.png
re-encoded as bmp), time goes from 23.7 ms to 33.2 ms.

`animation -o wow.webp giphy.gif` goes from 85.5 ms to 127.7 ms.

`animation -o wow.webp 7z7c.gif` goes from 12.6 ms to 16.5 ms.
2024-05-20 13:17:34 -04:00
Nico Weber
1bd1b6e5e9 LibGfx/WebPWriter: Put hot loop in its own function
This makes it easier to compare the generated assembly for this function
in different scenarios.

No behavior or perf change.
2024-05-20 13:17:34 -04:00
Nico Weber
ed2658d72c LibGfx/WebP: Move some to-be-shared code to WebPSharedLossless.h
No behavior change. No measurable performance different either.

(I tried `hyperfine 'Build/lagom/bin/image --no-output foo.webp'`
for a few input images before and after this change, and I didn't
see a difference. I also tried if moving both
Gfx::CanonicalCode::read_symbol() and
Compress::CanonicalCode::read_symbol() inline, and that didn't
help either.)
2024-05-20 13:17:34 -04:00
Nico Weber
86b0a56899 LibGfx/WebPWriter: Minor cleanups
Replace a comment with equivalent code, and rename a variable.

No behavior change.
2024-05-20 13:17:34 -04:00
Andreas Kling
448b7ca87b LibJS/Bytecode: Add dedicated instruction for getting length property
By doing this, we can remove all the special-case checks for `length`
from the generic GetById and GetByIdWithThis code paths, making every
other property lookup a bit faster.

Small progressions on most benchmarks, and some larger progressions:

- 12% on Octane/crypto.js
- 6% on Kraken/ai-astar.js
2024-05-20 12:51:56 +02:00
Tim Ledbetter
a6d6729034 LibWeb: Implement the MouseEvent.relatedTarget attribute
This returns the secondary target of a mouse event. For `onmouseenter`
and `onmouseover` events, this is the EventTarget the mouse exited
from. For `onmouseleave` and `onmouseout` events, this is the
EventTarget the mouse entered to.
2024-05-20 08:21:41 +02:00
Ali Mohammad Pur
ddc622233f RequestServer: Serialise accesses to IPC::Connection
Most of IPC::Connection is thread-safe, but the responsiveness timer is
very much not so, this commit makes sure only one thread can send stuff
through IPC to avoid having threads racing in IPC::Connection.
This is simply less work than making sure everything IPC::Connection
uses (now and later) is thread-safe.
2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
def379ce3f LibCrypto: Move some data around earlier in GHash to make it go faster
This makes galois_multiply() about 10% faster.
2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
57714fbb38 RequestServer: Handle IPC requests on multiple threads concurrently
Previously RS handled all the requests in an event loop, leading to
issues with connections being started in the middle of other connections
being started (and potentially blowing up the stack), ultimately causing
requests to be delayed because of other requests.
This commit reworks the way we handle these (specifically starting
connections) by first serialising the requests, and then performing them
in multiple threads concurrently; which yields a significant loading
performance and reliability increase.
2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
4ef24e1c7c LibThreading: Add a ThreadPool 2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
d277fd4679 LibThreading: Expose the ProtectedType alias 2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
e003c0bf06 LibCore: Remove the spammy "too late for a reloading timer" debug log 2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
96c7e83345 LibCore: Make Timers and Notifiers aware of threads
Previously sharing a Timer/Notifier between threads (or just handing
its ownership to another thread) lead to a crash as they are
thread-specific.
This commit makes it so we can handle mutation (i.e. just deletion
or unregistering) in a thread-safe and lockfree manner.
2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
5cc90f848f LibThreading: Add RWLock and RWLockedProtected 2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
06d522f017 LibTLS: Clear connected/error callbacks before leaving connect()
Otherwise error events will call into our setup code, eventually leading
to a UAF.
2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
a362c37c8b LibCore: Add Core::deferred_invoke_if(F, Condition)
This will invoke the function F only if the provided Condition is met,
otherwise the execution of the function F will be further deferred.
2024-05-20 08:03:35 +02:00
Tim Ledbetter
68a1a78a1a LibWeb: Use FIXME extended attribute where possible 2024-05-19 17:35:25 +02:00
Hendiadyoin1
d79347dd4a LibJS: Remove an old VERIFY from break handling in try-finally blocks
The VERIFY assumed that we either have a finally block which we already
visited through a previous boundary or have no finally block what so
ever; But since 301a1fc763 we propagate
finalizers through unwind scopes breaking that assumption.
2024-05-19 17:35:04 +02:00
Jamie Mansfield
3438293e7b LibWeb/Fetch: Share a conditional in fetch response handover
See:
- https://github.com/whatwg/fetch/commit/aaada1f
2024-05-19 16:25:50 +02:00
Jamie Mansfield
951fbb1837 LibWeb/Fetch: Expose a minimised Content-Type to Resource Timing
See:
- https://github.com/whatwg/fetch/commit/931cd06
2024-05-19 16:25:50 +02:00
Jamie Mansfield
08a3904309 LibWeb/MimeSniff: Implement "minimize a supported MIME type"
See:
- https://github.com/whatwg/mimesniff/commit/227a469
2024-05-19 16:25:50 +02:00
Jamie Mansfield
08e4cf1f3b LibWeb/Fetch: Implement Body::bytes()
See:
- https://github.com/whatwg/fetch/commit/1085f4f
2024-05-19 16:25:50 +02:00
Shannon Booth
4fe0cbcf85 LibWeb: Use 'FIXME' extended attribute where possible
This improves the debuggability of many live web pages :^)
2024-05-19 16:24:11 +02:00
Shannon Booth
a8e3400a2a LibWeb: Make DOMImplementation IDL return an XMLDocument
Which the implementation was already doing, so no behaviour change :^)
2024-05-19 16:24:11 +02:00
Shannon Booth
f7beea1397 LibWeb: Add stub for IDBFactory.open
I saw that this not being implemented was causing a javascript exception
to be thrown when loading https://profiler.firefox.com/.

I was hoping that like the last time that partially implementing this
interface would allow the page to load further, but it seems that this
is unfortunately not the case this time!

However, this may help other pages load slightly further, and puts some
of the scaffolding in place for a proper implementation :^)
2024-05-19 16:24:11 +02:00
Shannon Booth
3aa36caa52 LibWeb: Add stub interface for IDBOpenDBRequest 2024-05-19 16:24:11 +02:00
Shannon Booth
bfa330914d LibWeb: Add stub interface for IDBRequest 2024-05-19 16:24:11 +02:00
Shannon Booth
8d5665ebe1 LibWeb: Add stub for IDBFactory 2024-05-19 16:24:11 +02:00
Matthew Olsson
74aeb57631 LibWeb: Add a few missing visits to m_rel_list members 2024-05-19 09:26:30 +02:00
Shannon Booth
3ccbc83168 LibWeb: Add a stubbed slot for DynamicsCompressorNode.reduction
For now, this slot is always 0 - (the default value per spec). But
once we start actually processing audio streams this internal slot
should be changed correspondingly.
2024-05-19 09:26:20 +02:00
Shannon Booth
cf615cbd1c LibWeb: Add AudioParams for DynamicsCompressorNode 2024-05-19 09:26:20 +02:00
Shannon Booth
8fa7b2c173 LibWeb: Log a FIXME when parsing fragments for XML documents
This will help us in detecting potential web compatability issues from
not having this implemented.

While we're at it, update the spec link, as it was moved from the DOM
parsing spec to the HTML one, and implement this function in a manner
that closr resembles spec text.
2024-05-19 07:22:48 +02:00
Shannon Booth
ccdf82c9be LibWeb: Implement scrollIntoView with 'center' block position
This fixes a crash on:

https://docs.github.com/en/get-started/learning-about-github/githubs-plans
2024-05-19 07:22:17 +02:00
Lucas CHOLLET
615d845ff2 LibGfx/GIF: Prefer local tables over a global one
Let's use local tables so every frame can use its own table.
2024-05-19 07:20:15 +02:00
Lucas CHOLLET
f21a4111d2 LibGfx/GIF: Rename write_global_color_table => write_color_table
Local and Global tables are the exact same thing from an encoding
perspective.
2024-05-19 07:20:15 +02:00
Shannon Booth
dd20156010 LibWeb: Fix division by zero on a zero-height viewport SVG image 2024-05-19 07:19:42 +02:00
Shannon Booth
d48316ce15 LibWeb: Fix division by zero on a zero-width viewport SVG image
We were previously crashing by a division by zero due to an aspect ratio
of zero on https://comicbookshop.co.nz/
2024-05-19 07:19:42 +02:00
Lucas CHOLLET
a0401b0d86 LibGfx/GIF: Add support for colors
To determine the palette of colors we use the median cut algorithm.
While being a correct implementation, enhancements are obviously
existing on both the median cut algorithm and the encoding side.
2024-05-18 18:30:07 +02:00
Lucas CHOLLET
1ba8a6f80f LibGfx: Add an implementation of the MedianCut algorithm
This is useful to find the best matching color palette from an existing
bitmap. It can be used in PixelPaint but also in encoders of old image
formats that only support indexed colors e.g. GIF.
2024-05-18 18:30:07 +02:00
Lucas CHOLLET
02e682950e LibGfx: Make Color hashable 2024-05-18 18:30:07 +02:00
Tim Ledbetter
272cd30f17 LibWeb: Add missing visit to m_labels in HTMLElement 2024-05-18 18:29:52 +02:00
Tim Ledbetter
c36ba450be LibWeb: Generate binding for HTMLObjectElement.contentWindow attribute
This only required adding the appropriate definition to the IDL file,
as `NavigableContainer` already implements the logic that we need.
2024-05-18 18:12:08 +02:00
Andreas Kling
b2e6843055 LibJS+AK: Fix integer overflow UB on (any Int32 - -2147483648)
It wasn't safe to use addition_would_overflow(a, -b) to check if
subtraction (a - b) would overflow, since it doesn't cover this case.

I don't know why we didn't have subtraction_would_overflow(), so this
patch adds it. :^)
2024-05-18 18:11:50 +02:00
Hendiadyoin1
1de475b404 LibJS: Prepare yield object before re-routing it through finally 2024-05-18 18:11:10 +02:00
Tim Ledbetter
2447a25753 LibWeb: Implement the labels attribute for all labelable elements
This returns a `NodeList` of all the labels associated with the given
element.
2024-05-18 18:09:18 +02:00
Tim Ledbetter
3dc86747f0 LibWeb: Implement the HTMLOutputElement.htmlFor attribute
This returns a DOMTokenList that reflects the `for` attribute.
2024-05-18 11:23:20 +02:00
Tim Ledbetter
acc1fa3c62 LibWeb: Generate binding for the HTMLObjectElement.form attribute
This only required adding the appropriate definition to the IDL file,
as `FormAssociatedElement` already implements the logic that we need.
2024-05-18 11:04:04 +02:00
Tim Ledbetter
6bf22075ed LibWeb: Implement the HTMLLabelElement.form attribute
This returns the form element associated with the given label element's
control or null if the label has no control.
2024-05-18 11:04:04 +02:00
Tim Ledbetter
5296338e7a LibWeb: Check all elements in same tree to determine labeled control
Previously, when looking for the labeled control of a label element, we
were only checking its child elements. The specification says we should
check all elements in the same tree as the label element.
2024-05-18 11:04:04 +02:00
Tim Ledbetter
fc395716e9 LibWeb: Return NonnullGCPtr<DOMTokenList> from relList getters 2024-05-18 11:03:49 +02:00
Tim Ledbetter
d0555f3176 LibWeb: Flesh out DOMTokenList::supports() implementation
This change makes `DOMTokenList::supports()` work as expected for
`relList` attributes.
2024-05-16 20:31:23 +02:00
dgaston
55fe04a6fa Chess: Port application to GML
This commit ports the chess application to GML in order to
facilitate the addition of widgets in the future.
2024-05-16 07:41:05 +01:00
dgaston
10dbadced8 Chess: Add chess application to Chess namespace
This is required to port the application to GML.
2024-05-16 07:41:05 +01:00
Nico Weber
b6bbff5f3f LibGfx/WebPWriter: Move VP8L compression to WebPWriterLossless.{h,cpp}
* Matches how the loader is organized
* `compress_VP8L_image_data()` will grow longer when we add actual
  compression
* Maybe someone wants to write a lossy compressor one day

No behavior change.
2024-05-16 08:06:50 +02:00
Nico Weber
c0f67a0188 LibGfx/WebPWriter: Remove a copy in the animated frame writing code path
This code path now also compresses to memory once, and then writes to
the output stream.

Since the animation writer has a SeekableStream, it could compress to
the stream directly and fix up offsets later. That's more complicated
though, and keeping the animated and non-animated code paths similar
seems nice. And the drawback is just temporary higher memory use, and
the used memory is smaller than the memory needed by the input bitmap.
2024-05-16 08:06:50 +02:00
Nico Weber
0b06cbdca2 LibGfx/WebPWriter: Move frame data writing out of write_ANMF_chunk()
No behavior change. This also makes it clear that the conditional
alignment at the end can just be a VERIFY() instead of a conditional.
2024-05-16 08:06:50 +02:00
Nico Weber
768a7ea1e5 LibGfx/WebP: Split out ANMFChunk header data into ANMFChunkHeader
No behavior change.
2024-05-16 08:06:50 +02:00
Nico Weber
c183f73922 LibGfx/WebPWriter: Use write_VP8L_chunk() in animation frame writing
This code path still has a redundant copy of the compressed data
after this change, but it's less code this way.

No behavior change.
2024-05-16 08:06:50 +02:00
Nico Weber
885a3d8c5c LibGfx/WebPWriter: One fewer copy of encoded data when saving still webp
Before, we used to compress the image data to memory, then make another
copy to memory, and then write to the output stream.

Now, we compress to memory once and then write to the output stream.

No behavior change.
2024-05-16 08:06:50 +02:00
Nico Weber
33acd4e747 LibGfx/WebPWriter: Extract another align_to_two() helper 2024-05-16 08:06:50 +02:00
Nico Weber
0175fff659 LibGfx/WebPWriter: Extract compress_VP8L_image_data() function 2024-05-16 08:06:50 +02:00
Tim Ledbetter
51fc30a191 LibWeb: Implement the HTMLLinkElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter
fc4e0cf10e LibWeb: Implement the HTMLFormElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter
0a3e1846f0 LibWeb: Implement the HTMLAreaElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter
b7fd39c2e6 LibWeb: Implement the HTMLAnchorElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter
63246577d2 LibWeb: Use correct type for MessageEventInit.ports
This didn't work previously because the IDL generator used the
incorrect type for some types of sequences within dictionaries.
2024-05-16 08:04:01 +02:00
Tim Ledbetter
763b7f0e0c LibWeb: Implement the HTMLOptionElement.form attribute
This returns the parent form of a HTMLOptionElement or null if the
element has no parent form.
2024-05-16 08:03:13 +02:00
Tim Ledbetter
fe7df98d7d LibWeb: Use correct IDL definition for CanvasImageData methods
It is now possible to pass an optional `ImageDataSettings` object to
the `CanvasImageData.createImageData()` and
`CanvasImageData.getImageData()` methods.
2024-05-16 08:02:59 +02:00
Andrew Kaster
28f728dfdb LibWeb: Implement FontFace.load() for url() based font sources 2024-05-16 08:02:43 +02:00
Andrew Kaster
b7526a39b0 LibWeb: Expose StyleComputer's FontLoader class publicly
We'll want to explicitly load fonts from FontFace and other Web APIs
in the future. A future refactor should also move this completely away
from StyleComputer and call it something like 'FontCache'.
2024-05-16 08:02:43 +02:00
Andrew Kaster
d76167b8a4 LibWeb: Add CSS ParsingContext constructor with a realm and URL
This is useful for when we want to parse paths relative to the current
ESO's api base url when there isn't a document, such as in a Worker
context.
2024-05-16 08:02:43 +02:00
Andrew Kaster
8872008958 LibWeb: Use correct JS_CELL name for WorkerEnvironmentSettingsObject 2024-05-16 08:02:43 +02:00
Tim Ledbetter
6290f96aa7 LibGUI: Don't crash when rendering a collapsible toolbar with no items
This prevents a crash in GML Playground that would occur when
previewing a GUI with a collapsible toolbar.
2024-05-15 08:28:24 +02:00
Hendiadyoin1
c8e4499b08 LibJS: Make return control flow more static
With this only `ContinuePendingUnwind` needs to dynamically check if a
scheduled return needs to go through a `finally` block, making the
interpreter loop a bit nicer
2024-05-15 04:25:14 +02:00
Hendiadyoin1
73fdd31124 LibJS: Avoid returning Completions from more Bytecode instructions 2024-05-15 04:25:14 +02:00
MacDue
99579f1f5e LibWeb: Use "valid-types" to define fill-rule in Properties.json
No behaviour change.
2024-05-14 23:01:18 +01:00
MacDue
6c9069fa5d LibWeb: Implement the SVG clip-rule attribute
This controls the fill rule used when rasterizing `<clipPath>` elements.
2024-05-14 23:01:18 +01:00
MacDue
8e00fba71d LibWeb: Correct naming in SVGPathPaintable
The DOM node is a graphics element (not a geometry element) as this
paintable was generalized (to handle things like text).

No behaviour change.
2024-05-14 23:01:18 +01:00
theonlyasdk
6da1d5eb57 Demos: Add sleep option to CatDog
Now you can put your CatDog to sleep while
you're at work :)
2024-05-14 15:45:33 -06:00
Liav A
40a8b009db DynamicLoader: Add an option to list all ELF loaded dependencies
This actually allows us to re-introduce the ldd utility as a symlink to
our dynamic loader, so now ldd behaves exactly like on Linux - it will
load all dynamic dependencies for an ELF exectuable.

This has the advantage that running ldd on an ELF executable will
provide an exact preview of how the order in which the dynamic loader
loads the executable and its dependencies.
2024-05-14 15:42:42 -06:00
Liav A
56790098ea Utilities: Rename ldd => elfdeps
As a preparation to introducing ldd as a symlink to /usr/lib/Loader.so
we rename the ldd utility to be elfdeps, at its sole purpose is to list
ELF object dependencies, and not how the dynamic loader loads them.
2024-05-14 15:42:42 -06:00
Liav A
7437ccd66d DynamicLoader: Add an option to change argv0
This is useful for testing ELF binaries that expose other functionalites
based on the argv0 string (BuggieBox, for example, does it to determine
which utility to run).
2024-05-14 15:42:42 -06:00
Liav A
a5e2694ebf DynamicLoader: Add an option to dry-run an ELF exectuable
This option is useful for measuring time of dynamic linking and
profiling the DynamicLoader itself.
2024-05-14 15:42:42 -06:00
Liav A
8fc1f470ef DynamicLoader: Add standard argument parsing for executing ELF binaries
This change essentially puts the DynamicLoader with 2 roles - the first
one is to be invoked by the kernel to dynamically link an ELF executable
in runtime.

The second role is to allow running ELF executables explicitly from
userspace so the kernel runs the DynamicLoader as the "intended" program
but now the DynamicLoader can do its own commandline argument parsing
and run a specified binary, with future options being possible to
implement easily.
2024-05-14 15:42:42 -06:00
Liav A
7e8dfe758c LibCore: Add a small library with only ArgsParser for DynamicLoader
This will be used in the DynamicLoader code, as it can't do syscalls via
LibCore code.
Because we can't use most of the LibCore code, we convert the versioning
code in Version.cpp to use LibC uname() function.
2024-05-14 15:42:42 -06:00
implicitfield
c44a8fa57c LibC: Implement mkfifoat(2) 2024-05-14 22:30:39 +02:00
implicitfield
4574a8c334 Kernel+LibC+LibCore: Implement mknodat(2) 2024-05-14 22:30:39 +02:00
Sönke Holz
53a1c25638 LibCoredump: Use AK::unwind_stack_from_frame_pointer 2024-05-14 14:02:06 -06:00
Sönke Holz
3059ac71f3 HackStudio: Use AK::unwind_stack_from_frame_pointer 2024-05-14 14:02:06 -06:00
Andreas Kling
ce7c925924 LibJS/Bytecode: Allow assignment expression to write directly to locals 2024-05-14 21:46:36 +02:00
Andreas Kling
d22a06d671 LibJS/Bytecode: Remove all the unreachable execute_impl() functions
There are no calls to these anywhere anymore.
2024-05-14 21:46:36 +02:00