Commit graph

22555 commits

Author SHA1 Message Date
Lucas CHOLLET
edffdc35a9 LibGfx/TIFF+CCITT: Clarify naming of compression type 2
Type 2 <=> One-dimensional Group3, customized for TIFF
Type 3 <=> Two-dimensional Group3, uses the original 1D internally
Type 4 <=> Two-dimensional Group4

So let's clarify that this is not Group3 1D but the TIFF variant, which
is called `CCITTRLE` in libtiff. So let's stick with this name to avoid
confusion.
2024-01-18 14:00:56 +01:00
Lucas CHOLLET
9b50b5793b LibGfx/TIFF: Factorize code to verify that CCITT images are correct 2024-01-18 14:00:56 +01:00
Lucas CHOLLET
a9a5ca6754 LibGfx/TIFF: Expose default value for numerical tags too
Due to the integer -> bool conversion rule, the condition was wrong. We
actually want to test for a not `None` state.
2024-01-18 14:00:56 +01:00
Bastiaan van der Plaat
5f5ac48908 LibWeb: Format all .idl files to use four space indentation 2024-01-18 14:00:06 +01:00
Nicolas Ramz
534eeb6c4b LibGfx/ILBMLoader: Properly display images with a bitplane mask
Images with a display mask ("stencil" as it's called in DPaint) add
an extra bitplane which acts as a mask. For now, at least skip it
properly. Later we should render masked pixels as transparent, but
this requires some refactoring.
2024-01-18 13:59:17 +01:00
Tim Ledbetter
d186582d30 LibAudio: Avoid UAF when loading WAV metadata 2024-01-17 16:09:59 -05:00
Bastiaan van der Plaat
dc2233ef7a Ladybird+WebContent: Add chrome command line and exe path passing 2024-01-17 17:32:05 +01:00
Aliaksandr Kalenik
a22ef086f5 LibWeb/CSS: Support calc() in grid placement values
Fixes reduction in https://github.com/SerenityOS/serenity/issues/22802
but does not result in visual improvement on https://kotlinlang.org/
2024-01-17 17:26:55 +01:00
Aliaksandr Kalenik
c254de3509 LibWeb: Remove duplicated code in grid auto track counting
This refactoring simplifies the resolution of minimum and maximum sizes
during the counting of auto tracks.

No changes in behavior are intended.
2024-01-17 17:25:58 +01:00
Andreas Kling
954c4496b1 LibWeb: Avoid more UsedValues hash lookups in BFC and IFC 2024-01-17 17:25:48 +01:00
Andreas Kling
7a34f1a4e2 LibWeb: Add pointer from BFC::FloatingBox to its UsedValues
This will allow us to skip a lot more hash lookups.
2024-01-17 17:25:48 +01:00
Andreas Kling
57fd494195 LibWeb: Use UsedValues containing block pointer in float layout 2024-01-17 17:25:48 +01:00
Andreas Kling
80ccfc51c2 LibWeb: Use UsedValues containing block pointer in many FC helpers 2024-01-17 17:25:48 +01:00
Andreas Kling
8e31bfb83c LibWeb: Give UsedValues a pointer to containing block UsedValues
This will allow us to skip hash lookups when traversing the containing
block chain and looking at everyone's UsedValues.
2024-01-17 17:25:48 +01:00
Aliaksandr Kalenik
0a09ff698f LibWeb: Fix accounting for gaps in auto-fit count calculation in GFC
Fixes a bug where gaps between repeated tracks were accounted for only
once instead of multiple times, corresponding to the repeat count.

Fixes https://github.com/SerenityOS/serenity/issues/22823
2024-01-17 15:15:06 +01:00
Nico Weber
13f007aadb LibPDF: Tweak vertical position of truetype fonts
The vertical coordinates for truetype fonts are different somehow.
We compensated a bit for that; now we compensate some more.

This is still not 100% perfect, but much better than before.
2024-01-17 08:44:07 +00:00
Nico Weber
1845a406ea LibPDF: Add debug settings for clipping paths and images 2024-01-17 08:42:56 +00:00
Nico Weber
2d8a22f4b4 LibPDF: Clip images too
Since we can't clip against a general path yet, this clips images
against the bounding box of the current clip path as well.

Clips for images are often rectangular, so this works out well.

(We wastefully still decode and color-convert the entire image.
In a follow-up, we could consider only converting the unclipped
part.)
2024-01-17 08:42:56 +00:00
Nico Weber
5615a2691a LibPDF: Extract activate_clip() / deactivate_clip() functions
No behavior change.
2024-01-17 08:42:56 +00:00
MacDue
d55867e563 LibPDF: Fix paths with negatively sized re (rect) commands
Turns out the width/height in a `re` command can be negative. This
results in rectangles with different winding orders. For example, a
negative width results in a reversed winding order.

Previously, this was lost by passing the rect through an
`AffineTransform` before constructing the path. So instead, this
constructs the rect path, and then transforms the resulting path.
2024-01-16 21:31:20 +00:00
Aliaksandr Kalenik
6a4dd8fa47 LibWeb: Account for gaps in grid container's intrinsic size calculation
Fixes https://github.com/SerenityOS/serenity/issues/22804
2024-01-16 21:54:23 +01:00
Aliaksandr Kalenik
f529188fb8 LibWeb: Resolve CSS transform lengths against padding rect
Fixes https://github.com/SerenityOS/serenity/issues/22797
2024-01-16 21:54:10 +01:00
Aliaksandr Kalenik
ef0c390b79 LibWeb: Resolve CSS transform properties during layout commit
Now, instead of resolving "transform" and "transform-origin" during the
construction of the stacking context tree, we do so during the layout
commit.

This is part of a refactoring effort to make the paintable tree
independent from the layout tree.
2024-01-16 21:54:10 +01:00
Nico Weber
0e91682283 LibPDF: Be more forgiving about trailing image data
The predictor code assumed that all stream data is image data
(...which would make sense: trailing data there is wasted space).

But some PDFs have trailing data there, e.g. 0000257.pdf, so be
forgiving about it.
2024-01-16 09:55:11 -05:00
hanaa12G
55b971e133 LibVT: Emit different sequences while in keypad application mode 2024-01-16 17:55:17 +03:30
hanaa12G
dea61d95db LibVT: Mask out keypad keys while in keypad application mode 2024-01-16 17:55:17 +03:30
hanaa12G
d6c8b4d279 LibVT: Adjust some method names to align with documentation
Align DECKPAM and DECKPNM method names with those from
https://vt100.net/docs/vt100-ug/chapter3.html#DECKPAM
2024-01-16 17:55:17 +03:30
Andreas Kling
2d50dee920 LibWeb: Use correct max-size in intrinsic sizing of column flex layout
Regressed in 72dd37438d
2024-01-16 13:14:00 +01:00
Aliaksandr Kalenik
9e23503c9c LibWeb: Align with spec "stretch auto tracks" step in GFC
Now, we will evenly distribute the remaining free space across tracks
using the auto max-tracks sizing function, exactly as the specification
states. Many tests are affected, but they are not visually broken.

Fixes https://github.com/SerenityOS/serenity/issues/22798
2024-01-16 13:13:47 +01:00
Andreas Kling
92b6edb35a LibWeb: Go directly from DOM node to paintable in cursor blink timer
No need to go via the layout tree anymore.
2024-01-16 12:02:02 +01:00
Sam Atkins
8d80841e9c LibFileSystem+Everywhere: Return ByteString from read_link() 2024-01-16 08:42:34 +00:00
Sam Atkins
56c5ffe398 LibFileSystem+Userland: Return ByteString from real_path() 2024-01-16 08:42:34 +00:00
Sam Atkins
cdf17efb9a LibFileSystem+Userland: Return ByteString from absolute_path() 2024-01-16 08:42:34 +00:00
Sam Atkins
fb644d08ac LibFileSystem+Everywhere: Return ByteString current_working_directory()
That is, return it *from* current_working_directory(), but I didn't have
room. :^)
2024-01-16 08:42:34 +00:00
kleines Filmröllchen
eb305c6974 LibGfx: Simplify ISOBMFF enums with RIFF ChunkID
RIFF ChunkID can (and should) be used as "just" a FourCC type, which
simplifies this code greatly.
2024-01-15 23:23:26 -07:00
kleines Filmröllchen
19a1369a70 LibGfx: Use LibRIFF for WebP loading 2024-01-15 23:23:26 -07:00
kleines Filmröllchen
60c3a1a77b LibGfx: Use LibRIFF for IFF parsing 2024-01-15 23:23:26 -07:00
kleines Filmröllchen
64598473cc LibRIFF: Rework to match LibGfx needs
There's now two namespaces, RIFF (little-endian) and IFF (big-endian)
which (for the most part) contain the same kinds of structures for
handling similar data in both formats. (They also share almost all of
their implementation) The main types are ChunkHeader and (Owned)Chunk.
While Chunk has no ownership over the data it accesses (and can only be
constructed from a byte view), OwnedChunk has ownership over this data
and is aimed at reading from streams.

OwnedList, implementing the standard RIFF LIST type, is currently only
implemented for RIFF due to its only user being WAV, but it may be
generalized in the future for use by IFF.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2024-01-15 23:23:26 -07:00
kleines Filmröllchen
d125d16287 LibAudio+LibRIFF: Move general RIFF handling to LibRIFF
This splits the RIFFTypes header/TU into the WAV specific parts, which
move to WavTypes.h, as well as the general RIFF parts which move to the
new LibRIFF.

Sidenote for the spec comments: even though they are linked from a site
that explains the WAV format, the document is the (an) overall RIFF spec
from Microsoft. A better source may be used later; the changes to the
header are as minimal as possible.
2024-01-15 23:23:26 -07:00
Nico Weber
b34509edd2 LibPDF: Make pdf --dump-contents handle \r line endings better
Previously, all page contents ended up overprinting a single line
over and over for PDFs that used only `\r` as line ending.

This is for example useful for 0000364.pdf.
2024-01-15 23:16:45 -07:00
Nico Weber
9f9dbb325b LibPDF: Make prediction filters error on user-controlled alloc OOM 2024-01-15 23:06:06 -07:00
Nico Weber
93f5420282 LibPDF: Start implementing the TIFF predictor
This codepath is separate from the predictor in the TIFF decoder.
The TIFF decoder currently does bits->Color conversion before
processing the predictor. That doesn't fit the PDF model where
filters are processed before converting streams into bitmaps.

If this code here ever grows to handle all cases, maybe we can move
it over to the TIFF decoder and then make it do predictions before
decoding to colors, to share this code.

(TIFF prediction is pretty messy since it's bits-per-pixel-dependent.
PNG prediction is always byte-based, which makes things easier.)
2024-01-15 23:06:06 -07:00
Nico Weber
cf95910ae2 LibGfx/JPEG: Simplify loops walking all pixels in all macroblocks
When we want to walk everything, we can just do a linear walk.

No behavior change.
2024-01-15 23:04:56 -07:00
Nico Weber
5efe38ccd7 LibGfx/JPEG: Remove a silly initializer
SamplingFactors already has default initializers for its field,
so no need to have an explicit one for the first of the two fields.

No behavior change.
2024-01-15 23:04:56 -07:00
Andreas Kling
58b5181364 LibWeb: Skip select element internal shadow tree update unless it exists
This fixes a crash seen on https://www.gaslightanthem.com/
2024-01-15 23:45:02 +01:00
Nico Weber
6713ed483b LibGfx/PNG: Spec comment for PNGImageDecoderPlugin::unfilter_scanline()
Every time I read this, I'm like "wait, this does the wrong thing for
images with bpp != 8". It doesn't, though.
2024-01-15 23:42:45 +01:00
Nico Weber
fbde901614 LibGfx: Use read_effective_chunk_size() in skip_segment()
We missed this one in d184e6014ccd8.

No behavior change in valid JPEGs. No silent underflow in invalid ones.
2024-01-15 19:46:03 +00:00
Nico Weber
3616d14c80 LibGfx/JPEG: Allow decoding more subsampling factors
We now allow all subsampling factors where the subsampling factors
of follow-on components evenly decode the ones of the first component.

In practice, this allows YCCK 2111, CMYK 2112, and CMYK 2111.
2024-01-15 11:20:11 -07:00
Nico Weber
d99d086da3 LibGfx/JPEG: Move subsample-undoing to a separate function
Previously, we handled sampling factors as part of ycbcr_to_rgb().
That meant it worked ok for code paths that used YCbCr ("normal"
jpegs, and the YCC part of YCCK jpegs), but it didn't work for
example for the K channel in YCCK jpegs, nor for CMYK.

By making this a separate pass, it should now work for all cases.
It also makes it easier to support more subsampling arrangements
in the future, and to use something better than nearest neighbor
for upsampling subsampled blocks.
2024-01-15 11:20:11 -07:00
Aliaksandr Kalenik
64a48065b0 LibWeb: Check if corners have radius after converting to device pixels
Check needs to happen after conversion because non-zero radius in
CSSPixels could turn into zero in device pixels.

Fixes https://github.com/SerenityOS/serenity/issues/22765
2024-01-15 15:21:17 +01:00