Commit graph

48952 commits

Author SHA1 Message Date
Marco Cutecchia 401946947c Toolchain: Stop building QEMU with i386 support 2023-04-08 14:12:29 -07:00
Timothy Flynn 4555e3b8d2 LibWeb: Begin painting video controls on HTMLVideoElement layout nodes
If the video element has a 'controls' attribute, we now paint some basic
video controls over the video element. If no frame has been decoded yet,
we paint a play button on the center of the element.

If a frame has been decoded, we paint that frame and paint a control bar
on the bottom of the frame. This control bar currently only contains a
play/pause button, depending on the video's playback state. We will only
paint the control bar if the video is paused or hovered.
2023-04-08 22:04:14 +02:00
Timothy Flynn 4f29cac715 LibWeb: Set the media ready state to HAVE_ENOUGH_DATA after fetching
Because we currently both fetch and process the media data in one chunk,
we have enough data for playback immediately.
2023-04-08 22:04:14 +02:00
Timothy Flynn 90e1d4f545 Base: Add playback state data to the video test page 2023-04-08 22:04:14 +02:00
Timothy Flynn d99a075ff9 LibWeb: Implement HTMLMediaElement.play
This also includes the HTMLMediaElement's list of pending play promises,
which is coupled pretty tightly with HTMLMediaElement.play.
2023-04-08 22:04:14 +02:00
Timothy Flynn b8a37ef809 LibWeb: Implement HTMLMediaElement.pause 2023-04-08 22:04:14 +02:00
Timothy Flynn 90921a4f16 LibWeb: Implement the HTMLMediaElement paused attribute
Note that the default value of the attribute is true. We were previously
autoplaying videos as soon as they loaded - this will prevent that from
happening until the paused attribute is set to false.
2023-04-08 22:04:14 +02:00
Timothy Flynn e130525c24 LibWeb: Implement HTMLMediaElement.load 2023-04-08 22:04:14 +02:00
Timothy Flynn 9ad4c9e6b0 LibWeb: Log correct error object when failing to decode a video sample 2023-04-08 22:04:14 +02:00
Timothy Flynn 8dd5bf7f11 LibWeb: Add missing include to WebIDL::Promise
WebIDL::Promise is aliased to a JS::PromiseCapability. This missing
include would cause a compile error in an upcoming commit.
2023-04-08 22:04:14 +02:00
Nico Weber f2efb97578 Tests: Add webp lossless test with color index and < 16 colors
For the test files, I opened Base/res/icons/catdog/alert.png in Adobe
Photoshop 2023, used Image->Mode->Index Color...->
Palette: Local (Perceptive) to reduce the number of colors to 13, 8, and
3 with transparency, and 2 without transparency, then converted it back
to Image->Mode->RGB Color (else it can't be saved as webp), then
File->Save a Copy... to save a WebP (mode lossless) for every palette
size.
2023-04-08 19:24:13 +02:00
Nico Weber 1dab480015 LibGfx: Implement color index pixel bundling in webp decoder
See the lengthy comment added in this commit for details.

With this, the webp lossless decoder is feature complete :^)

(...except for bug fixes and performance improvements, as always.)
2023-04-08 19:24:13 +02:00
Nico Weber 7309441b31 LibGfx: Enable webp lossless Transform to return new bitmap
...in addition to modifying in-place. This is needed for bitpacking
support for the color indexing transform (and it could also be used
to make the color indexing transform return an indexed bitmap, which
is something we could do if that's the last transform that's applied).

No behavior change.
2023-04-08 19:24:13 +02:00
Nico Weber 13f8bbb284 LibGfx: Add some more dbgln_if()s to webp decoder 2023-04-08 19:24:13 +02:00
Nico Weber 82182f4560 LibGfx: Give PrefixCodeGroup a deleted copy ctor
This makes the accidental copy fixed in 2125ccdc19 a compile error.

No behavior change.
2023-04-08 19:23:44 +02:00
Nico Weber a34b300393 Fuzzers: Add a WebP fuzzer 2023-04-08 18:58:14 +02:00
Nico Weber 1fc56e56c3 LibGfx: Make webp lossless decoder 6 times as fast
Reduces the time to run

    Build/lagom/image ~/src/libwebp/webp_js/test_webp_wasm.webp -o tmp.png

from 0.5s to 0.25s.

Before, 60% of the time was spent decoding webp and 40% writing png.
Now, 16% of the time was spent decoding webp and 84% writing png.

That means png writing takes 0.2s, and webp decoding time went from
0.3s to 0.05s.

A template expression without explicit return type deduces its return
type as if for a function whose return type is declared auto. That
does deduce return-by-value, while `decltype(auto)` would deduce
return-by-reference.  Explictly saying `decltype(auto)` would work
too, but writing out the type is maybe easier to understand.

No behavior change other than being much faster.
2023-04-08 18:57:37 +02:00
Liav A b414b56336 Ports: Update dmidecode to version 3.5 2023-04-08 19:02:06 +03:00
Liav A fd62eb325e Ports: Update dtc to version 1.7.0
Also, don't use a commit hash anymore but instead use tags, which are
updated often enough.
2023-04-08 18:01:06 +03:00
Liav A 9d43132380 Ports: Update file to version 5.44 2023-04-08 17:59:09 +03:00
Nico Weber 6151a251f5 Tests: Add test for lossless webp file using a color indexing tranform
The image is https://quakewiki.org/wiki/File:Qpalette.png in lossless
webp format with a color indexing transform.

I've created Qpalette.webp by running

    examples/cwebp -z 0 ~/src/serenity/tmp.ppm -o Qpalette.webp

built at libwebp webmproject/libwebp@0825faa4c1 (without
png support, so I first ran

    Build/lagom/image ~/Downloads/Qpalette.png -o tmp.ppm

to convert it from png to a format my cwebp binary could read).

This file also happens to explicitly set max_symbol, so it serves
as a test for that code path as well.
2023-04-08 16:50:40 +02:00
Nico Weber 24967b0d29 LibGfx: Second attempt to handle max_symbol correctly in webp decoder
The previous attempt was in commit e5e9d3b877, where I thought
max_symbol describes how many code lengths should be read.

But it looks like it instead describes how many code length input
symbols should be read. (The two aren't the same since one code length
input symbol can produce several code lengths.)

I still agree with the commit description of e5e9d3b877 that the spec
isn't very clear on this :)

This time I've found a file that sets max_symbol and with this change
here, that file decodes correctly. (It's Qpalette.webp, which I'm about
to add as a test case.)
2023-04-08 16:50:40 +02:00
Nico Weber a915d07293 LibGfx: Implement most of COLOR_INDEXING_TRANSFORM for webp decoder
Doesn't yet implement pixel packing for when the palette has fewer
than 16 colors.
2023-04-08 16:50:40 +02:00
Nico Weber 6f4fdd85b7 LibGfx: Extract free add_argb32() function in webp decoder 2023-04-08 16:50:40 +02:00
Nico Weber 50c9b51eca LibGfx: Make a webp error message more detailed
Now that lossless decoding mostly works, make it clear that only
lossy decoding isn't implemented yet.
2023-04-08 16:50:40 +02:00
Liav A 7b745a20f1 Kernel: Mark a bunch of NonnullRefPtrs also const to ensure immutability
These were easy to pick-up as these pointers are assigned during the
construction point and are never changed afterwards.

This small change to these pointers will ensure that our code will not
accidentally assign these pointers with a new object which is always a
kind of bug we will want to prevent.
2023-04-08 13:44:21 +02:00
Andreas Kling e1f5aae632 AK: Bake CLion IDE check into AK_COMPILER_CLANG
For whatever reason, when CLion does its code indexing thing, it doesn't
define __clang__ despite using Clang. This causes it to run into various
problems that we've solved by checking for Clang.

Since CLion does define __CLION_IDE__ (or sometimes __CLION_IDE_, no
idea why but I have seen this issue locally), let's make that part of
the AK_COMPILER_CLANG check.

This makes CLion stop highlighting various things as errors.
2023-04-08 13:43:25 +02:00
Andreas Kling 9264303f5d Kernel: Don't reuse old master TLS region data in sys$execve()
When switching to the new address space, we also have to switch the
Process::m_master_tls_* variables as they may refer to a region in
the old address space.

This was causing `su` to not run correctly.

Regression from 65641187ff.
2023-04-08 07:28:27 +02:00
Tim Ledbetter 44dd824764 Ports: Add stockfish port 2023-04-07 14:59:27 -06:00
Kenneth Myhra ad5cbdc51b LibWeb: Port {Mouse,UI,Wheel,}Event to new String
This ports MouseEvent, UIEvent, WheelEvent, and Event to new String.
They all had a dependency to T::create() in
WebDriverConnection::fire_an_event() and therefore had to be ported in
the same commit.
2023-04-07 22:41:01 +02:00
Kenneth Myhra e0002aa993 LibWeb: Move string literals to HTML::EventNames
This moves the string literals animation{end,iteration,start} and
transitionend to HTML::EVentNames.
2023-04-07 22:41:01 +02:00
Kenneth Myhra d7ff360969 LibWeb: Correct casing of webkitTransitionEnd and webkitAnimation*
This corrects the casing of the legacy event types webkitTransitionEnd
and webkitAnimation{End,Iteration,Start}.
2023-04-07 22:41:01 +02:00
Kenneth Myhra 59a21c6274 LibWeb: Port CustomEvent to new String 2023-04-07 22:41:01 +02:00
Timothy Flynn 44cf92616e LibTimeZone: Update to TZDB version 2023c
https://mm.icann.org/pipermail/tz-announce/2023-March/000079.html
2023-04-07 20:52:01 +02:00
Timothy Flynn a8fce9eec2 LibJS: Update spec numbers for the Intl Enumeration proposal
This proposal has been merged into the main ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/81856b3
2023-04-07 20:50:50 +02:00
Nico Weber 61b540e737 Tests: Add another test for webp lossless decoding 2023-04-07 20:49:39 +02:00
Nico Weber d354c1b007 LibGfx: Implement meta prefix code support in webp decoder 2023-04-07 20:49:39 +02:00
Nico Weber 6d38824985 LibCompress: Tolerate more than 288 entries in CanonicalCode
Webp lossless can have up to 2328 symbols. This code assumed the deflate
max of 288, leading to crashes for webp lossless files using more than
288 symbols (such as Tests/LibGfx/test-inputs/simple-vp8l.webp).

Nothing writes webp files at this point, so the m_bit_codes and
m_bit_code_lengths arrays aren't ever used in practice with more than
288 entries.
2023-04-07 20:49:39 +02:00
Nico Weber 55b2977d5d LibGfx: Implement COLOR_TRANSFORM for webp lossless decoder 2023-04-07 20:49:39 +02:00
Nico Weber ebbe4dafa1 LibGfx: Implement PREDICTOR_TRANSFORM for webp lossless decoder
Very much not written for performance at this point.
2023-04-07 20:49:39 +02:00
Nico Weber b1cde0d432 LibGfx: Add CanonicalCode wrapper to webp lossless decoder
WebP lossless differs from deflate in how it handles 1-element codes.
Deflate consumes one bit from the bitstream to produce the element,
while webp lossless consumes 0 bits. Add a wrapper class to handle
this case.
2023-04-07 20:49:39 +02:00
Timothy Flynn 60100c1389 Base: Add a simple test page to load a video and display some metadata 2023-04-07 16:02:22 +02:00
Timothy Flynn f156d3d5e5 LibWeb: Create a basic layout node for HTMLVideoElement 2023-04-07 16:02:22 +02:00
Timothy Flynn 725d7c3699 LibWeb: Implement HTMLVideoElement's video{Width,Height} attributes 2023-04-07 16:02:22 +02:00
Timothy Flynn becd70eccb LibWeb: Begin implementing HTMLMediaElement's readyState attribute
It's not totally clear to me when all of these states are supposed to be
set. For example, nothing in the HTMLMediaElement spec says to "set the
readyState attribute to HAVE_ENOUGH_DATA". However, this will at least
advance the readyState to HAVE_METADATA, which is needed for other
useful attributes for debugging.
2023-04-07 16:02:22 +02:00
Timothy Flynn e10e041882 LibWeb: Implement HTMLMediaElement's duration attribute 2023-04-07 16:02:22 +02:00
Timothy Flynn 5f9fc5aedc LibWeb: Indicate that we may be able to play video MIME types 2023-04-07 16:02:22 +02:00
Timothy Flynn e2f32e6ab3 LibWeb: Parse and load the HTMLMediaElement's src attribute
The spec for loading a media element is quite huge. This implements just
enough to parse the attribute, fetch the corresponding media object, and
decode the media object (if it is a video). While doing so, this also
implements most network state tracking and firing DOM events that may be
observed via JavaScript.
2023-04-07 16:02:22 +02:00
Timothy Flynn 460e1bd072 LibWeb: Implement TrackEvent for media events 2023-04-07 16:02:22 +02:00
Timothy Flynn 3f1badf9b2 LibWeb: Implement VideoTrack and VideoTrackList
This implements the IDL for these types and some event handling around
them.
2023-04-07 16:02:22 +02:00