Commit graph

58277 commits

Author SHA1 Message Date
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 aab3cd33f6 Meta/run.py: Fix grammar in method names
"Setup" is the noun, "to set up" is the verb.

No behavior change.
2024-01-16 09:55:42 -05: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
Sam Atkins aeed1e04ca HackStudio: Make Files and Classes tabs have the same border width
This is something I messed up, back in
77ad0fdb07. Oops!
2024-01-16 15:23:07 +01:00
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
Sam Atkins dd9f3c980f HackStudio: Absolutize project paths before opening them
Relative paths cause issues in a couple of ways:
- `open_project()` sets the working directory to that path, and then
  opens a project at that same path. This means opening `./foo` goes to
  `./foo`, and then tries to open `./foo/foo`.
- Even with that rearranged, we would then have issues with trying to
  open files, because again we would try to open `./foo/foo/file`
  instead of `./foo/file`.
- The relative path would get saved in "Recent Projects" which is wrong.

Absolutizing the path before using it means we avoid these issues, and
without having to rearchitect everything. :^)
2024-01-16 12:39:28 +01:00
Sam Atkins 6db4d3b898 HackStudio: Remove UTF-8 validation for project path 2024-01-16 12:39:28 +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 cac66aeb53 mktemp: Use ByteString for paths 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
Nico Weber a7fbb7fd0b MacPDF: Make Debug menu work when sidebar has focus 2024-01-15 23:24:07 -07:00
Nico Weber a4b5b9e82a MacPDF: Unbreak Go to Next/Previous Page after #22768 2024-01-15 23:24:07 -07: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
Lucas CHOLLET 015c47da51 Tests/LibGfx: Use TRY_OR_FAIL more in TestImageDecoder 2024-01-15 23:16:57 -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 7fcce6b6c4 Meta/run.py: Move arguments_generator() out of class
@staticmethod decorators seem to not work in 3.9. Just move
arguments_generator() to the toplevel.
2024-01-15 23:15:30 -07:00
Nico Weber a659d7a4c2 Meta/run.py: Use if/elif instead of match
Less code, less indentation, and works with Py3.9.

(In return, the checked variable name is repeated in each conditional.)
2024-01-15 23:15:30 -07:00
Kemal Zebari b7dbdb4cd2 cksum: Print checksums as decimal rather than hexadecimal
POSIX and the implementations I see expect checksum to be printed
just as an unsigned integer.
2024-01-15 23:08:28 -07:00
Kemal Zebari 09a053a723 cksum: Handle edge case when no file operands are given when printing
Given no file operands, POSIX wants us to read from stdin as well
as omit "the pathname and its leading <space>" when printing.
2024-01-15 23:08:28 -07:00
Kemal Zebari 5d07c56d0d cksum: Decouple printing logic from checksum construction
This is to avoid duplicating the printing logic and so that we can
have an alternative way of printing the result (i.e. for the next
commit that will print without a pathname if no file operands were
provided). This also has us avoid the algorithm checks in the for
loop.
2024-01-15 23:08:28 -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
Nico Weber 398f34bb81 Ladybird/AppKit/CMake: Use a more civilized way of finding Cocoa
Finding Cocoa.framework is the linker's job, not CMake's.

No behavior change.
2024-01-15 11:18:55 -07:00
Nico Weber d324517ed7 Ladybird/AppKit: The "Window" menu should be called "Window"
...not "Windows".
2024-01-15 12:15:16 -05:00
Nico Weber 36bdf45f36 Meta: Port recent changes to the GN build
Ports de32b77ceb.
2024-01-15 12:15:16 -05:00
Nico Weber 2650e64bd4 MacPDF: Add a "Debug" menu with a "Show Clipping Paths" entry
...and hook it up.

I opened MainMenu.xib in Xcode, added a new "Submenu Menu Item"
from the Library (cmd-shift-l), added a User Defined
"toggleShowClippingPaths:" action on First Responder and connected
the menu item's action to that action.

(I first tried duplicating the existing Window menu and editing that,
but the Window menu is marked as `systemMenu="window"` in the xib and
I couldn't find a way to undo that in Xcode. So the Debug menu first
acted as a second Window menu.)

I made "Debug" a toplevel menu to make it consistent with Ladybird.app
for now, but I'll probably make it a submenu of "View" in the future.
2024-01-15 11:59:20 -05: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
Aliaksandr Kalenik 6087d2feec LibGfx+LibWeb: Do not ignore corner radius if it is defined in one axis 2024-01-15 15:21:17 +01:00
Sönke Holz 1ab4135975 LibC: Pass arguments correctly to sigprocmask in setjmp for riscv64
For some reason I decided to change the argument passing order before
submitting my PR, but this would cause the oldset argument to always
be 0x74 as a0 is overridden with 0 in that order.
2024-01-15 14:34:15 +01:00