Commit graph

50126 commits

Author SHA1 Message Date
Mike Swanson 5a1c0c6836 Ports: Support extracting *.tar.zst source archives 2023-05-12 05:36:47 +02:00
Caoimhe 99de0b2c14 HexEditor: Add list of recently opened files 2023-05-11 20:20:40 +01:00
Aliaksandr Kalenik de970c2dce LibWeb: Resolve grid items preferred width in GFC
Previously, the width and height of grid items were set to match the
size of the grid area they belonged to. With this change, if a grid
item has preferred width or height specified to not "auto" value it
will be resolved using grid area as containing block and used instead.
2023-05-11 18:37:06 +02:00
Aliaksandr Kalenik c2f6ba8f5f LibWeb: Parse calc() function in grid sizes
Adds missing part of grid size parsing function to handle calc().
2023-05-11 18:36:56 +02:00
Aliaksandr Kalenik 7fee05e18c LibWeb: Use LengthPercentage in CSS::GridSize
Using LengthPercentage instead of Length and Percentage separately
is going to allow GridSize to store calc() values. It also allows
to simplify some parts of layout code.
2023-05-11 18:36:56 +02:00
Sam Atkins 6a21bbb5b2 errno: Remove usage of DeprecatedString 2023-05-11 16:33:18 +02:00
Sam Atkins 23dd16febe errno: Look up errors by name as well as number
eg, `errno enotsup` now shows the description and number for ENOTSUP.
2023-05-11 16:33:18 +02:00
Sam Atkins a22a6c371e errno: Include error code names in output
And align the output nicely while we're at it. :^)
2023-05-11 16:33:18 +02:00
Andreas Kling b98252728e LibWeb: Fix percentage min/max sizes on flex items with intrinsic ratio
We were resolving percentage values against the containing block size in
the wrong axis.
2023-05-10 18:46:04 +02:00
Andreas Kling 89ba7246dd LibWeb: Don't resolve CSS property values for unconnected elements
While it's possible to getComputedStyle() on an unconnected element,
the resulting object is not supposed to have any values, since we can't
resolve style without a document root anyway.

This fixes a crash on https://bandcamp.com
2023-05-10 17:27:07 +02:00
Andreas Kling 4005793e79 LibWeb: Handle CSS "color: currentcolor"
Per CSS-COLOR-4, when `color` is `currentcolor`, it should resolve to
the inherited value.
2023-05-10 15:36:34 +02:00
Tim Ledbetter cf4a43e4c0 Chess+GameSettings: Optionally highlight the king when in check
When either king is in check, its square is now highlighted with a red
background. This behavior can be toggled in GameSettings.
2023-05-10 12:13:35 +01:00
Andreas Kling 0c26717ba3 LibWeb: Adjust flex item main size through aspect ratio if needed
If there are min or max size constraints in the cross axis for a flex
item that has a desired aspect ratio, we may need to adjust the main
size *after* applying the cross size constraints.

All the steps to achieving this aren't mentioned in the spec, but it
seems that all other browsers behave this way, so we should too.
2023-05-10 13:03:05 +02:00
James Liu f248f566b8 Help: Fix link to Contents page 2023-05-10 09:13:07 +01:00
Aliaksandr Kalenik 14cb0067bb LibWeb: Implement more of "Resolve Intrinsic Track Sizes" in GFC
Implements some parts of "Resolve Intrinsic Track Sizes" algorithm
from spec to make it more spec compliant.
2023-05-10 05:52:47 +02:00
Aliaksandr Kalenik 1ada6a43e2 LibWeb: Split run_track_sizing into smaller method in GFC
Splits run_track_sizing into following methods:
- initialize_track_sizes (12.4. Initialize Track Sizes)
- resolve_intrinsic_track_sizes (12.5. Resolve Intrinsic Track Sizes)
- maximize_tracks (12.6. Maximize Tracks)
- expand_flexible_tracks (12.7 Expand Flexible Tracks)
- stretch_auto_tracks (12.8. Stretch auto Tracks)
2023-05-10 05:52:47 +02:00
Aliaksandr Kalenik 352037664d LibWeb: Use size_t instead of int when appropriate in GFC
size_t should be used instead of int in loop counter and to store
rows/columns positions because they can't be negative values.
This allows to remove some static casts to int.
2023-05-09 20:34:28 +02:00
Aliaksandr Kalenik d9960a8d1d LibWeb: Refactor tracks initialization in GFC to reduce code duplication
This change moves code that was duplicated for rows and columns into
separate function.
2023-05-09 20:34:28 +02:00
Aliaksandr Kalenik 0a1bffdd92 LibWeb: Move gap tracks initialization into separate method in GFC 2023-05-09 20:34:28 +02:00
Aliaksandr Kalenik 62d26a5afb LibWeb: Move grid items placement algorithm into separate method in GFC
Let's follow pattern of other formatting context where steps of layout
are separated into method.
2023-05-09 20:34:28 +02:00
Nico Weber 9e8b507fad LibGfx/WebP: Do not add alpha channel for animated images without alpha
In practice, it looks like e.g. the animaged webp file on
https://mathiasbynens.be/demo/animated-webp has the header flag set,
because 2 of the frames have alpha, but they're composited on top of
the final bitmap, but the final bitmap isn't transparent there. So
that image still gets a useless alpha channel. Oh well.
2023-05-09 17:46:37 +02:00
Timothy Flynn f18ae19122 CI: Update the action to package the JS REPL to macOS 13
The macOS 13 runner has Xcode 14.3. which is required to compile JS
after d6b786b3fe (though we do have to
explicitly select Xcode 14.3, as 14.2 is the default).
2023-05-09 08:36:33 -06:00
Timothy Flynn 2ceaeccff5 ClipboardHistory: Replace Core::BufferedFile use with InputBufferedFile
Core::BufferedFile was renamed to InputBufferedFile in 8c34959b.
2023-05-09 08:35:29 -06:00
Andreas Kling 197efc8985 LibWeb: Improve handling of min/max constraint violations on images
Instead of bailing after resolving one violated constraint, we have to
continue down the list of remaining constraints.

We now also call the constraint solver for all replaced elements with
"auto" for both width and height.

Co-authored-by: 0GreenClover0 <clovers02123@gmail.com>
2023-05-09 12:11:28 +02:00
Andreas Kling 90b21890c5 LibWeb: Remove dead code in compute_width_for_replaced_element() 2023-05-09 12:11:28 +02:00
Lucas CHOLLET a08de19922 LibGfx/PortableFormat: Use FixedArray::unchecked_at
This allows us to drop from 7% to 5% passed on `add_pixels` when using
`image` to do conversions from JPEG to PPM.
2023-05-09 11:18:46 +02:00
Lucas CHOLLET 4a2ef231b8 AK: Add FixedArray::unchecked_at 2023-05-09 11:18:46 +02:00
Lucas CHOLLET 44905ed395 LibGfx/PortableFormat: Write to the output stream row by row
This is done by adding an intermediate buffer and flush it at the end of
every row. This makes the `add_pixels` method to drop from 50% to 7% in
profiles.
2023-05-09 11:18:46 +02:00
Lucas CHOLLET d4d3c3f262 LibGfx/PortableFormat+image: Make encode take a Stream
As we directly write to the stream, we don't need to store a copy of the
entire image in memory. However, writing to a stream is heavier on the
CPU than to a ByteBuffer. This commit unfortunately makes `add_pixels`
two times slower.
2023-05-09 11:18:46 +02:00
Lucas CHOLLET af6dc267d3 AK: Add OutputBufferedStream
This class, in a similar fashion to what has been done with
`InputBufferedStream`, postpones write to the stream until an internal
buffer is full.

This patch also adds the `OutputBufferedFile` alias.
2023-05-09 11:18:46 +02:00
Lucas CHOLLET 8c34959b53 AK: Add the Input word to input-only buffered streams
This concerns both `BufferedSeekable` and `BufferedFile`.
2023-05-09 11:18:46 +02:00
Lucas CHOLLET 48b000a36c AK: Add CircularBuffer::flush_to_stream
In a similar fashion to what have been done with `fill_from_stream`,
this new method allows to write CircularBuffer's data to a Stream
without additional copies.
2023-05-09 11:18:46 +02:00
Lucas CHOLLET 2a91245a96 image: Initialize strip_color_profile with a default value 2023-05-09 11:18:46 +02:00
Emil Militzer 8200d1f68b LibWeb: Initial offset in reverse flex layout moved to opposite side
This change moves the initial offset for justify-content: center to the
opposite side if the flex layout is in the reverse direction.
2023-05-09 10:32:09 +02:00
Andreas Kling 6ae208dbf6 LibWeb: Broadcast the viewport rect to clients immediately after layout
This lets elements figure out if they're visible within the viewport or
not, so they take appropriate action.

Fixes the issues with animations not starting until the viewport was
resized or scrolled.
2023-05-09 09:48:49 +02:00
Andreas Kling dbe961ca02 LibWeb: Move image viewport awareness from ImageBox to ImagePaintable
Images being aware of being visible inside the viewport is a painting
concern, not a layout concern.
2023-05-09 09:48:49 +02:00
Lucas CHOLLET 8da9ff24e4 Tests: Add tests for 12 bits JPEGs
In this commit, two tests are added, one with a `SOF1` image, the other
with a `SOF2`.
2023-05-09 07:00:15 +02:00
Lucas CHOLLET 312c398b59 LibGfx/JPEG: Add support for 12 bits JPEGs
This is done by two distinct things:
- Allowing 12 bits AC and DC coefficients
- Adjusting coefficients in the IDCT

While this patch allows to display them we still don't correctly do
the color transformation and ultimately only truncating coefficients to
8 bits.
2023-05-09 07:00:15 +02:00
Lucas CHOLLET 9b5050a11c LibGfx/JPEG: Add support for SOF1 images
More precisely, it allows the decoder to try `SOF1` images. There are
still some sub-kind of this kind of JPEG that we don't support. In a
nutshell `SOF1` images allow more Huffman and quantization tables, 12
bits precision and arithmetic encoding. This patch only brings support
for the "more tables" part.

Please note that `SOF2` images are also allowed to have more tables, so
we gave the decoder the ability to handle these in the same time.
2023-05-09 07:00:15 +02:00
Aliaksandr Kalenik fb6b52b3fb LibWeb: Align GridFormattingContext::run_track_sizing() with the spec
1. Stop using -1 to indicate infinity value of growth limit. Just use
   INFINITY for that.
2. More complete implementation of "Expand Flexible Tracks" step.
3. Return AvailableSize from get_free_space: spec says that this
   function can return indefinite size and it is ok.
2023-05-09 06:37:30 +02:00
Aliaksandr Kalenik f2323b5b99 Tests/LibWeb: Split input/grid/minmax.html into smaller tests 2023-05-09 06:37:30 +02:00
Aliaksandr Kalenik 0dcc93ed3d Tests/LibWeb: Split input/grid/gap.html into smaller tests
The file gap.html, which previously had multiple grid tests, has now
been divided into smaller files, each containing only one grid test.
It is going to make it easier to identify what inputs have been
affected by changes in layout code.
2023-05-09 06:37:30 +02:00
Aliaksandr Kalenik bb90bf0141 Tests/LibWeb: Split input/grid/template-areas.html into smaller tests
The file template-areas.html, which previously had multiple grid tests,
has now been divided into smaller files, each containing only one grid
test. It is going to make it easier to identify what inputs have been
affected by changes in layout code.

Also this change removes parts of template-areas.html that we can't
layout correctly yet.
2023-05-09 06:37:30 +02:00
Jelle Raaijmakers 3af92a76be Ports: De-special case ./package.sh dev
There is nothing special about the `dev` command; move its logic to
`do_dev` and invoke it generalized.
2023-05-09 06:36:30 +02:00
Jelle Raaijmakers a81e83f3b5 Ports: Only remove dir contents on clean, not the dir itself
The entirety of `.port_include.sh` depends on having a current working
directory for the respective port. If we were to remove the directory,
some actions such as `fetch` could fail since our current working
directory would now be an invalid inode.

This issue was exposed by running `./package.sh` followed by
`./package.sh dev` and answering 'y' to the question on cleaning the
build directory.
2023-05-09 06:36:30 +02:00
Jelle Raaijmakers 71671e0921 Ports: Alphabetize commands in .port_include.sh
Also remove a stray newline.
2023-05-09 06:36:30 +02:00
Nico Weber dd2ca56ee4 LibGfx/WebP: Add two missing closing quotes for spec comments 2023-05-09 06:35:56 +02:00
Nico Weber bc207fd0a0 LibGfx/WebP: Move lossy decoder to its own file
Pure code move (except of removing `static` on the two public functions
in the new header), not behavior change.

There isn't a lot of lossy decoder yet, but it'll make implementing it
more convenient.

No behavior change.
2023-05-09 06:35:56 +02:00
Nico Weber 83da7ad875 LibGfx/WebP: Give VP8 decoding functions same interface as VP8L ones
Namely:
* Store compressed data in VP8Header
* Make the functions just take ReadonlyBytes instead of a Chunk

Having a function that takes a header and does decoding of the data
after the header isn't really necessary for VP8. For VP8L, it's needed
because the ALPH chunk stores VP8L data without the VP8L header.
But it's nice to make the functions consistent, and it's kind of a
nice structure.

No behavior change.
2023-05-09 06:35:56 +02:00
Nico Weber d15dc28833 LibGfx/WebP: Tell decode_webp_chunk_VP8() if it needs an alpha channel
decode_webp_chunk_VP8() itself will only ever decode RGB data from a
lossy webp stream, but a separate ALPH chunk could add alpha data
later on. Let the function know if that will happen, so that it can
return a bitmap with an alpha channel if appropriate.

Since lossy decoding isn't implemented yet, no behavior change. But it
makes it a bit easier to implement lossy decoding in the future.
2023-05-09 06:35:56 +02:00