summaryrefslogtreecommitdiff
path: root/Userland/Libraries
AgeCommit message (Collapse)Author
2023-04-03LibGfx/JPEG: Add YCCK and CMYK to RGB color transformationsLucas CHOLLET
It means that we now fully support JPEGs with four components :^).
2023-04-03LibGfx/JPEG: Support for images with four componentsLucas CHOLLET
This patch adds support for properly read images with four components, basically CMYK or YCCK. However, we still lack color spaces transformations for this type of image. So, it just postpones failure.
2023-04-03LibGfx/JPEG: Replace C-style array by `Array`Lucas CHOLLET
2023-04-03LibGfx/JPEG: Bring IDCT and YCbCr conversion closer to specificationLucas CHOLLET
As mentioned in F.2.1.5 - Inverse DCT (IDCT), the decoder needs to perform a level shift by adding 128. This used to be done in `ycbcr_to_rgb` after the conversion. Now, we do it in `inverse_dct` in order to ensure that the task is done unconditionally. Consequences of this are that we are no longer required to explicitly do it for RGB images and also, the `ycbcr_to_rgb` function is exactly like the specification.
2023-04-03LibGfx/JPEG: Don't reject SOF2 image with successive approximationsLucas CHOLLET
It means full SOF2 JPEG support, yay!
2023-04-03LibGfx/JPEG: Support refinement scansLucas CHOLLET
These scans are only present in progressive JPEGs and contains bits to increase the precision of values acquired in previous scans.
2023-04-03LibGfx/JPEG: Handle ZRL as a special caseLucas CHOLLET
When reading the stream, interpreted as a normal value 0xF0 means skip 15 values and assign the 16th to 0. On the other hand, the marker ZRL - which has the value 0xF0, means skip 16 values. For baseline JPEGs, ZRL doesn't need to be interpreted differently as writing the 16th value has no consequence. This is no longer the case with refining scans. That's why this patch implement correctly ZRL.
2023-04-03LibGfx/JPEG: Change the loop over AC coefficientsLucas CHOLLET
We used to skip over zero coefficient by modifying the loop counter. It is unfortunately impossible to perform this with SOF2 images as only coefficients with a zero-history should be skipped. This induces no behavior change for the user of the function.
2023-04-03LibGfx/JPEG: Still iterate over AC coefficients of a EOB targeted blockLucas CHOLLET
This commit is nonsense for anything else than SOF2 images with spectral approximation. For this particular case, skips like EOB or ZRL only apply to coefficients with a zero-history. This commit prepares the code to handle this behavior.
2023-04-03LibGfx/JPEG: Split `spectral_approximation`Lucas CHOLLET
This `u8` is actually two values of 4 bits. Let's store them separately to avoid confusion.
2023-04-03AK+Everywhere: Change AK::fill_with_random to accept a Bytes objectTimothy Flynn
Rather than the very C-like API we currently have, accepting a void* and a length, let's take a Bytes object instead. In almost all existing cases, the compiler figures out the length.
2023-04-03LibGfx/JPEG: Use a basic `Stream` instead of a `SeekableStream`Lucas CHOLLET
Only one use `seek` remains, as it is a bit more complex to remove.
2023-04-03LibGfx/JPEG: Remove the `ensure_bounds_okay` functionLucas CHOLLET
This function has probably been added when we weren't as good with error propagations as we are now. We can safely remove it and let future calls to `read` fail if the file is corrupted. This can be tested with the following bytes (already used in 9191829a): ffd8ffc000000800080ef701101200ffda00030100
2023-04-03LibWeb: Parse and plumb background-position-x/yMacDue
This parses the new background-position-x/y longhands and properly hooks up them up. This requires converting PositionStyleValue to just contain two EdgeStyleValues so that it can be easily expanded into the longhands.
2023-04-03LibWeb: Add EdgeStyleValueMacDue
This represents a single edge and offset, this will be needed for the values of background-position-x/y.
2023-04-03LibWeb: Add longhand properties for background-positionMacDue
If background-position was not longhand enough for you, we've now got background-position-x and background-position-y :^)
2023-04-02LibHTTP: Tolerate extra \r\n in chunked-encoding last block sizeAli Mohammad Pur
Some servers put CR/LF there, so let's tolerate that behaviour. Fixes #18151.
2023-04-02LibWeb: Add borders functionality to CSS Gridmartinfalisse
2023-04-02LibWeb: Fix regression in definite grid row heightsmartinfalisse
Fixes a row height bug when a grid item in a row has a definite height.
2023-04-02LibWeb: Rename PositionedBox to GridItemmartinfalisse
This seems like a more accurate description of what this class really is, and easier to understand in my opinion.
2023-04-02LibWeb: Don't apply presentational hints to associated pseudo elementsAndreas Kling
CSS properties generated by presentational hints in content attributes should not leak into pseudo elements.
2023-04-02LibWeb: Don't apply element inline style to associated pseudo elementsAndreas Kling
An element's inline style, if present, should not leak into any pseudo elements generated by that element.
2023-04-02AK: Increase LittleEndianOutputBitStream's buffer size and remove loopsTimothy Flynn
This is very similar to the LittleEndianInputBitStream bit buffer change from 8e834d4bb2f8a217013142658fe7203c5a5c3170. We currently buffer one byte of data for the underlying stream. And when we put bits onto that buffer, we do so 1 bit at a time. This replaces the u8 buffer with a u64. And instead of looping at all, we perform bitwise operations to write the desired number of bits. Using the "enwik8" file as a test (100MB uncompressed, commonly used in benchmarks: https://www.mattmahoney.net/dc/enwik8.zip), compression time decreases from: 13.62s to 10.9s on Serenity (cold) 13.62s to 9.22s on Serenity (warm) 2.93s to 2.32s on Linux One caveat is that this requires explicitly flushing any leftover bits when the caller is done with the stream. The byte buffer implementation implicitly flushed its data every time the buffer was byte-aligned, as doing so would always fill the byte. This is no longer the case. But for now, this should be fine as the one user of this class, DEFLATE, already has a "flush everything now that we're done" finalizer.
2023-04-02LibWeb: Fix application of intrinsic aspect ratio to flex column itemsAndreas Kling
The intrinsic aspect ratio of a box is a width:height ratio, so if we have the width and need the height, we should divide, not multiply. :^)
2023-04-02LibWeb: Make HTMLImageElement loads delay the document load eventAndreas Kling
This is something we're supposed to do according to the HTML spec. Note that image loading is currently completely ad-hoc, and this just adds a simple DocumentLoadEventDelayer to the existing implementation. This will allow us to use images in layout tests, which rely on the document load event firing at a predictable time.
2023-04-02LibJS: Parse secondary expressions with the original forbidden token setLinus Groh
Instead of passing the continuously merged initial forbidden token set (with the new additional forbidden tokens from each parsed secondary expression) to the next call of parse_secondary_expression(), keep a copy of the original set and use it as the base for parsing the next secondary expression. This bug prevented us from properly parsing the following expression: ```js 0 ?? 0 ? 0 : 0 || 0 ``` ...due to LogicalExpression with LogicalOp::NullishCoalescing returning both DoubleAmpersand and DoublePipe in its forbidden token set. The following correct AST is now generated: Program (Children) ExpressionStatement ConditionalExpression (Test) LogicalExpression NumericLiteral 0 ?? NumericLiteral 0 (Consequent) NumericLiteral 0 (Alternate) LogicalExpression NumericLiteral 0 || NumericLiteral 0 An alternate solution I explored was only merging the original forbidden token set with the one of the last parsed secondary expression which is then passed to match_secondary_expression(); however that led to an incorrect AST (note the alternate expression): Program (Children) ExpressionStatement LogicalExpression ConditionalExpression (Test) LogicalExpression NumericLiteral 0 ?? NumericLiteral 0 (Consequent) NumericLiteral 0 (Alternate) NumericLiteral 0 || NumericLiteral 0 Truth be told, I don't know enough about the inner workings of the parser to fully explain the difference. AFAICT this patch has no unintended side effects in its current form though. Fixes #18087.
2023-04-02LibCompress: Make CanonicalCode::from_bytes() return ErrorOr<>Nico Weber
No intended behavior change.
2023-04-01LibWeb: Add ReadableStream.locked/cancel()/getReader()Matthew Olsson
2023-04-01LibWeb: Implement ReadableStream's constructorMatthew Olsson
2023-04-01LibWeb: Add UnderlyingSource struct for ReadableStream constructorMatthew Olsson
2023-04-01LibWeb: Add ReadableStreamDefaultControllerMatthew Olsson
2023-04-01LibWeb: Add ReadableStreamDefaultReaderMatthew Olsson
2023-04-01LibWeb: Add the stream queue-related abstract operationsMatthew Olsson
2023-04-01LibWeb: Add the ReadableStreamGenericReader mixin interfaceMatthew Olsson
2023-04-01LibWeb: Use scaled font when painting list item markersMacDue
This now uses the current font (rather than the painter's default) and scales it correctly. This is not perfect though as just naviely doing .draw_text() here does not follow the proper text layout logic so this is misaligned (by a pixel or two) with the text in the <li>.
2023-04-01LibWeb: Use scaled font when painting text shadowsMacDue
This fixes painting text shadows at non-100% zoom.
2023-04-01LibWeb: Add .scaled_font() helper to Layout::NodeMacDue
This returns the font scaled for the current zoom level.
2023-04-01LibCompress: Implement block size validation for XZ streamsTim Schumacher
2023-04-01LibCompress: Factor out the list of XZ check sizesTim Schumacher
2023-04-01LibCompress: Reduce indentation in CompressedBlock::try_read_more()Nico Weber
...by removing `else` after `return`. No behavior change.
2023-04-01LibWeb: Don't churn HTML::EventLoop while in microtask checkpointAndreas Kling
At the end of HTML::EventLoop::process(), the loop reschedules itself if there are more runnable tasks available. However, the condition was flawed: we would reschedule if there were any microtasks queued, but those tasks will not be processed if we're currently within the scope of a microtask checkpoint. To fix this, we now only reschedule the HTML event loop for microtask processing *if* we're not already in a microtask checkpoint. This fixes the 100% CPU churn seen when looking at PRs on GitHub. :^)
2023-04-01LibCore: Remove colons from markdown header names in ArgsParserTim Ledbetter
This makes formatting more consistent across man pages.
2023-04-01LibCompress: Add a utility to GZIP compress an entire fileTimothy Flynn
This is copy-pasted from the gzip utility, along with its existing TODO. This is currently only needed by that utility, but this gives us API symmetry with GzipDecompressor, and helps ensure we won't end up in a situation where only one utility receives optimizations that should be received by all interested parties.
2023-04-01gunzip+LibCompress: Move utility to decompress files to GzipDecompressorTimothy Flynn
This is to allow re-using this method (and any optimization it receives) by other utilities, like gzip.
2023-03-31LibCompress: Remove two needless heap allocationsNico Weber
2023-03-31LibWeb: Add HTMLAnchorElement.referrerPolicy propertySam Atkins
2023-03-31LibWeb: Add HTMLAnchorElement.text getter and setterSam Atkins
And a FIXME for the missing `referrerPolicy` property.
2023-03-31LibWeb: Add "CEReactions" to HTMLAnchorElement IDL as in specSam Atkins
2023-03-31LibGUI: Add gutter indicators to TextEditor :^)Sam Atkins
HackStudio's Editor has displayed indicators in its gutter for a long time, but each required manual code to paint them in the right place and respond to click events. All indicators on a line would be painted in the same location. If any other applications wanted to have gutter indicators, they would also need to manually implement the same code. This commit adds an API to GUI::TextEditor so it deals with these indicators. It makes sure that multiple indicators on the same line each have their own area to paint in, and provides a callback for when one is clicked. - `register_gutter_indicator()` should be called early on. It returns a `GutterIndicatorID` that is then used by the other methods. Indicators on a line are painted from right to left, in the order they were registered. - `add_gutter_indicator()` and `remove_gutter_indicator()` add the indicator to the given line. - `clear_gutter_indicators()` removes a given indicator from every line. - The `on_gutter_click` callback is called whenever the user clicks on the gutter, but *not* on an indicator.
2023-03-31LibGUI: Rename TextEditor::LineVisualData -> LineDataSam Atkins
This is going to hold other per-line data too.