summaryrefslogtreecommitdiff
path: root/Userland/Libraries
AgeCommit message (Collapse)Author
2022-10-10LibCards: Combine CardStack constructorsSam Atkins
And while I'm at it, clarify the name of `associated_stack` to `covered_stack`. It's used in exactly one way, so we can make the code clearer by giving it a less generic name.
2022-10-10LibCards+Games: Rename "draw" methods to "paint" for claritySam Atkins
"Draw" is already a card-game term so using it for graphics was confusing me a lot!
2022-10-10LibCards+Games: Make CardGame responsible for managing CardStacksSam Atkins
Just moving some code around really.
2022-10-10LibCards+Games: Move "create a deck" logic to LibCardsSam Atkins
`create_standard_deck()` is the usual 52-card deck, but more custom setups (such as Spider's multiples-of-one-suit) can be created by passing suit counts to `create_deck()`.
2022-10-10AK+Userland: Replace Linux, macOS, and *BSD macros with platform definesAndrew Kaster
We have such nice platform macros, let's clean up any remnants of manual __my_platform__ macros in LibCore, LibCompress and AK.
2022-10-10Userland: Remove unecessary uses of __serenity__ macroAndrew Kaster
2022-10-10Everywhere: Replace uses of __serenity__ with AK_OS_SERENITYAndrew Kaster
Now that we have OS macros for essentially every supported OS, let's try to use them everywhere.
2022-10-10LibRegex: Don't build LibRegex/C/Regex.cpp on LagomAndrew Kaster
This file implements the POSIX APIs from <regex.h>, and is not suitable for inclusion in a Lagom build. If we do include it, it will override the host's regex functions and wreak havoc if it's resolved before the host's implementation.
2022-10-10LibCore: Don't assume that the first address from getaddrinfo is IPv4Andrew Kaster
By passing AF_UNSPEC to getaddrinfo, we're telling the system's implementation that we are ok getting either (or both) IPv4 and IPv6 addresses in our result. On my Ubuntu 22.04 system, the first addrinfo returned for "www.google.com" holds an IPv6 address, which when interpreted as an IPv4 sockaddr_in gives an address of 0.0.0.0. This fixes TestTLSHandshake in Lagom locally.
2022-10-10LibVideo: Initialize VP9 BitStream's reservoir fieldZaggy1024
Leaving it uninitialized could lead to undefined behavior.
2022-10-10LibGfx: Add TintFilterMacDue
This is a very simpler filter that tints an image with a color.
2022-10-10LibWeb: Fix wrapping glitches on `repeating-linear-gradient()`sMacDue
This fixes some off-by-one wrapping issues that became visible when running on x86_64. The problem still existed on i686, but by chance did not show up due to a -/+ 0.000001 difference between the two.
2022-10-09LibVideo: Remove unnecessary dbgln callsZaggy1024
Debug prints are expensive, so doing them every frame seems excessive now that the decoder is completely functional on some test videos.
2022-10-09LibVideo: Make probability tables save to the specified indexZaggy1024
Previously, saved probability tables were being inserted, causing the Vector to increase in size when it should say fixed at a size of 4. This changes the Vector to an Array<T, 4> which will default-initalize and allow assigning to any index without previously setting size.
2022-10-09LibVideo: Ensure that syntax element counts don't overflowZaggy1024
Integer overflow could sometimes occur due to counts going above 255, where the values should instead be clamped at their maximum to avoid wrapping to 0.
2022-10-09LibVideo: Prevent decode_block from saving motion vectors out of boundsZaggy1024
This fixes an issue causing frame 3 of the test video to fail to parse because a reference vector was incorrectly within the range for a high precision delta vector read.
2022-10-09LibVideo: Add support for VP9 superframesZaggy1024
This allows the second shown frame of the VP9 test video to be decoded, as the second chunk uses a superframe to encode a reference frame and a second to inter predict between the keyframe and the reference frame.
2022-10-09LibVideo: Implement inter predictionZaggy1024
This enables the second frame of the test video to be decoded. It appears that the test video uses a superframe (group of multiple frames) for the first chunk of the file, but we haven't implemented superframe parsing. We also ignore the show_frame flag, so for now, this means that the second frame read out is shown when it should not be. To fix this, another error type needs to be implemented that is "thrown" to decoder's client so they know to send another sample buffer.
2022-10-09LibVideo: Look up interpolation filter probability correctlyZaggy1024
The above interpolation filter mode was being taken from the left side instead, causing some parsing errors. This also changes the magic number 3 to SWITCHABLE_FILTERS. Unfortunately, the spec uses the magic number, so this value was taken instead from the reference codec, libvpx.
2022-10-09LibVideo: Fix incorrect VP9 InterMode enum valuesZaggy1024
These values were referencing the wrong column of a table in the spec, the values should start from 10.
2022-10-09LibVideo: Implement block parsing for inter framesZaggy1024
This gets the decoder closer to fully parsing the second frame without any errors. It will still be unable to output an inter-predicted frame. The lack of output causes VideoPlayer to crash if it attempts to read the buffers for frame 1, so it is still limited to the first frame.
2022-10-09LibVideo: Add MotionVector lookup tables as constant expressionsZaggy1024
This changes MotionVector by removing the cpp file and moving all functions to the header, where they are now declared as constexpr so that they can be compile-time evaluated in LookupTables.h.
2022-10-09LibVideo: Rename MV to MotionVector for clarityZaggy1024
2022-10-09VideoPlayer: Display frames from the VP9 decoderZaggy1024
For testing purposes, the output buffer is taken directly from the decoder and displayed in an image widget. The first keyframe can be displayed, but the second will not decode so VideoPlayer will stop at frame 0 for now. This implements a BT.709 YCbCr to RGB conversion in VideoPlayer, but that should be moved to a library for handling color space conversion.
2022-10-09LibVideo: Implement VP9 intra-predicted frame decodingZaggy1024
The first keyframe of the test video can be decoded with these changes. Raw memory allocations in the Parser have been replaced with Vector or Array to avoid memory leaks and OOBs.
2022-10-09LibVideo: Make new DecoderError class to report useful errorsZaggy1024
This allows runtime strings, so we can format the errors to make them more helpful. Errors in the VP9 decoder will now print out a function, filename and line number for where a read or bitstream requirement has failed. The DecoderErrorCategory enum will classify the errors so library users can show general user-friendly error messages, while providing the debug information separately. Any non-DecoderErrorOr<> results can be wrapped by DECODER_TRY to return from decoder functions. This will also add the extra information mentioned above to the error message.
2022-10-09LibVideo: Change decode_term_subexp read to the correct number of bitsZaggy1024
This allows parsing of the implemented functions from the VP9 spec in the test video included in /home/anon/Videos.
2022-10-09LibVideo: Read multiple raw bits at once to refill the range decoderZaggy1024
This will allow BitStream::read_bool() to read more than one bit from the range-coded bitstream at a time if needed.
2022-10-09LibVideo: Improve error reporting for VP9 range decoderZaggy1024
init_bool will now check whether there is enough data in the bitstream for the range coding size to be fully read. exit_bool will now read the entire padding element regardless of size, which the spec does not specify a limit on.
2022-10-09LibVideo: Cache 64 bits at a time for reading in BitStreamZaggy1024
Reads will now be done in larger chunks at a time. The public read_byte() function was removed in favor of a private fill_reservoir() function which will be used to fill the 64-bit reservoir field which will then be bit-shifted and masked as necessary for subsequent arbitrary bit-sized reads. read_f(n) was renamed to read_bits to be clearer about its use.
2022-10-09LibVideo: Allow bit stream reads to throw errorsZaggy1024
Errors are propagated to the user of the decoder so that they can be aware of specific places where a read failed.
2022-10-09LibVideo: Remove MV class's copy assignment overloadZaggy1024
This was unnecessary, as the implicit one works correctly.
2022-10-09LibVideo: Remove printing of the interpolation filter in VP9 dump_infoZaggy1024
The interpolation filter value is not set when reading an intra-only frame, so printing this for the first keyframe of the file was printing "220", which is invalid.
2022-10-09LibVideo: Remove headers from CMakeLists.txtZaggy1024
2022-10-09AK+Everywhere: Fix data corruption due to code-point-to-char conversionBen Wiederhake
In particular, StringView::contains(char) is often used with a u32 code point. When this is done, the compiler will for some reason allow data corruption to occur silently. In fact, this is one of two reasons for the following OSS Fuzz issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=49184 This is probably a very old bug. In the particular case of URLParser, AK::is_url_code_point got confused: return /* ... */ || "!$&'()*+,-./:;=?@_~"sv.contains(code_point); If code_point is a large code point that happens to have the correct lower bytes, AK::is_url_code_point is then convinced that the given code point is okay, even if it is actually problematic. This commit fixes *only* the silent data corruption due to the erroneous conversion, and does not fully resolve OSS-Fuzz#49184.
2022-10-09LibWeb+Base: Add grid repeat() functionalitymartinfalisse
Add ability to use values passed to grid-template-columns and grid-template-rows for CSS Grid layout within a repeat() function. E.g. grid-template-columns: repeat(2, 50px); means to have two columns of 50px width each.
2022-10-09LibWeb: Make HostDefined and Intrinsics free functions [[nodiscard]]Andrew Kaster
Hopefully no one else will forget to call set_prototype with the cached prototype they just retrieved from a realm and spend a long time wondering why their object has no properties...
2022-10-09LibWeb: Re-implement HTML::Navigator using IDLAndrew Kaster
Get rid of the bespoke NavigatorObject class and use the modern IDL strategies for creating platform objects to re-implement Navigator and its associcated mixin interfaces. While we're here, implement it in a way that brings WorkerNavigator up to spec :^)
2022-10-09LibWeb: Remove the workaround "Worker Window" from WorkersAndrew Kaster
We can now properly add the prototypes and constructors to the global object of the Worker's inner realm, so we don't need this window for anything anymore.
2022-10-09LibWeb: Delete WindowObjectHelper and use new generated helper insteadAndrew Kaster
There's still some yaks to shave here as Window, Location and Navigator don't have idl files yet.
2022-10-09LibIDL: Remove static maps for interfaces and resolved importsAndrew Kaster
Instead, create a tree of Parsers all pointing to a top-level Parser. All module imports and interfaces are stored at the top level, instead of in a static map. This allows creating multiple IDL::Parsers in the same process without them stepping on each others toes.
2022-10-09LibIDL: Parse extended attributes that have () wrapped expressionsAndrew Kaster
This includes things like Exposed and LegacyFactoryFunction.
2022-10-09LibWeb: Add Exposed attribute and IDL spec links where missingAndrew Kaster
The intent is to use these to autogenerate prototype declarations for Window and WorkerGlobalScope classes. And the spec links are just nice to have :^)
2022-10-09LibWeb: Fix ::-webkit-progress-bar/value pseudo elementsMacDue
Recent changes to layout and display broke these pseudo elements leading to crashes on a few websites such as https://rpcs3.net/.
2022-10-08LibWeb+Base: Deal with column-spans greater than implicit gridmartinfalisse
When the indicated column-span is greater than the implicit grid (like in cases when the grid has the default size of 1x1, and the column is supposed to span any number greater than that), then previously were crashing.
2022-10-08LibWeb: Fix bug in maybe_add_column()martinfalisse
Fixes a bug in the maybe_add_column() implementation of the OccupationGrid. Previously were checking for the width of the grid based off of the first row, and so when augmenting the column count row-by-row the latter rows would have differing column counts. Also, were doing an unnecessary + 1 which I imagine comes from before when I wasn't quite clear on whether I was referring to columns by index or by the css-value of the column (column 1 in the css is column index 0).
2022-10-08LibWeb+WebContent: Add EventLoopPlugin::quit() virtualAndreas Kling
This allows you to customize breaking out of the system event loop.
2022-10-07LibWeb: Add initial implementation of Element.blur()Andrew Kaster
This implementation includes a first cut at run the unfocusing steps from the spec, with many things left unimplemented. The viewport related spec steps in particular don't seem to map to LibWeb concepts, which makes figuring out if things are properly focused much more difficult.
2022-10-07LibCore: Make Core::System::{send,recv}fd work on macOSGunnar Beutner
All the required bits were already there. Also, this would probably work on FreeBSD without modification but I don't currently have a system to test this on.
2022-10-07LibGfx: Remove unnecessary divides in MatrixFilterMacDue