Commit graph

57827 commits

Author SHA1 Message Date
Nico Weber 822b7720e1 Meta: Let test_pdf.py be less dramatic about issue counts
For every issue string, json['issues'][issue_string] contains a list
of (page, count_of_issue_on_this_page) tuples.

To get the total number the issue appears in the current document,
we need to add up all the count_of_issue_on_this_page, not multiply the
page number with count_of_issue_on_this_page and add those (-‸ლ)
2024-01-10 09:36:33 +01:00
Idan Horowitz 0befa77b99 CI: Update comment-on-pr version
The newer version installs a specific version of octokit, since the
latest version no longer supports the ruby installation in github
actions vms. This should resolve the CI issues.
2024-01-10 09:34:55 +01:00
Mr.UNIX 9507157f04 Escalator: Port Escalator to GML Compiler 2024-01-10 00:03:27 +01:00
Bastian Neumann 7d63b8b95f LibWeb/CSS: Remove nullpointer dereference in Parser
On platinenmacher.tech there is a document without a window. During
size attribute parsing the window pointer is dereferenced which
causes a crash. This checks for the window to be actually there
before dereferencing.
2024-01-09 18:38:16 +00:00
Sanil 343d6b001f Hearts: Port to GML compiler 2024-01-09 17:23:39 +01:00
Rawley 27339fe6e7 Ports: Bump perl5 to 5.38.2 2024-01-09 14:48:53 +01:00
Shannon Booth 72d0257a19 LibWeb: Add ref-test cases for reordered keywords in CSS positions
Where if 'center' is present the horizontal or vertical values must be
used to infer whether center is X or Y.
2024-01-09 13:37:35 +00:00
Shannon Booth 5b9a0e3fe7 LibWeb: Allow reordering of keywords in CSS positions
As the spec points out:
> Note that a pair of keywords can be reordered while a combination of
> keyword and length or percentage cannot. So center left is valid while
> 50% left is not.

This was a bug in our implementation of alternative 2 of css-values-3,
resulting in the following CSS failing to be parsed:

`background-position: center right;`

This commit fixes the issue as part of an update of the parsing to
css-values-4. As far as I can tell, the grammar is equivalent - but
simpler to implement due to the lack of optional values.

The fix for this issue is also as part of alternative 2 parsing in the
new grammar.

Progress towards: #22401
2024-01-09 13:37:35 +00:00
Andreas Kling 5b7a8891a6 LibWeb: Implement calc() value equality check in a more efficient way
Instead of serializing two calc() values to String and then comparing
those strings, we can now compare calc() values by actually traversing
their internal CalculationNode tree.

This makes style recomputation faster on pages with lots of calc()
values since it's now much cheaper to check whether a property with
some calc() value actually changed.
2024-01-09 14:15:27 +01:00
implicitfield c994326d5a LibWeb/CSS: Improve parsing of length percentage values for transforms 2024-01-09 14:15:05 +01:00
Andrew Kaster 480cbd9126 Meta: Update Fuzzili instructions and dockerfile since patch is upstream 2024-01-09 13:29:43 +01:00
MacDue 00b24a55b1 LibWeb: Fix drawing axis-aligned lines
Previously, these were clipped by the RecordingPainter, which used the
path's bounding box (which in this case is zero width or height). The
fix is to expand the bounding box by the stroke width.

Fixes #22661

Note: This is unrelated to any recent LibGfx changes :^)
2024-01-09 00:03:09 +01:00
MacDue fc41c282ec LibWeb: Fix utf16-be check in HTMLEncodingDetection
The utf-16be check mistakenly skipped index 3, so was not checking the
correct bytes. This meant UTF16-BE files could fail to decode.
2024-01-08 23:35:09 +01:00
MacDue 5e973fca0b LibWeb: Prevent OOB access in HTMLEncodingDetection for input of '</'
Previously, this never checked if `position + 2` was valid. This
slightly reorders the loop so all indices are checked.

Fixes #22163
2024-01-08 23:35:09 +01:00
Aliaksandr Kalenik 3f52d6045a LibWeb/CSS: Resolve percentages in NumericCalculationNode
Percentages should be resolved against the provided percentage basis
instead of just returning the underlying value.

Fixes https://github.com/SerenityOS/serenity/issues/22654
2024-01-08 15:57:42 +00:00
Nicolas Ramz 5e7e98cd3c LibGfx/ILBMLoader: Add support for transparent color 2024-01-08 07:21:27 -07:00
Nicolas Ramz fc5b6e4dda LiGfx/ILBMLoader: Don't throw if malformed bitplane can be decoded
Some apps seem to generate malformed images that are accepted
by most readers. We now only throw if malformed data would lead to
a write outside the chunky buffer.
2024-01-08 07:21:27 -07:00
Lee Hanken 7e3249ad4c LibAudio: Test reading and writing of wav files
Includes a set of wav files of different frequencies, these are
each loaded and then written to a temporary file, checking that
the meta-data is correctly read and that the output matches the input.
2024-01-08 07:20:11 -07:00
Lee Hanken 01930a7043 LibAudio: Correctly output mono wav files
Prevent two channels of data being written when the wav file is mono.
2024-01-08 07:20:11 -07:00
Andreas Kling aa245f9f18 LibWeb: Fix reverse flex layout with justify-content: normal
Before this change, we used the wrong insertion point for flex items
in reverse layouts with `justify-content: normal`. This caused flex
items to overflow the flex containers "backwards" from the start edge.
2024-01-08 14:42:19 +01:00
Aliaksandr Kalenik 6480ed20b8 LibWeb: Add support for implicit grid lines formed by grid areas in GFC
According to spec each grid area implicitly defines 4 additional named
lines that could be used to specify items position.
2024-01-08 09:28:37 +01:00
Aliaksandr Kalenik 92bf7d3ba7 LibWeb: Always add "ending" line during lines init in GFC
This moves us a bit toward correctly representing two separate concepts
from the spec: lines and tracks. Lines divide the grid into tracks, so
there should always be a line concluding the last track.
2024-01-08 09:28:37 +01:00
MacDue 9c3bb94d14 LibGfx: Trim scanline to right clip in path rasterizer
There's no need to accumulate past the right clip, so we also don't need
to store it.
2024-01-08 09:26:43 +01:00
MacDue ec93973158 LibGfx: Sprinkle some FLATTEN/hot attributes in the path rasterizer
This seems to actually improve performance to the tune of about +5 fps.
2024-01-08 09:26:43 +01:00
MacDue e2152a5b3d LibGfx: Clip path rasterizer scanlines sooner
This moves the clipping from per-pixel/draw command to a step before
the main drawing/plotting loop.
2024-01-08 09:26:43 +01:00
MacDue b1adabdac4 LibGfx: Fix off-by-one in path rasterizer
The start/end is inclusive so it's + 1 to the start to fill
`full_converage_count` pixels.
2024-01-08 09:26:43 +01:00
MacDue 13a4fb0325 LibGfx: Increase bezier splitting tolerance to 0.5
No noticeable difference a bit faster. This is still arbitrary and
should be somehow derived from the curve.
2024-01-08 09:26:43 +01:00
MacDue 65b87bace9 LibGfx: Move Gfx::color_for_format() to header 2024-01-08 09:26:43 +01:00
MacDue a1bafafd78 LibGfx: Slightly simplify Color::blend()
No behaviour change.
2024-01-08 09:26:43 +01:00
Aliaksandr Kalenik 5c02b960ab LibGfx: Take into account unicode ranges to find font for space glyph
Instead of assuming that the first font in the cascade font list will
have a glyph for space, we need to find it in the list taking into
account unicode ranges.
2024-01-08 01:00:24 +01:00
Timothy Flynn 8b32f4ae7a LibWebView+WebContent: Let the WebView client broadcast when it painted
When the WebContent process has painted to its shared bitmaps, it sends
a synchronous IPC to the browser process to let the chrome paint. It is
synchronous to ensure the WC process doesn't paint onto the backing
bitmap again while it is being displayed.

However, this can cause a crash at exit if the browser process quits
while the WC process is waiting for a response to this IPC.

This patch makes the painting logic asynchronous by letting the browser
process broadcast when it has finished handling the paint IPC. The WC
process will not paint anything again until it receives that message. If
it had tried to repaint while waiting for that message, that paint will
be deferred until it arrives.
2024-01-08 00:51:59 +01:00
Lucas CHOLLET 335097e446 LibGfx/TIFF: Modify the image according to the Orientation tag
Let's use the already existing logic (ExifOrientedBitmap) to modify the
bitmap to honor the orientation tag.
2024-01-08 00:07:44 +01:00
Lucas CHOLLET 367882ae23 LibGfx: Make ExifOrientedBitmap::oriented_size be public
This will be useful for image decoders to expose the image size while
considering the orientation. A rotated image might have different
dimensions.
2024-01-08 00:07:44 +01:00
Lucas CHOLLET 34e9059ae8 LibGfx/TIFF: Honor the default value for single count tags
Some tags have a default value, we should return this value in
Metadata's getters when no value has been read from the input file.

Note that we don't support default values for tags with a count bigger
than one.
2024-01-08 00:07:44 +01:00
Lucas CHOLLET ef10a58522 LibGfx: Remove ExifOrientedBitmap::Orientation in favor of TIFF's enum
ExifOrientedBitmap was implemented before the introduction of the TIFF
decoder. So we had to provide a definition of the Orientation enum. Now
that we have a TIFF implementation that comes with some enum
definitions, we should prefer this source.
2024-01-08 00:07:44 +01:00
Lucas CHOLLET e9ebe59081 LibGUI: Render thumbnails out of process
Process separation is a great way to prevent malicious users from
getting the GUI down with image files that make one of our decoder
crash.

It also makes life easier when developing image decoders.
2024-01-07 20:10:22 +01:00
Lucas CHOLLET 4e9e340d21 IPCCompiler: Make the connection shut down if the peer disconnected
If we know that the peer disconnected while receiving a message in the
generated code, let's shutdown the connection from here instead of
forcing each client to do so.
2024-01-07 20:10:22 +01:00
Lucas CHOLLET e56eb11dee ImageDecoder: Add plumbing to allow a client to request an ideal size
This is only used for vector graphics format where requesting the true
displayed size leads to visual enhancement.
2024-01-07 20:10:22 +01:00
Lucas CHOLLET 4c23f0e142 LibCore: Log a message before failure in EventLoop::current()
If no EventLoop is present in the stack (like when you forget to create
one), a message is nicer than letting the developer go through the
stacktrace to figure out what went wrong.
2024-01-07 20:10:22 +01:00
Andreas Kling ca57e40350 LibWeb: Take padding into account when resolving border radii
Before this change, we were resolving border radii values based on
content box + border widths only, ignoring padding.
2024-01-07 19:28:38 +01:00
Lucas CHOLLET 402de2985d LibGfx/ICO: Do not try to decode a mask if we already reached EOF
When using the BMP encoding, ICO images are expected to contain a 1-bit
mask for transparency. Regardless an alpha channel is already included
in the image, the mask is always required. As stated here[1], the
mask is used to provide shadow around the image.

Unfortunately, it seems that some encoder do not include that second
transparency mask. So let's read that mask only if some data is still
remaining after decoding the image.

The test case has been generated by truncating the 64 last bytes
(originally dedicated to the mask) from the `serenity.ico` file and
changing the declared size of the image in the ICO header. The size
value is stored at the offset 0x0E in the file and I changed the value
from 0x0468 to 0x0428.

[1]: https://devblogs.microsoft.com/oldnewthing/20101021-00/?p=12483
2024-01-07 12:32:02 -05:00
Lucas CHOLLET 9c54c13744 Tests/LibGfx: Move the ICO test file to the ico directory
And add more tests on the image than just "we are able to decode it".
2024-01-07 12:32:02 -05:00
Cubic Love 8538d6e64f Base: Improve 2048 manpage 2024-01-07 16:27:39 +00:00
Cubic Love b812ccd5e8 Base: Improve 2048 Icon
Make the icon the same colors as the original game's icon. Give the
tile slightly rounded corners and subtle shading.
2024-01-07 16:27:39 +00:00
Nico Weber 701d56f7ad LibGfx/ICC: Implement LutBToATagData::evaluate() when there is no CLUT
This is enough to make these work:

    for f in VideoHD VideoNTSC VideoPAL; do
        Build/lagom/bin/icc --debug-roundtrip \
            ~/Downloads/Adobe\ ICC\ Profiles\ \(end-user\)/RGB/$f.icc
    done

It's also possible to convert images to those color spaces:

    Build/lagom/bin/image -o image-pal.png \
        --convert-to-color-profile path/to/RGB/VideoPAL.icc \
        image-srgb.png

(If there's no png file with an embedded sRGB profile at hand, do first:

    Build/lagom/bin/icc --reencode-to serenity-sRGB.icc -n sRGB
    Build/lagom/bin/image -o image-srgb.png \
        --assign-color-profile serenity-sRGB.icc image-no-color-space.png

)

In color-managed viewers, images-srgb.png and image-pal.png should
look identical.

But if you either explicitly assign the sRGB profile to the pal
image, or strip the embedded color space, they'll look different
(since image viewers then assume the image in the VideoPAL space
is in sRGB):

    Build/lagom/bin/image -o image-pal-strip.png --strip-color-profile \
        image-pal.png

    Build/lagom/bin/image -o image-not-actually-srgb.png \
        --assign-color-profile serenity-sRGB.icc image-pal.png
2024-01-07 15:42:35 +01:00
Nico Weber a75533b46b LibGfx/ICC: Add a trailing , to an initialization
No behavior change.
2024-01-07 15:42:35 +01:00
Nico Weber d17e8d1654 LibGfx/ICC: Plumb mBA conversion from profile to tag data
It's still implemented on the tag data side, so no real
behavior change.
2024-01-07 15:42:35 +01:00
Nico Weber 07fe8b8d0a icc: Add a --debug-roundtrip flag
With this, we convert a bunch of random colors to a
profile's profile connection space and back, and count
how many u8 colors make it through unchanged.

With this, you can do something like:

    for f in ~/Downloads/Adobe\ ICC\ Profiles\ \(end-user\)/*/*.icc; do
        echo $f
        Build/lagom/bin/icc --debug-roundtrip $f
    done

to test conversion through a bunch of profiles. These profiles are
available at:
https://www.adobe.com/support/downloads/iccprofiles/iccprofiles_win.html

...which ultimately leads to:
https://download.adobe.com/pub/adobe/iccprofiles/win/AdobeICCProfilesCS4Win_end-user.zip

(Or use `Build/lagom/bin/icc --debug-roundtrip -n sRGB` to test the
built-in sRGB profile.)
2024-01-07 15:42:35 +01:00
Andreas Kling 4a35693dd7 LibWeb: Improve style propagation to anonymous wrappers
- We now propagate changes in font and line-height to anonymous wrappers
  when doing a partial style update after invalidation.

- We no longer (incorrectly) propagate style from table wrapper boxes
  to the table root, since inheritance works in the other direction.

Fixes #22395
2024-01-07 14:24:38 +01:00
Daniel La Rocque 242d1d8eba LibWeb: Fail to parse cookie date when date does not exist
Previously, the cookie date validation did not validate days in the
context of the month and year, resulting in dates that do not exist to
be successfully parsed (e.g. February 31st). We now validate that the
day does not exceed the number of days for the given month and year,
taking leap years into account.
2024-01-07 08:01:58 -05:00