Commit graph

24187 commits

Author SHA1 Message Date
Linus Groh
b3cc320718 LibWeb/HTML: Use correct spec link for multipart/form-data encoding 2023-04-09 17:59:36 +02:00
Kenneth Myhra
d39ac0a0ed LibWeb: Port fire_webgl_context_event() to new FlyString 2023-04-09 17:27:27 +02:00
Kenneth Myhra
fb96966f1e LibWeb: Add WebGL::EventNames 2023-04-09 17:27:27 +02:00
Kenneth Myhra
f9d50e6eca LibWeb: Port fire_keyboard_event() to new FlyString 2023-04-09 17:27:27 +02:00
Kenneth Myhra
8f4d7f2854 LibWeb: Port fire_a_synthetic_pointer_event() to new FlySring 2023-04-09 17:27:27 +02:00
Kenneth Myhra
cbefab21be LibWeb: Port fire_a_page_transition_event() to new FlyString 2023-04-09 17:27:27 +02:00
Kenneth Myhra
bf048da8cb LibWeb: Port fire_progress_event() + request_error_steps() to new String
This ports XHR's fire_progress_event() and request_error_steps() to new
FlyString.

Signature of fire_progress_event() parameter event_name  was changed
from 'String const&' to 'FlyString const&'.
2023-04-09 17:27:27 +02:00
Kenneth Myhra
fdd33d818c LibWeb: Port DOMEventListener to new FlyString 2023-04-09 17:27:27 +02:00
Kenneth Myhra
2091a11488 LibWeb: Port EventTarget to new {Fly}String 2023-04-09 17:27:27 +02:00
Matthew Olsson
868cd95069 LibWeb: Add the WritableStreamDefaultController 2023-04-09 17:14:48 +02:00
Nico Weber
1f0b54c857 LibGfx: Limit ICC-size-is-multiple-of-4 check to v4 files
The v2 spec doesn't require it, and it's not true in practice
(e.g. Compact-ICC-Profiles/profiles/sRGB-v2-nano.icc has size 410).
2023-04-09 16:49:49 +02:00
Nico Weber
bed86fb578 LibGfx: Remove some of the noisier logging from webp lossless decoder
Prefix code decoding seems to work fairly well and produces a ton of
log output with `#define WEBP_DEBUG 1`, so remove the log lines.

(If needed it's always possible to just locally revert this commit.)

No behavior change, since WEBP_DEBUG isn't usually defined.
2023-04-09 16:49:38 +02:00
Idan Horowitz
f412e73bba DynamicLoader: Remove the unused load_regions vector 2023-04-09 11:10:37 +03:00
Karol Baraniecki
f532f9d279 BrickGame: Remember the "Show Shadow Piece" setting between executions
by using the ConfigServer.
2023-04-09 00:44:45 +02:00
Karol Baraniecki
439076df8a BrickGame: Add a menu option to disable the shadow drop hint 2023-04-09 00:44:45 +02:00
Karol Baraniecki
f3f14a7ef1 BrickGame: Show where a piece would end up when after a fast drop
To show it to the player, draw a faint outline of where the piece would
end up.
2023-04-09 00:44:45 +02:00
Karol Baraniecki
652a19b232 BrickGame: Use title case in menu items consistently
by fixing the "Toggle pause" option
2023-04-09 00:44:45 +02:00
Karol Baraniecki
bd12a72546 BrickGame: Add a missing [[nodiscard]] for consistency
Every other function there returning a RenderRequest has one, so might
as well.

Don't add it to check_and_remove_full_rows(), because it's only used
inside other functions returning a RenderRequest, when it's already
clear a render will happen.
2023-04-09 00:44:45 +02:00
Karol Baraniecki
962d39cc05 BrickGame: Port from DeprecatedStrings to Strings 2023-04-09 00:44:45 +02:00
Tim Schumacher
381da77ffb LibCompress: Mark some XZ-related variables and functions as const 2023-04-08 15:18:59 -07:00
Tim Schumacher
e9789e9f36 LibCompress: Move loading XZ blocks into its own function 2023-04-08 15:18:59 -07:00
Tim Schumacher
e6b1e1bb33 LibCompress: Move finishing the current XZ stream into its own function 2023-04-08 15:18:59 -07:00
Tim Schumacher
68984abc43 LibCompress: Move finishing the current XZ block into its own function 2023-04-08 15:18:59 -07:00
Tim Schumacher
0e11e7012d LibCompress: Move loading XZ stream headers into its own function 2023-04-08 15:18:59 -07:00
Nico Weber
95e35b7f5e LibGfx: Correctly decode webp lossless with small palette and odd width
WebP lossless files that use a color indexing transform with <= 16
colors use pixel bundling to pack 2, 4, or 8 pixels into a single pixel.

If the image's width doesn't happen to be an exact multiple of the
bundling factor, we need to:

1. Use ceil_div() instead of just dividing the width by the bundling
   factor

2. Remember the original width and use it instead of computing
   reduced width times bundling factor

This does these changes, and adds a simple test for it -- it at least
checks that the decoded images have the right size.

(I created these images myself in Photoshop, and used the same
technique as for Tests/LibGfx/test-inputs/catdog-alert-*.webp
to create images with a certain number of colors.)
2023-04-09 00:14:15 +02: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
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
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
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
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
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
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
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
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
Timothy Flynn
9f8da9798a LibWeb: Define steps to queue a media element task on a HTMLMediaElement 2023-04-07 16:02:22 +02:00
Timothy Flynn
0a45554bf4 LibWeb: Define missing media HTML event names 2023-04-07 16:02:22 +02:00
Timothy Flynn
660b980660 LibWeb: Sort HTML event names 2023-04-07 16:02:22 +02:00
Timothy Flynn
6d5893a121 LibWeb: Implement HTMLMediaElement's networkState attribute 2023-04-07 16:02:22 +02:00
Timothy Flynn
9a370a5eed LibWeb: Support taking matching tasks out of a task queue
This will be needed for HTMLMediaElement.
2023-04-07 16:02:22 +02:00
Timothy Flynn
807891c0df LibWeb: Support unique task sources
Some elements, like HTMLMediaElement, must have a unique task sources
for every instance of that element that is created. Support this with a
simple wrapper around IDAllocator.
2023-04-07 16:02:22 +02:00
Timothy Flynn
c978beb18b LibVideo: Extract video metadata for public-facing video track data
This copies the video data from the Matroska document into the Track
structure that outside users have access to. Because Track can actually
represent other media types, this is set up such that the Track can hold
metadata for those other types when they are needed.

This is needed for LibWeb's HTMLMediaElement implementation.
2023-04-07 16:02:22 +02:00
Cubic Love
f522178881 Base: Add icons for Assistant
Add 32px and 16px application icons for Assistant
2023-04-07 11:44:23 +01:00
martinfalisse
c839c51b0b LibWeb: Use max-width property in table formatting 2023-04-07 10:42:26 +02:00
Andreas Kling
7b4c76788b LibWeb: Don't put abspos grid/flex items in anonymous wrapper
Grid and flex containers have their own rules for abspos items, so we
shouldn't try to be clever and put them in the "current" anonymous
wrapper block. That behavior is primarily for the benefit of block &
inline layout.
2023-04-07 10:15:16 +02:00
Nico Weber
8760376abe LibGfx: Implement SUBTRACT_GREEN_TRANSFORM for webp lossless decoder 2023-04-07 09:47:04 +02:00
Nico Weber
cdc77f7512 LibGfx: Add scaffolding for applying transforms to webp lossless decoder
Each of the four transforms will inherit from this class.
2023-04-07 09:47:04 +02:00
Nico Weber
b15d3b2329 LibGfx: Add more dbgln_if()s to webp decoder
They were useful while debugging the decoder. Keep them in for a bit.
2023-04-07 09:47:04 +02:00
Nico Weber
2fc682c033 LibGfx: In webp decoder, check that each transform is used only once 2023-04-07 09:47:04 +02:00
Nico Weber
ae1f7124ac LibGfx: Correctly handle more than one PrefixCodeGroup in webp decoder
The `static` here meant we always kept the alphabet sizes of the
first image we happened to load -- and a single webp lossless image
can store several helper images used during decoding.

Usually, the helper images wouldn't use a color cache but the main
image would, but the main image would then use the first entry from
the helper images due to the `static`, which led us to not decoding
the codes for the color cache symbols.
2023-04-07 09:47:04 +02:00
Kenneth Myhra
4d87072201 LibWeb: Port {HTML,UIEvents,XHR}::EventNames to new String 2023-04-06 23:49:08 +02:00
Kenneth Myhra
3aa485aa09 LibWeb: Move string literals to {HTML,UIEvents}::EventNames.h
This moves the reamining string literals from GlobalEventHandlers.h to
{HTML,UIEvents}::EventNames.h.
2023-04-06 23:49:08 +02:00
Matthew Olsson
bdab61ad93 LibWeb: Add the WritableStreamDefaultWriter interface 2023-04-06 22:54:58 +02:00
Matthew Olsson
e93560b769 LibWeb: Add the WritableStream interface 2023-04-06 22:54:58 +02:00
Matthew Olsson
78feba401d LibWeb: Move property_to_callback to Streams/AbstractOperations
This will be necessary for UnderlyingSink, which is WritableStream's
equivalent of UnderlyingSource, and functions in much the same way.
2023-04-06 22:54:58 +02:00
Timon Kruiper
200e91cd7f Kernel+LibC: Modify aarch64's __mcontext to store registers in an array
This commit also removes the unnecessary ifdefs from
sys/arch/aarch64/regs.h. Contributed by konrad, thanks for that.
2023-04-06 21:19:58 +03:00
Luke Wilde
cb62ffbb8a LibWeb: Transform the default path in CRC2D#fill(CanvasFillRule)
Required by Factory Balls Forever to position anything that isn't an
image.
2023-04-06 17:45:07 +02:00
Andreas Kling
b97229c9b5 LibWeb: Ignore preferred width when calculating intrinsic width of block
When calculating the intrinsic width of a block-level box, we now ignore
the preferred width entirely, and not just when the preferred width
should be treated as auto.

The condition for this was both confused and wrong, as it looked at the
available width around the box, but didn't check for a width constraint
on the box itself.

Just because the available width has an intrinsic sizing constraint
doesn't mean that the box is undergoing intrinsic sizing. It could also
be the box's containing block!
2023-04-06 16:47:40 +02:00
Emily Trau
332bb8a299 LibEDID: Fix compiler error when ENABLE_PNP_IDS_DOWNLOAD=OFF 2023-04-06 10:26:21 -04:00
Lucas CHOLLET
cfaa51203f LibGfx/JPEG: Use a smaller type to store coefficients
No need to store them in `i32`, the JPEG norm specifies that they are
not bigger than 16 bits for extended JPEGs. So, in this patch, we
replace `i32` with `i16`. It almost divides memory usage by two :^)
2023-04-06 12:00:08 +01:00
Luke Wilde
a744ae79ff LibWeb: Implement the :defined pseudo class
This selects an element if it is either a built-in element, or an
upgraded custom element.
2023-04-06 11:36:56 +02:00
Luke Wilde
32e27bc7fa LibWeb: Add a bunch of missing CEReactions
This is almost guaranteed not to be all CEReactions we need to add, but
this puts us in a much better situation.
2023-04-06 11:36:56 +02:00
Luke Wilde
034aaf3f51 LibWeb: Introduce CustomElementRegistry and creating custom elements
The main missing feature here is form associated custom elements.
2023-04-06 11:36:56 +02:00
Luke Wilde
083b547e97 LibWeb/WebIDL: Add the construct abstract operation
This will be used by custom elements to upgrade an element to a custom
element.
2023-04-06 11:36:56 +02:00
Luke Wilde
9b8b363445 LibWeb/WebIDL: Move call_user_object_operation out of line
This makes it in line with `invoke_callback`.
2023-04-06 11:36:56 +02:00
Evan Smal
5b906d9a40 HackStudio: Add configuration domain pledge for FileManager
This fixes a bug where clicking the "Save" button would crash the
application because 'FileManager' was a pledged domain.
2023-04-06 08:56:57 +01:00
Julian Offenhäuser
602f5459bf LibGfx: Fix out of bounds read in BitmapFont::masked_character_set()
When creating a copy of the font containing only the glyphs that are in
use, we previously looped over all possible code points, instead of the
range of code points that are actually in use (and allocated) in the
font. This is a problem, since we index into the array of widths to find
out if a given glyph is used. This array is only as long as the number
of glyphs the font was created with, causing an out of bounds read when
that number is less than our maximum.
2023-04-06 08:26:22 +01:00
Cameron Youell
0c98cde18e GMLPlayground: Pledge Calendar domain
This now allows for the preview of `@GUI::Calendar` without
crashing the whole program.
2023-04-06 08:24:25 +01:00
Kenneth Myhra
1080281e58 LibWeb: Port AbstractBrowsingContext to String 2023-04-06 08:41:43 +02:00
Kenneth Myhra
03d6cb88ff LibWeb: Port KeyboardEvent to new String 2023-04-06 08:41:43 +02:00
Kenneth Myhra
e14be3927a LibWeb: Port FocusEvent to new String 2023-04-06 08:41:43 +02:00
stelar7
d527edf0ab LibTLS: Change Certificate parsing to use ErrorOr
Loads of changes that are tightly connected... :/
* Change lambdas to static functions
* Add spec docs to those functions
* Keep the current scope around as a parameter
* Add wrapping classes for some Certificate members
* Parse ec and ecdsa data from certificates
2023-04-06 09:57:31 +03:30
stelar7
b1d80b35af LibCrypto: Add ability to rewrite current tag kind
This is used for IMPLICIT tags where the expected kind is overriden
by the encoding instructions.
2023-04-06 09:57:31 +03:30
stelar7
8273fc230c LibCrypto: Add missing ASN1 tag kinds 2023-04-06 09:57:31 +03:30
Nico Weber
73c291f5ae LibGfx: Pass in format and size to webp image decoding function 2023-04-06 00:16:52 +01:00