Commit graph

24101 commits

Author SHA1 Message Date
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