Commit graph

52240 commits

Author SHA1 Message Date
Nico Weber 9fb0de1cfe AK: Mark Error nodiscard
...instead of manually marking all methods returning Error nodiscard.

No real behavior change.
2023-07-12 17:03:07 +02:00
Daniel Bertalan cfadbcd950 AK: Work around Xcode 15 beta mishandling trailing requires clauses
Xcode 15 betas 1-3 lack https://reviews.llvm.org/D135772, which fixes a
bug that causes trailing `requires` clauses to be evaluated twice,
failing the second time. Reported as FB12284201.

This caused compile errors when instantiating types derived from RefPtr:
> error: invalid reference to function 'NonnullRefPtr': constraints not
> satisfied
> note: because substituted constraint expression is ill-formed: value
> of type '<dependent type>' is not contextually convertible to 'bool'.

This commit works around the issue by moving the `requires` clauses
after the template parameter list.

In most cases, trailing `requires` clauses and those specified after the
template parameter list work identically, so this change should not
impact the code's behavior. The only difference is that trailing
requires clauses are evaluated *after* constrained placeholder types
(i.e. `Integral auto i` function parameter).
2023-07-12 15:43:18 +01:00
Aliaksandr Kalenik 3661d674ae LibJS: Add optimized GetGlobal instruction to access global variables
Using a special instruction to access global variables allows skipping
the environment chain traversal for them and going directly to the
module/global environment. Currently, this instruction only caches the
offset for bindings that belong to the global object environment.
However, there is also an opportunity to cache the offset in the global
declarative record.

This change results in a 57% increase in speed for
imaging-gaussian-blur.js in Kraken.
2023-07-12 16:03:16 +02:00
Aliaksandr Kalenik a27c4cf63c LibJS: Add modification counter in DeclarativeEnvironment
This counter is incremented whenever a mutating operation occurs
within the environment's set of bindings.

It is going to be used by GetGlobal instruction to correctly invalidate
cache when global declarative environment is mutated.
2023-07-12 16:03:16 +02:00
Aliaksandr Kalenik b0a533dbc0 LibJS: Identify global variables during parsing
Identifying global variables during parsing will make it possible to
generate special optimized instruction to access them in upcoming
changes.
2023-07-12 16:03:16 +02:00
Sebastian Zaha 73f1c7a030 LibWeb: Remove many redundant SVGUseElement clone calls
This prevents SVG elements referenced by "use" being repeatedly cloned
in many redundant cases. Pages that use a large svg "sprite" that then
is referenced many times with "use" elements would load extremely
slowly, or crash the page.
2023-07-12 13:16:23 +02:00
Sebastian Zaha d24667a1b6 LibWeb: Rename loaded observer event to match spec
The `document_fully_loaded` event should use the adjective "completely"
so as to match the spec and code convention. See
`Document::is_completely_loaded` and `m_completely_loaded_time`.
2023-07-12 13:16:23 +02:00
Emil Militzer bf3144fcff LibWeb: Prevent max-width expanding the width 2023-07-12 11:44:57 +02:00
Sebastian Zaha c006a1ef41 Meta: Update gn build files with latest changes
Ports the recent CMakeFiles.txt changes and fixes the gn build.
2023-07-12 08:31:43 +01:00
Nico Weber c3f78d9561 pdf: Add function to render a page of a PDF to a bitmap
Use like so:

    Build/lagom/bin/pdf --render foo.png --page=50 path/to.pdf
2023-07-12 07:54:28 +01:00
Nico Weber 8c13b83a84 LibGfx/PNGWriter: Use a better limit for scanline capactiy
One scanline is width pixels long, not height pixels.

No measurable performance difference, but it annoys me every time I look
at this file.
2023-07-12 07:51:54 +01:00
Kemal Zebari 0c41867ad5 Base: Add man page for nohup 2023-07-12 10:11:24 +03:30
Kemal Zebari 20c59a143c Utilites: Implement nohup
This snapshot implements the nohup command-line utility.
2023-07-12 10:11:24 +03:30
Nico Weber 66e210e406 Everywhere: Use nested namespace qualifiers 2023-07-12 10:05:42 +03:30
Nico Weber a2f33fdcef LibEDID: Use AssertSize<> for ExtensionBlock 2023-07-12 10:05:42 +03:30
Nico Weber 2061ee2632 Tests/LibPDF: Add test for AES-encrypted PDF
I created this by typing "sup" into TextEdit.app on macOS 13.4,
hitting Cmd-P to bring up the print dialog, clicked the PDF button
at the bottom, changed Title and Author to "sup", clicked
"Security Options…", and checked "Require password to open document"
(with password "sup").

This file tests several things:
- It has a compressed stream as first object. This used to make the
  linearization dict detection logic assert.
- It uses AES as encryption key using version 4 of the encryption
  dict. This used to not be implemented.
2023-07-12 06:28:15 +02:00
Nico Weber e0887dd045 Tests/LibPDF: Use MUST() more
No behavior change.
2023-07-12 06:28:15 +02:00
Nico Weber 5998072f15 LibPDF: Add support for AESV2 encryption 2023-07-12 06:28:15 +02:00
Nico Weber 67d8c8badb LibPDF: Use more direct method to access linearization dict
We know indirect_value_or_error.value contains an IndirectObject,
so there's no need to go through resolve().

No behavior change.
2023-07-12 06:28:15 +02:00
Nico Weber 39b2eed3f6 LibPDF: Do not crash on encrypted files that start unluckily
PDF files can be linearized. In that case, they start with a
"linearization dict" that stores the key `/Linearized` and the value
`1`. To check if a file is linearized, we just read the first dict, and
then checked if it has that key.

If the first object of a PDF was a stream with a compression filter
and the input PDF was encrypted and not linearized, then us trying to
decode the linearization dict could crash due to stream contents being
encrypted, decryption state not yet being initialized, and us trying
to decompress stream data before decrypting it.

To prevent this, disable uncompression when parsing the first object
to determine if it's a lineralization dictionary.

(A linearization dict never stores string values, so decryption
not yet being initialized is not a problem. Integer values aren't
encrypted in encrypted PDF files.)
2023-07-12 06:28:15 +02:00
Nico Weber c781686198 pdf: Add a --password option for encrypted PDFs 2023-07-12 06:28:15 +02:00
Nico Weber 63670f27de LibPDF: Rename m_disable_encryption to m_enable_encryption
Double negation is confusing.

No behavior change.
2023-07-12 06:28:15 +02:00
Nico Weber 92d2895057 LibPDF: Remove a pointless template specialization
We can just have two functions with actual names instead of specializing
on a bool template parameter.

No behavior change.
2023-07-12 06:28:15 +02:00
Xexxa deb0c53779 Base: Add more emoji
🧎🏻 - U+1F9CE U+1F3FB PERSON KNEELING: LIGHT SKIN TONE
🧎🏼 - U+1F9CE U+1F3FC PERSON KNEELING: MEDIUM-LIGHT SKIN TONE
🧎🏽 - U+1F9CE U+1F3FD PERSON KNEELING: MEDIUM SKIN TONE
🧎🏾 - U+1F9CE U+1F3FE PERSON KNEELING: MEDIUM-DARK SKIN TONE
🧎🏿 - U+1F9CE U+1F3FF PERSON KNEELING: DARK SKIN TONE
🧎🏻‍♂️ - U+1F9CE U+1F3FB U+200D U+2642
MAN KNEELING: LIGHT SKIN TONE
🧎🏼‍♂️ - U+1F9CE U+1F3FC U+200D U+2642
MAN KNEELING: MEDIUM-LIGHT SKIN TONE
🧎🏽‍♂️ - U+1F9CE U+1F3FD U+200D U+2642
MAN KNEELING: MEDIUM SKIN TONE
🧎🏾‍♂️ - U+1F9CE U+1F3FE U+200D U+2642
MAN KNEELING: MEDIUM-DARK SKIN TONE
🧎🏿‍♂️ - U+1F9CE U+1F3FF U+200D U+2642
MAN KNEELING: DARK SKIN TONE
🧎🏻‍♀️ - U+1F9CE U+1F3FB U+200D U+2640
WOMAN KNEELING: LIGHT SKIN TONE
🧎🏼‍♀️ - U+1F9CE U+1F3FC U+200D U+2640
WOMAN KNEELING: MEDIUM-LIGHT SKIN TONE
🧎🏽‍♀️ - U+1F9CE U+1F3FD U+200D U+2640
WOMAN KNEELING: MEDIUM SKIN TONE
🧎🏾‍♀️ - U+1F9CE U+1F3FE U+200D U+2640
WOMAN KNEELING: MEDIUM-DARK SKIN TONE
🧎🏿‍♀️ - U+1F9CE U+1F3FF U+200D U+2640
WOMAN KNEELING: DARK SKIN TONE
🦫 - U+1F9AB BEAVER
2023-07-12 06:26:21 +02:00
Peter Elliott da96c151ab LibCore: Exit EventLoop::spin_until() when exit requested
This keeps WebContent from staying open if it's spinning forever trying
to load a page.
2023-07-12 05:51:00 +02:00
Linus Groh dc5d85b609 LibJS: Unwrap correct completion in group_by() 2023-07-12 00:34:01 +02:00
Linus Groh 419e710c1c LibJS: Re-implement the Array Grouping proposal as static methods
Closes #19495.
2023-07-12 00:03:54 +02:00
Nico Weber f418605ec7 pdf: Print PDF version; tweak output 2023-07-11 13:49:17 -04:00
Nico Weber ea89053c12 LibPDF: Make PDF version accessible on Document 2023-07-11 13:49:17 -04:00
Andreas Kling 9174ffd7e6 LibWeb: Create Layout::Box for display: inline-grid
This makes us actually run a GridFormattingContext instead of rendering
inline-grid elements as nothing. :^)
2023-07-11 19:15:17 +02:00
Valtteri Koskivuori 5615ea5386 LibCore: Replace non-breaking hyphens with regular ones in MimeData
These three lines were added in commits 41d5531, 0f7a651 and 97aca8f all
the way back in June 2020, and went unnoticed until Lucas pointed this
out during my refactoring.
2023-07-11 17:48:57 +01:00
Valtteri Koskivuori f2ce47e3a1 Userland: Sync file utility descriptions with LibCore
Added descriptions for the following formats: icc, bzip2, SerenityOS
Spreadsheet, svg, tiff, targa, css, csv, html, plaintext, webm
2023-07-11 17:48:57 +01:00
Valtteri Koskivuori ff83b909f0 LibCore: Sort and tidy up filename mime guess function
These too should be sorted alphabetically, as evidenced by the fact that
text/markdown was in there twice before this change. :^)
Also broke out tables of sufffixes and basenames we consider plaintext,
and sorted those alphabetically as well.
2023-07-11 17:48:57 +01:00
Valtteri Koskivuori 21473ea7f1 LibCore: Improve mime type enumeration sorting
It makes far more sense to sort by the standard mime type strings,
rather than the ad-hoc variable names associated with each enumeration.
This way, the sort looks nicer, and also matches the corresponding
description enumerations in the file utility.
2023-07-11 17:48:57 +01:00
Valtteri Koskivuori 2c6b156803 Userland: Teach the file utility about zip files
It now shows a short description with a file and directory counts, and
the total content size uncompressed.
2023-07-11 17:48:57 +01:00
Karol Kosek 729aae8437 Ladybird: Allow loading 'data:' URLs from a search bar 2023-07-11 15:30:11 +02:00
Lucas CHOLLET 9ff706339b LibGfx/PortableFormat: Read the header during initialization
This is done as a part of #19893.
2023-07-11 14:16:33 +01:00
Lucas CHOLLET f3ff9c26bc LibGfx/PortableFormat: Simplify the State enum
This enum used to store very precise state about the decoding process,
let's simplify that by only including two steps: HeaderDecoder and
BitmapDecoded.
2023-07-11 14:16:33 +01:00
Lucas CHOLLET f6ce06d56b LibGfx/PortableFormat: Extract header reading in its own function 2023-07-11 14:16:33 +01:00
Lucas CHOLLET e72293fbc7 LibGfx/PortableFormat: Remove PortableImageDecoderPlugin::initialize() 2023-07-11 14:16:33 +01:00
Nico Weber f7f9f1f47f LibGfx/PNG: Make invalid sRGB chunk size non-fatal
https://www.haiku-os.org/images/bg-page.png has a size of 0 for
example.

Just ignoring the chunk instead of assuming that the image is sRGB
and has Perceptual rendering intent matches what libpng does
(cf `png_handle_sRGB()`), so let's do that too.

(All other chunk handlers are still strict about size.)
2023-07-11 15:07:42 +02:00
Jelle Raaijmakers 3b2a7135b2 Ports: Add archive hash to Quake port
Also update the code style.
2023-07-11 13:42:02 +01:00
Andi Gallo a27c9d8b05 LibWeb: Use max width from content for cells unless length is specified
Max width shouldn't be tied to min width, commit d33b99d went too far
and made them the same when the table-root had a specified percentage
width.

Fixes #19940.
2023-07-11 14:37:30 +02:00
Tim Ledbetter 4e7e878606 ps: Add --ppid option to filter by parent PID 2023-07-11 13:02:08 +01:00
Tim Ledbetter d3c5ae0860 ps: Add -t option to filter by TTY 2023-07-11 13:02:08 +01:00
Tim Ledbetter aeb87d6e78 ps: Allow multiple filtering options to be used simultaneously
Previously, it was assumed that only one filtering option, such as
`-u` or `-p` would be used at a time. With this PR, processes are now
shown if they match any of the specified filters.
2023-07-11 13:02:08 +01:00
Tim Ledbetter a758e27153 ps: Disallow using -q with any other filtering options
This matches the behavior of `ps` on Linux.
2023-07-11 13:02:08 +01:00
Andreas Kling 5e24b97275 LibWeb: Implement HTMLImageElement.complete according to spec
Now that we use the HTML image loading algorithm from spec, we can
implement complete correctly.

This (finally) fixes an issue where images were not loading on
https://twinings.co.uk/ :^)
2023-07-11 10:03:49 +02:00
Andreas Kling 92bc3d200d LibWeb: Fix incorrectly offset root intersection rectangle for Document
When the intersection root is a Document, we use the viewport itself as
the root intersection rectangle. However, we should only use the size of
the viewport and strip away the current scroll offset.

This is important, as intersections are computed using viewport-relative
element rects, so we're already in a coordinate system where (0, 0) is
the top left of the scrolled viewport.

This fixes an issue where IntersectionObservers would fire at entirely
wrong scroll offsets. :^)
2023-07-11 10:03:49 +02:00
Kirill Nikolaev 6cdb1f0415 Kernel: Add an initial implementation of virtio-net driver
It can be exercised by setting
    SERENITY_ETHERNET_DEVICE_TYPE=virtio-net-pci.
2023-07-11 00:49:11 -06:00