Commit Graph

58100 Commits

Author SHA1 Message Date
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
Aliaksandr Kalenik
cc447c9c80 LibWeb+WebContent: Move paint recording init into Navigable
This refactoring makes WebContent less aware of LibWeb internals.
The code that initializes paint recording commands now resides in
`Navigable::paint()`. Additionally, we no longer need to reuse
PaintContext across iframes, allowing us to avoid saving and restoring
its state before recursing into an iframe.
2024-01-15 14:33:56 +01:00
Andreas Kling
72dd37438d LibWeb: Treat flex item cross axis max-size as "none" in more cases
There are a bunch of situations where we need to treat cross axis
max-size properties as "none", notably percentage values when the
reference containing block size is an intrinsic sizing constraint.

This fixes an issue where flex items with definite width would get
shrunk to 0px by "max-width: 100%" in case the item itself is an
SVG with no natural width or height.

For consistency, we now use the should_treat_max_width/height_as_none
helpers throughout FFC.

This makes the search/account/cart icons show up in the top right
on https://twinings.co.uk :^)
2024-01-15 12:55:47 +01:00
Nico Weber
9a93f677f4 LibPDF: Mark text rendering matrix as dirty after TJ numbers
Mostly because I audited all places that assigned to `m_text_matrix`
after #22760.

This one is very difficult to trigger in practice.

`show_text()` marks the text rendering matrix dirty already,
so this only has an effect if the `TJ` array starts with a
number, and the matrix isn't marked dirty going in.

`Tm` caches the text rendering matrix, so I changed text.pdf
to contain:

```
1 0 0 1 45 130 Tm
[ 200 (Hello) -2000 (World) ] TJ T*
```

This first sets an x offset of 5 (on top of the normal 40), and
then undoes it (`200` is multiplied by font size (25) / -1000,
and `200 * 25 / -1000` is -5). Before this change, the topmost
"Hello World" ended up slightly indented.

Likely no behavior change in practice, but makes the code easier
to understand, and maybe it helps in the wild somewhere.
2024-01-15 08:39:04 +00:00
Nico Weber
f23f5dcd62 LibPDF: Mark text rendering matrix dirty for Td operator
0000342.pdf page 5 contains this snippet:

```
/T1_1 10.976 Tf
0 -31.643 TD
(This)Tj

1 0 0 1 54 745.563 Tm
22.181 -31.643 Td
[(vehicle)-270.926(uses)...
```

The `Tm` marked the text rendering matrix as dirty at the start,
but it then calls calculate_text_rendering_matrix() almost in the
next line, which recalculates the text rendering matrix and caches
the new matrix. The `Td` used to not mark it as dirty, and we'd
draw "vehicle" with an incorrect matrix.
2024-01-15 08:37:55 +00:00
Aliaksandr Kalenik
7c2713c14f LibWeb: Move set_needs_display() from layout node to paintable
For this method, there is no need to go through the layout node when we
can directly reach the paintable.
2024-01-15 09:00:35 +01:00
Aliaksandr Kalenik
814bed33b4 LibWeb: Move box_type_agnostic_position() from layout node to paintable
For this method, there is no need to go through the layout node when we
can directly reach the paintable.
2024-01-15 09:00:35 +01:00
Aliaksandr Kalenik
31e5b5f5de LibWeb: Use paintable to represent event tracking node
The use of layout nodes likely predated the paintable tree, but now
there is no point in introducing another level of indirection.
2024-01-15 09:00:35 +01:00
Sam Atkins
ad59fb7cf0 HackStudio: Make Editor ask Debugger if a breakpoint was added/removed
Rather than adding/removing a breakpoint indicator, and then telling the
debugger about it and hoping it works, let the debugger tell us if it
succeeded and then use that to update the indicator.

This prevents the user from adding breakpoints to invalid locations
while the debugger is running. It also avoids a couple of scary
VERIFY()s. We still allow creating breakpoints in invalid locations
while the debugger is *not* running.
2024-01-14 18:48:41 -07:00
Shannon Booth
3910efb80b LibWeb: Implement Element.removeAttributeNS 2024-01-14 16:10:18 -07:00
Shannon Booth
7a26a889cb LibWeb: Implement Element.getAttributeNodeNS 2024-01-14 16:10:18 -07:00
Shannon Booth
a7316d3641 LibJS: Update Temporal RoundDuration AO to some spec changes
This commit effectively just does a bulk update of this function to the
spec. Since there have been so many spec changes, no specific change was
made in mind, and many FIXMEs have been left for where we are still out
of date.

These changes also appear to include a normative change to the temporal
spec which was previously resulting in timeouts for some tests, and is
now resulting in a timeout.

Furthermore, this also resolves some crashes by protecting against
division by zero, instead throwing a RangeError. This can only happen
when a custom calender is provided which returns funky values. See:

https://github.com/tc39/proposal-temporal/commit/ed85e9

Diff Tests:
    +8     -4 💀    -4 💥
2024-01-14 16:08:52 -07:00
Shannon Booth
83b84cf0bd LibJS: Implement Temporal AO DifferenceDate 2024-01-14 16:08:52 -07:00
Shannon Booth
a372a16b2c LibJS: Improve const-correctness of CalendarDateUntil 2024-01-14 16:08:52 -07:00
Shannon Booth
23c5a7a0a3 LibJS: Expose const prototype getter in Object
This is used in the temporal proposal in an assertion.
2024-01-14 16:08:52 -07:00
Shannon Booth
9f7e27564c LibJS: Catch up DifferenceTemporalPlainYearMonth somewhat to the spec
The spec has moved along quite a bit since this was originally
implemented. Catch up on at least some of these changes, and leave
FIXMEs for what is missing.

No change to test262.
2024-01-14 16:08:52 -07:00
Shannon Booth
d2710ad73f LibJS: Implement temporal AO SnapshotOwnProperties 2024-01-14 16:08:52 -07:00
Shannon Booth
107fa1fdb8 LibJS: Implement excluded values in CopyDataProperties
This is a change to this AO as part of the Temporal proposal.
2024-01-14 16:08:52 -07:00
Sönke Holz
a504d76b14 LibC: Implement setjmp and longjmp for riscv64
The assembly implementation is based on the x86_64 version.
2024-01-14 16:06:59 -07:00
Dan Klishch
5825eaa264 JSSpecCompiler: Save references to return value and function arguments 2024-01-14 16:05:51 -07:00
Dan Klishch
7f47340c82 JSSpecCompiler: Create FunctionDeclarations for all external functions 2024-01-14 16:05:51 -07:00
Dan Klishch
5338cdd153 JSSpecCompiler: Add bare-bones DCE pass
Right now the only dead code it eliminates is the unused phi nodes.
2024-01-14 16:05:51 -07:00
Andrew Kaster
162c334508 Revert "Assistant: Check for access before showing results"
This reverts commit 7c88ab2836.

Post-merge review revealed that the checks added in this PR prevent
any and all non-executable files from being displayed in Assistant,
which is a regression from intended functionality.
2024-01-14 15:51:32 -07:00
Hugh Davenport
7dba28fce8 MasterWord: Add fullscreen option
Required allowing resizing. Perhaps an additional setting to allow
fullscreen, but not resizing? Anyhow, the game still plays well if
you can resize and works as expected.
2024-01-14 15:18:43 -07:00
Hugh Davenport
5f56c946c2 SQLStudio: Add fullscreen option 2024-01-14 15:18:43 -07:00
Hugh Davenport
e6d0239c23 Settings: Add fullscreen option 2024-01-14 15:18:43 -07:00
Hugh Davenport
7fa0cf194f Applications: Add fullscreen option to Utilities 2024-01-14 15:18:43 -07:00
Hugh Davenport
8886324cbf Applications: Add fullscreen for Office category 2024-01-14 15:18:43 -07:00