1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 06:15:07 +00:00
Commit graph

23102 commits

Author SHA1 Message Date
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
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
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
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
Aliaksandr Kalenik
9b7b97b2f6 LibWeb/CSS: Revert to PercentageOr::resolve() to be templated
In 4bc38300ad this function was modified
to accept only Angle instead of being templated, with the purpose of
preventing Length from being passed.

This change reverts the function to being templated but adds a
constraint specifically forbidding Length. This adjustment will allow
for the future use of Frequency, Number, Time, etc., if we would want.
2024-01-07 13:16:02 +01:00
Bastiaan van der Plaat
be7538961b LibWeb: Add DOMMatrix string constructor and set matrix value 2024-01-07 13:15:53 +01:00
Aliaksandr Kalenik
903d3c92c8 LibWeb: Support auto-fill for rows in GFC
This change fixes the function that calculates the number of auto-fill
tracks, ensuring it uses height when applied to rows, instead of
assuming that it always operates on columns.
2024-01-07 11:12:35 +01:00
Bastiaan van der Plaat
52397d01bd LibWeb: Add textarea placeholder 2024-01-07 10:22:32 +01:00
Bastiaan van der Plaat
091faf1aae LibWeb: Add textarea value properties 2024-01-07 10:22:32 +01:00
Bastiaan van der Plaat
e33ae9a58b LibWeb: Improve media document styling to center image 2024-01-07 10:16:24 +01:00
Aliaksandr Kalenik
042d3b79c2 LibWeb: Remove get_count_of_tracks() in GFC
This method is not needed, as we calculate the number of tracks in the
first step of grid layout by expanding the track definitions.
2024-01-07 09:57:13 +01:00
Aliaksandr Kalenik
a32046ea50 LibWeb: Fix auto-fill track counting to correctly handle gaps in GFC
Fixes the mistake that gaps are counted as if they exist after each
track, when actually gaps are present only between tracks.

Visual progression on https://kde.org/products/
2024-01-07 09:57:13 +01:00
Aliaksandr Kalenik
39abd9095e LibWeb: Return CSSPixels from calculate_inner_height()
Similar to calculate_inner_width(), let's make the caller responsible
for handling "auto" instead of returning the input height as is when
when it cannot be resolved.
2024-01-07 09:03:57 +01:00
Aliaksandr Kalenik
05a1dbeb91 LibWeb: Return CSSPixels from calculate_inner_width()
Initially, this function was made to return CSS::Length because some of
its callers were expecting it to ignore "auto" width on input and
return it as is. Instead, let's just forbid using "auto" for input
width and always return CSSPixels.
2024-01-07 09:03:57 +01:00
Aliaksandr Kalenik
4bc38300ad LibWeb: Forbid using CSS::Length as reference value in resolved()
CSSPixels should not be wrapped into CSS::Length before being passed
to resolved() to end up resolving percentages without losing
precision.

Fixes thrashing layout when 33.3333% width is used together with
"box-sizing: border-box".
2024-01-07 09:03:57 +01:00
Andreas Kling
d26ad8450f LibGfx/OpenType: Read the correct number of pairs from kern table
We were trying to read exactly 5 pairs for some reason, instead of the
number specified by the format 0 header.

Fixing this makes "OpenSans Condensed" load on my machine.
2024-01-06 23:22:52 +01:00
Aliaksandr Kalenik
e7eaf3b566 LibWeb: Remove rounding division for CSSPixels
Reverts 98926b487c
that regressed: block-and-inline/small-percentage-margin.html
(thrashing layout while window resizing)

Fixes https://github.com/SerenityOS/serenity/issues/22610
2024-01-06 21:40:27 +01:00
Timothy Flynn
9218b2f3ce LibGUI: Add a MessageBox type to reveal a file
This will be used by Ladybird to open a screenshot's containing folder.
2024-01-06 20:11:12 +00:00
Andreas Kling
cc88a2657d LibWeb: Resolve grid item vertical margin/padding against CB width
Percentage vertical margin and padding values are relative to the
containing block *width*, not *height*. This has to be one of the most
commonly recurring mistakes we make :^)
2024-01-06 21:06:21 +01:00
david072
df3e6174b6 LibCore/DateTime: Add more binary operators 2024-01-06 10:37:53 -07:00
david072
985db495be LibCore/DateTime: Add helper for setting only the date from another date 2024-01-06 10:37:53 -07:00
david072
251e5fb074 LibCore/DateTime: Add a helper for setting the time individually 2024-01-06 10:37:53 -07:00
david072
8e77c72a5c LibGUI: Add a date picker dialog
This adds a simple date picker dialog using the existing GUI::Calendar.
2024-01-06 10:37:53 -07:00
david072
039114b728 Calendar: Move MonthListModel into Calendar.h
Previously, we had two versions of MonthListModel for the AddEventDialog
and the DatePickerDialog. Now, a unified version is in the Calendar.h
file, which can be used easily by anyone. Since that model and the
MeridiemListModel weren't used anymore in the AddEventDialog, I have
also removed them from there.
2024-01-06 10:37:53 -07:00
Andrew Kaster
5ed334e13a Userland: Fix compile errors from merging a PR without re-running CI
Hands have been slapped, more CI buttons should be pushed now D:
2024-01-06 10:27:24 -07:00
Bastiaan van der Plaat
0dd5aa40a8 LibWeb: Allow input color to give continuous updates 2024-01-06 10:02:15 -07:00
Bastiaan van der Plaat
cf69fd0a09 LibWeb: Add input element valueAsDate property 2024-01-06 09:59:30 -07:00
Bastiaan van der Plaat
be511fdcf7 LibWeb: Fix is valid time not possible compare bug 2024-01-06 09:59:30 -07:00
Cubic Love
6bde5a1f85 LibGUI: Make AboutDialog Copyright 2018-2024
Happy New Year everyone!
2024-01-06 16:42:57 +00:00
Dan Klishch
61d82e36b6 LibGUI: Make old register_property a private method of Object 2024-01-06 09:15:37 -07:00
Dan Klishch
1f4b15dcaa LibGUI: Port rest of the classes to property deserializers 2024-01-06 09:15:37 -07:00
Dan Klishch
bd56d2f508 LibGUI: Use property deserializers in macros for registering properties 2024-01-06 09:15:37 -07:00
Dan Klishch
1689ec9100 LibGUI: Introduce property deserializers for GML property values 2024-01-06 09:15:37 -07:00
hanaa12G
3c52c25515 LibC: Implement getgrgid_r() and getgrnam_r()
We currently don't have those 2 functions so let's add them
2024-01-06 04:59:50 -07:00