Commit graph

26672 commits

Author SHA1 Message Date
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
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 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 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
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
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
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
Ali Mohammad Pur b00a23b0b6 LibWeb: Fix a spec link in CSS/Parser
This pointed to the wrong part of the spec, make it point to the right
part instead :P
2023-07-11 09:38:37 +03:30
Ali Mohammad Pur d60d149e62 LibWeb: Move some static functions from CSS/Parser.cpp into a new file 2023-07-11 09:38:37 +03:30
Ali Mohammad Pur 06c6c40df9 LibWeb+LibJS: Move some code around to make CSS/Parser parse faster
This makes it possible to include fewer full definitions of things,
which makes the file about 30% faster to compile.
2023-07-11 09:38:37 +03:30
Ali Mohammad Pur 392b5c3b19 LibJS: Resolve a circular include problem between HeapBlock and Cell
Cell::heap() and Cell::vm() needed to access member functions from
HeapBlock, and wanted to be inline, so they were moved to VM.h.
That approach will no longer work with VM.h not being included in every
file (starting from the next commit), so this commit fixes that circular
import issue by introducing secondary base classes to host the
references to Heap and VM, respectively.
2023-07-11 09:38:37 +03:30
Aliaksandr Kalenik 41f9dcd89b LibWeb: Implement "create a new child navigable" and supporting code
Implements https://html.spec.whatwg.org/multipage/document-sequences.html#create-a-new-child-navigable

Co-authored-by: Andreas Kling <kling@serenityos.org>
2023-07-11 06:48:25 +02:00
Tim Schumacher 9d6372ff07 Kernel: Consolidate finding the ELF stack size with validation
Previously, we started parsing the ELF file again in a completely
different place, and without the partial mapping that we do while
validating.

Instead of doing manual parsing in two places, just capture the
requested stack size right after we validated it.
2023-07-10 21:08:31 -06:00
Andreas Kling 06d9451551 LibWeb: Don't cache property accesses on WindowProxy
Since the underlying HTML::Window can change, caching property accesses
on WindowProxy is not as simple as remembering the shape. Let's disable
caching here for now. We can come back to it in the future when we have
no low-hanging fruit left. :^)

Fixes an assertion failure on https://twinings.co.uk/
2023-07-11 00:14:50 +02:00
Andreas Kling cf6792ec40 LibJS/Bytecode: Invalidate inline caches on unique shape mutation
Since we can't rely on shape identity (i.e its pointer address) for
unique shapes, give them a serial number that increments whenever a
mutation occurs.

Inline caches can then compare this serial number against what they
have seen before.
2023-07-11 00:14:50 +02:00
Sebastian Zaha 17d23e76e5 LibWeb: Fix flex & abspos alignment issues
Fixes a couple of weirder interactions between justify-content and
flex-direction related to reverse direction packing and how margins
are set.
2023-07-10 20:57:49 +02:00
MacDue e1cf868e6e LibGfx: Use AntiAliasingPainter::fill_path() for drawing font glyphs
Using the general AA painter fill_path() is indistinguishable from the
previous rasterizer, so this switch simply allows us to share more code.
2023-07-10 20:56:25 +02:00