Commit graph

55568 commits

Author SHA1 Message Date
Aliaksandr Kalenik
04a4ffaa3d LibWeb/Painting: Remove Save and Restore commands in RecordingPainter
Removing State and Restore reduces painting commands count by 30-50%
on an average website.

Due to this change, it was also necessary to replace AddClipRect with
SetClipRect command.
2023-10-26 07:51:32 +02:00
networkException
0388766531 LibWeb: Set module map entry before invoking callbacks
This patch fixes the value of a module map entry being wrong in the
callbacks invoked in the set call. Previously we would set the value
in only after invoking the callbacks, leading to crashes when a
callback implementation would rightfully assume the value to be set
already.

Resolves #20994
2023-10-25 21:29:21 +02:00
Bastiaan van der Plaat
169d24ae2e LibWeb: Add comments and missing items of various IDL files 2023-10-25 19:45:41 +02:00
Bastiaan van der Plaat
fc46def2f5 LibWeb: Reorder and add missing HTML elements IDL items 2023-10-25 19:45:41 +02:00
Nico Weber
54cdcd0d06 LibPDF: Reject non-hexdigits in hex string with error
...instead of VERIFY()ing input data.

I haven't seen this in the wild, but since I'm here anyways,
might as well fix this.
2023-10-25 10:44:26 +02:00
Nico Weber
4675700057 LibPDF: Reject unterminated literal strings with an error
0000459.pdf in 0000.zip in the pdfa dataset contains this as the
very first object:

```
1 0 obj
<<
/Creator (Developer 2000)
/CreatorDate (
/Author (Oracle Reports)
/Producer (Oracle PDF driver)
/Title (2021_06_29 Tutoritzacions APTES.PDF)
>>
endobj
```

The `/CreatorDate` value string is unterminated.

Before, we'd assert when trying to check if the first object is
a linearization dict.

Now, we never read the first object (an error during the linearization
dict reading is treated as "file is not linearized") unless we try
to print the document's metadata -- and there we now show an error
instead of asserting.
2023-10-25 10:44:26 +02:00
Nico Weber
c0f3f1674c LibPDF: Make string literal parsing fallible
...and make running out of data after a \ an error instead of silently
returning an empty string.
2023-10-25 10:44:26 +02:00
Aliaksandr Kalenik
4318bcf447 LibWeb: Record painting commands in coordinates of stacking context
By storing painting command coordinates relative to the nearest
stacking context we can get rid of the Translate command.

Additionally, this allows us to easily check if the bounding
rectangles of the commands cover or intersect within a stacking
context. This should be useful if we decide to optimize by avoiding
the execution of commands that will be overpainted by the results of
subsequent commands.
2023-10-25 05:53:36 +02:00
Nico Weber
311cc7d9b9 LibPDF: Implement two SeparationColorSpace methods
Actually using separation color spaces still doesn't work, but we
now no longer assert on them when they're used.

Fixes 2 crashes on the `-n 500` 0000.zip pdfa dataset.
2023-10-25 05:52:47 +02:00
Tim Ledbetter
2311e28d63 LibGfx/BMPLoader: Mitigate potential overflows when decoding bitmap DIB 2023-10-25 05:52:29 +02:00
Tim Ledbetter
8ec26f3b54 LibGfx/BMPLoader: Account for header size when checking DIB bounds 2023-10-25 05:52:29 +02:00
Timothy Flynn
4e0a926737 LibWeb: Protect ad-hoc scroll against a potentially null paintable box
We perform such a check in other users of the paintable box in this file
as the box may be null before layout completes. This prevents UB seen in
some CI runs.
2023-10-25 05:49:37 +02:00
tetektoza
4db9996cc0 Minesweeper: Port to GML compilation
This patch ports minesweeper to GML compilation,
and introduces a few changes made to associated files.
2023-10-24 21:47:18 +02:00
tetektoza
1c37385904 GMLCompiler: Add enum initializer for button_style property
This patch adds missing enum initializer for button_style property in
enum initializer generator in GML compiler.
2023-10-24 21:47:18 +02:00
tetektoza
d2995f7517 LibGUI: Add missing constructor to UISize class for fixed_size property
This patch adds a missing constructor to UISize class for fixed_size
property, so the property can take an array if user specified it
in .gml file.
2023-10-24 21:47:18 +02:00
Nico Weber
e7f7c434f7 LibPDF: Don't check for startxref after trailer dict
Several files have a comment after the trailer dict and the
`startxref` after it.

We really should add a consume_whitespace_and_comments() function
and call that in most places we currently call consume_whitespace().

But in this case, for non-linearized files, we first jump to the
end of the file, read `startxref`, then jump to `xref` from the
offset there, and then read the trailer after the `xref`,
only to read `startxref` again. So we can just not do that.

(For linearized files, we now completely ignore `startxref`.
But we don't use the data in `startxref` in linearized files
anyways, so it's fine to not read it there too.)

Reduces number of crashes on 300 random PDFs from the web (the first 300
from 0000.zip from
https://pdfa.org/new-large-scale-pdf-corpus-now-publicly-available/)
from 25 (8%) to 23 (7%).
2023-10-24 13:32:01 -04:00
Nico Weber
acf668e234 LibPDF: Make Reader::move_by() parameter more truthful
No behavior change, just simpler and less surprising.
2023-10-24 13:30:25 -04:00
Aliaksandr Kalenik
b13ff8def6 LibWeb: Separate "out of view" check from RecordingPainter commands 2023-10-24 18:55:12 +02:00
Aliaksandr Kalenik
94f322867a LibWeb: Get rid of DevicePixels usage in RecordingPainter
This change removes inconsistency in coordinate representation of
painter commands by changing everything to use int.
2023-10-24 18:55:12 +02:00
Tim Schumacher
b91d03c2b8 Meta: Don't pass ^C through the serial console on CI
`-serial mon:stdio` passes through all kinds of key combinations,
`-serial stdio` doesn't. This probably isn't something that we want
while running tests or CI, so switch to the non-passing variant.

aarch64 actually failed to run due to this, since it already had
`-serial stdio` in its arguments, causing a conflict. This is why that
entry is now gone entirely.
2023-10-24 13:45:55 +02:00
Tim Ledbetter
fff1645c6b Fuzzers: Add WOFF2 fuzzer 2023-10-24 13:45:01 +02:00
Tim Ledbetter
e9be1bcd09 LibGfx/WOFF2: Reject fonts with a compressed size larger than 10MiB
This prevents a potential OOM condition when the header is malformed.
2023-10-24 13:45:01 +02:00
Tim Ledbetter
af633523af LibGfx/WOFF2: Tolerate incorrect totalSfntSize in WOFF2 header
The specification says that this value is for reference only, so we
should be able to load a file where this value is incorrect.
2023-10-24 13:45:01 +02:00
Timothy Flynn
0eaf13bae3 AK: Colorize log message for failed assertions
The log message can be hard to spot in a sea of debug messages. Colorize
it to make the message more immediately pop out.
2023-10-24 06:58:53 -04:00
Tim Schumacher
acc0fb7a47 Meta: Manually redirect CI serial output to stdout
`-nographic` additionally reconfigures the Terminal, which clears the
previous scrollback and (ocasionally) breaks line wrapping. This is
probably not something that we want, so only ask for the redirection
behavior.
2023-10-24 11:27:20 +02:00
Tim Ledbetter
03fbd6c0c8 Fuzzers: Add a fuzzer for JsonParser 2023-10-24 07:54:37 +02:00
Andrew Duerig
67ca5d6572 Meta: Update libjs.dev links to test262.fyi 2023-10-24 07:32:19 +02:00
Tim Ledbetter
cb16c217b8 Tests: Add regression tests for fixed OSS-Fuzz test cases 2023-10-24 07:30:04 +02:00
Tim Ledbetter
c62dded5cc Tests: Move image decoder test PNG to its own folder 2023-10-24 07:30:04 +02:00
Tim Ledbetter
c2112cde76 LibGfx/WOFF: Ensure header totalSfntSize matches expected value 2023-10-24 07:29:09 +02:00
Tim Ledbetter
7ee09ca49d LibGfx/WOFF: Avoid overflow in table directory search range
This commit limits `WOFF::Header::num_tables` to 4096. This limitation
is not explicitly mentioned in the specification, but allowing numbers
larger than this results in an overflow when calculating
`search_range` and `range_shift`.
2023-10-24 07:29:09 +02:00
Timothy Flynn
4c479b0aaa Ladybird/AppKit: Add a context menu item to search for the selected text 2023-10-24 07:28:30 +02:00
Timothy Flynn
66c8400384 Ladybird/Qt: Add a context menu item to search for the selected text 2023-10-24 07:28:30 +02:00
Timothy Flynn
ae6e2e682e Browser: Add a context menu item to search for the selected text 2023-10-24 07:28:30 +02:00
Timothy Flynn
6af279a22d LibWebView: Add a helper to get selected text with collapsed whitespace 2023-10-24 07:28:30 +02:00
Timothy Flynn
e221b3afeb LibWebView: Add an API to format a search query for UI display
This will create a string of the form:

    Search DuckDuckGo for "Ladybird is awesome!"

If the provided query URL is unknown, the engine name is excluded (e.g.
for custom search URLs).
2023-10-24 07:28:30 +02:00
Timothy Flynn
c8c3d00615 LibWebView: Rename find_search_engine to find_search_engine_by_name
We will also need to search by URL in the Serenity chrome.
2023-10-24 07:28:30 +02:00
Bastiaan van der Plaat
d5ca8209bf LibWeb: Add input element valueAsNumber 2023-10-24 07:27:14 +02:00
Bastiaan van der Plaat
d290569535 LibWeb: Don't create shadow root for input hidden 2023-10-24 07:27:14 +02:00
Bastiaan van der Plaat
3e778fe29c LibWeb: Reorder and add missing form elements IDL items 2023-10-24 07:27:14 +02:00
Aliaksandr Kalenik
4dab17427f LibWeb: Use max content contribution in flex_fraction in GFC
As spec comment in the code says we should use item’s max-content
contribution to calculate flex fraction.

Likely, it was calculate_max_content_size() because we didn't have
calculate_max_content_contribution() when this function was implemented
initially.
2023-10-24 07:26:25 +02:00
Aliaksandr Kalenik
802b58d7e1 LibWeb: Resolve grid item's min-width and max-width in GFC
Now min-width and max-width properties affect resulting width of grid
item instead of being ignored.
2023-10-24 07:25:20 +02:00
Tim Ledbetter
db929e0fcf Kernel/Ext2: Avoid overflow when updating UID and GID values
Previously, attempting to update an ext2 inode with a UID or GID
larger than 65535 would overflow. We now write the high bits of UIDs
and GIDs to the same place that Linux does within the `osd2` struct.
2023-10-24 07:21:11 +02:00
Adrian Mück
7e10f76021 LibGUI: Don't update ComboBox text when model index is invalid
Without ENABLE_TIME_ZONE_DATA the user is able to update the time zone
selection when using "on_mousewheel" or "on_{up,down}_pressed" even
though UTC is supposed to be the only option. Due to an invalid model
index, the selection is set to "[null]".

Prior to this patch, the ComboBox text in "selection_updated" is set
at each call.
2023-10-23 21:18:36 -04:00
Andrew Kaster
3b733ff7bc WPT: Update metadata for current WPT master and ladybird results 2023-10-24 01:43:31 +02:00
Andrew Kaster
5a334ae958 WPT: Update to latest master and remove unnecessary patch 2023-10-24 01:43:31 +02:00
Andrew Kaster
4522c82459 Meta: Add gn build for the MacPDF application 2023-10-23 15:25:24 -06:00
Andrew Kaster
967ccd2be8 Meta: Add gn build for LibPDF 2023-10-23 15:25:24 -06:00
Andrew Kaster
10298f1e9a Meta: Move invoke_process_with_args.py to common location
This script was already used by both Ladybird and the Kernel, so move it
into Meta/gn/build instead.
2023-10-23 15:25:24 -06:00
Timothy Flynn
00826b2512 BrowserSettings: Use index column when casting to a search engine field
Regressed in e8d921820a.

I must've run an old version of the Serenity image when I tested this
after a fixup.
2023-10-23 13:36:48 -04:00