Commit graph

56481 commits

Author SHA1 Message Date
Aliaksandr Kalenik
ef71f46da6 LibWeb: Flesh out "scroll a target into view" spec implementation
This change fixes regressed Acid2 test and now we at least can see
the face after clicking "Take The Acid2 Test" link.
2023-11-17 20:46:56 +01:00
Timothy Flynn
08572d45b8 Documentation: Change macOS Ladybird command to launch in the foreground
Also add flags to direct stdout/stderr to the terminal, and show how to
pass arguments to the browser.
2023-11-17 19:14:53 +01:00
Timothy Flynn
72e5b10b30 Ladybird/AppKit: Remove explicit application activation
We call [NSApp activateIgnoringOtherApps:YES] to ensure the application
is brought into view and focused when launched from a terminal. But in
a macOS environment, we're better off using the `open` command to launch
the application (in which case, it does take foreground focus).
2023-11-17 19:14:53 +01:00
Nico Weber
5eaa403ddf LibPDF: Use font dictionary object as cache key, not resource name
In the main page contents, /T0 might refer to a different font than
it might refer to in an XObject. So don't use the `Tf` argument as
font cache key. Instead, use the address of the font dictionary object.

Fixes false cache sharing, and also allows us to share cache entries
if the same font dict is referred to by two different names.

Fixes a regression from 2340e834cd (but keeps the speed-up intact).
2023-11-17 19:14:39 +01:00
Nico Weber
443b3eac77 LibPDF: Let decode_png_prediction() call LibGfx's unfilter_scanline()
It's less code, but it also fixes a bug: The implementation in
Filter.cpp used to use the previous byte as reference value, while
we're supposed to use the value of the previous channel as reference
(at least when a pixel is larger than one byte).
2023-11-17 19:09:50 +01:00
Nico Weber
145ade3a86 LibPDF: Remove a needless AK:: qualification
No behavior change.
2023-11-17 19:09:50 +01:00
Nico Weber
000d9da73c LibGfx: Allow passing FilterType::None to unfilter_scanline()
Makes calling this in LibPDF less awkward, and there's no reason
not to allow this.
2023-11-17 19:09:50 +01:00
Nico Weber
574357ef00 LibGfx: Use ceil_div() in png decoder
No behavior change, arguably easier to read.
2023-11-17 19:09:50 +01:00
Nico Weber
5a70813d11 LibGfx: Make unfilter_scanline() a static PNGImageDecoderPlugin method
That way, LibPDF will be able to call it.

No behavior change.
2023-11-17 19:09:50 +01:00
Nico Weber
0416a07d56 LibPDF: Make filter byte not part of row in decode_png_prediction()
No behavior change.
2023-11-17 19:09:50 +01:00
Nico Weber
b763960fc2 LibPDF: Convert decode_png_prediction to use spans
No behavior change.
2023-11-17 19:09:50 +01:00
Nico Weber
588d6fab22 LibGfx+LibPDF: Create filter_type() for converting u8 to FilterType
...and use it in LibPDF.

No behavior change.
2023-11-17 19:09:50 +01:00
Nico Weber
7e4fe8e610 LibPDF: Use PNG::paeth_predictor() in png decoding path
No behavior change.

Ideally, the PDF code would just call a function PNGLoader to do the
PNG unfiltering, but let's first try to make the implementations look
more similar.
2023-11-17 19:09:50 +01:00
Nico Weber
6b2c60404d LibGfx: Use PNG::paeth_predictor() in png decoding path
Increases code reuse between encoder and decoder a tiny bit.
No behavior change.

(We should use the vectorized version in the future! But first,
we should learn to do the prediction in-place.)
2023-11-17 19:09:50 +01:00
Timothy Flynn
2763fb45f7 LibTimeZone: Handle systems with varying zoneinfo file locations
On my mac, the zoneinfo location is /usr/share/zoneinfo.default. This
breaks our implementation for finding the system time zone, which was
assuming the zoneinfo location contains "/zoneinfo/". This patch makes
the implementation a bit more lenient.

This didn't break tests on CI because we fallback to UTC, which is the
time zone CI machines are in anyways.
2023-11-17 19:07:53 +01:00
Simon Wanner
6c8ab1ca0d LibJS/JIT: Add a builtin for Math.abs 2023-11-17 19:06:25 +01:00
Simon Wanner
86b85aa68b LibJS: Introduce Builtins
Builtins are functions that can be detected during bytecode generation
and enable fast-paths in the JIT.
2023-11-17 19:06:25 +01:00
Liav A
b9141d85d8 WindowServer: Introduce the window roll-up feature
The roll-up feature allows the user to set the window content to be
hidden, while retaining the window title bar visibility.
While in roll-up mode, the window height size is not changeable.
However, tiling the window or maximizing (as well as unmaximize) it will
instruct exiting the roll-up mode.
2023-11-17 17:31:51 +00:00
sSt3lla
6b72fc0924 Calculator: Convert DeprecatedString to String 2023-11-17 17:17:00 +00:00
Idan Horowitz
9677d8eeac LibWeb: Reject improperly encoded XML documents as not well-formed 2023-11-17 16:02:36 +01:00
Idan Horowitz
278e8afb42 LibWeb: Consider content-type charset when determining XML encoding 2023-11-17 16:02:36 +01:00
Idan Horowitz
07ea3ab306 LibWeb: Display error page when document parsing fails 2023-11-17 16:02:36 +01:00
Idan Horowitz
079c96376c LibTextCodec: Support validating encoded inputs 2023-11-17 16:02:36 +01:00
Ali Mohammad Pur
ad4470bc39 Shell: Escape program-provided completions unless they're marked as code
This makes it so program-provided completions don't have to worry about
escaping, making the Shell the only authority on escaping.
2023-11-17 11:02:02 +03:30
Dan Klishch
2dba79bc6b Meta: Globally disable floating point contraction
FP contraction is a standard-conforming behavior which allows the
compiler to calculate intermediate results of expressions containing
floating point numbers with a greater precision than the expression type
allows. And in theory, it enables additional optimizations, such as
replacing `a * b + c` with fma(a, b, c).

Unfortunately, it is extremely hard to predict when the contraction will
happen. For example, Clang 17 on x86_64 with the default options will
use FMA only for constant-folded non-constexpr expressions. So, in
practice, FP contraction leads to hard-to-find bugs and inconsistencies
between executables compiled with different toolchains or for different
OSes. And we had two instances of this happening last week.

Since we did not ever used -mfma on x86_64, this patch can only possibly
regress performance on Apple ARM devices, where FMA is enabled by
default. However, this regression will likely be negligible since the
difference would be one additional add instruction, which would be then
likely executed in parallel with something else.
2023-11-16 19:05:13 -05:00
Adam Harald Jørgensen
67bc7cecbb Base: Fix indentation in completion function for kill 2023-11-16 23:07:31 +03:30
Adam Harald Jørgensen
66955b82a7 Base: Add completion for cd that suggests only directories 2023-11-16 23:07:31 +03:30
Thomas Voss
785f95d0af head(1): Fix typo in flag name
The shorthand for the ‘--bytes’ flag is ‘-c’, not ‘-b’.
2023-11-16 19:54:04 +01:00
Aliaksandr Kalenik
f6a9f613c7 LibAccelGfx+LibWeb: Add basic support for linear gradients painting
Linear gradient painting is implemented in the following way:
1. The rectangle is divided into segments where each segment represents
   a simple linear gradient between an adjacent pair of stops.
2. Each quad is filled separately using a fragment shader that
   interpolates between two colors.

For now `angle` and `repeat_length` parameters are ignored.
2023-11-16 18:02:51 +01:00
Aliaksandr Kalenik
61a2e59d87 LibAccelGfx+WebContent: Add GPU painter support on macOS
With these changes it is now possible to create OpenGL context on macOS
and run GPU-painter. For now only QT client has a CLI param that turns
it on though.
2023-11-16 15:13:16 +01:00
Andreas Kling
ffe304e88b LibJS: Don't create arguments object due to o.arguments access
When deciding whether we need to create a full-blown `arguments` object,
we look at various things, starting as early as in the parser.

Until now, if the parser saw the identifier `arguments`, we'd decide
that it's enough of a clue that we should create the `arguments` object
since somebody is obviously accessing it.

However, that missed the case where someone is just accessing a property
named `arguments` on some object. In such cases (`o.arguments`), we now
hold off on creating an `arguments` object.

~11% speed-up on Octane/typescript.js :^)
2023-11-16 13:26:21 +01:00
Stephan Vedder
32352aa729 LibJS/JIT: Add a fast path for floating point comparisons 2023-11-16 11:43:44 +01:00
Aliaksandr Kalenik
4164af2ca4 LibWeb: Do not compensate padding for abspos boxes with static position
When a box does not have a top, left, bottom, or right, there is no
need to adjust the offset for positioning relative to the padding edge,
because the box remains in the normal flow.
2023-11-15 23:44:05 +01:00
Timothy Flynn
2c1bbf5a99 AK+LibIDL: Put IDL dbgln statement behind a debug flag
This is a bit spammy now that we are performing some overload resolution
at build time. The fallback to an interface has generally worked fine on
the types it warns about (BufferSource, Module, etc.) so let's not warn
about it for every build.
2023-11-15 23:42:53 +01:00
Timothy Flynn
e1092aed3c LibWeb: Don't reject worker scripts with a JavaScript MIME type
The condition for checking if a script has a JS MIME type is currently
flipped. Extract the check to a local to make it a bit easier to reason
about at quick glance.
2023-11-15 11:28:39 -05:00
Timothy Flynn
50406f541b Meta: Port recent changes to GN build
124c378472
2023-11-15 11:28:39 -05:00
Andrew Kaster
ea95256f83 LibWeb: Remove unused ResourceLoader::load(URL) overload
With the refactoring of Workers, nobody is calling this LoadRequest-less
overload. All new code should eventually be moved to fetch anyway.
2023-11-15 12:56:33 +01:00
Andrew Kaster
124c378472 LibWeb+WebWorker: Move worker execution into a new WebWorker process
We now create a WorkerAgent for the parent context, which is currently
only a Window. Note that Workers can have Workers per the spec.

The WorkerAgent spawns a WebWorker process to hold the actual
script execution of the Worker. This is modeled with the
DedicatedWorkerHost object in the WebWorker process.
A start_dedicated_worker IPC method in the WebWorker IPC creates the
WorkerHost object. Future different worker types may use different IPC
messages to create their WorkerHost instance.

This implementation cannot yet postMessage between the parent and the
child processes.

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-11-15 12:56:33 +01:00
Andrew Kaster
3dbbb5b263 LibWeb: Implement fetch a classic worker script 2023-11-15 12:56:33 +01:00
Andrew Kaster
d7d84ee931 LibWeb: Ensure a Web::Page is associated with local Worker LoadRequests
This is a hack on top of a hack because Workers don't *really* need to
have a Web::Page at all, but the ResourceLoader infra that should be
going away soon ™️ is not quite ready to axe that requirement for
cookies.
2023-11-15 12:56:33 +01:00
Andrew Kaster
5586340cf3 LibWeb: Don't set EventTarget prototype on any WindowOrWorkerGlobalScope
The same limitations regarding construction of Window apply to all
WorkerGlobalScope classes as well.
2023-11-15 12:56:33 +01:00
Andrew Kaster
4fcff01ef3 LibWeb: Clean up assumptions in Bindings::HostDefined
We don't have a 'root execution environment' anymore (thankfully), so
we can make sure that the ESO the HostDefined object holds onto is a
NonnullGCPtr.
2023-11-15 12:56:33 +01:00
Valtteri Koskivuori
427ca284f1 Documentation: Update Helix editor documentation
Helix 23.10 made breaking changes to the way lsp configuration works, so
update documentation to reflect the new structure.
2023-11-15 06:49:48 -05:00
Aliaksandr Kalenik
eac7916d2c LibWeb: Use inner available space to calculate auto height of abspos
By using available_inner_space_or_constraints_from(available_space), we
ensure that the available space used to calculate the min/max content
height is constrained by the width specified for the box itself
(I know that at least GFC always expects available width to be
constrained by specified width if there is any).

This change improves layout in "Recent news" block on
https://telegram.org/
2023-11-15 11:26:14 +01:00
Kemal Zebari
6b5a0100d9 Browser: Move BookmarksBarWidget::PerformEditOn to anon namespace
Since none of `BookmarksBarWidget`'s methods use this enum class any
longer, let's just move it to the anonymous namespace so that
`BookmarkEditor` can still make use of it.
2023-11-14 15:38:09 -07:00
Timothy Flynn
bd1e76a98a Meta: Move .DS_Store rule to the bottom of the .gitignore file
Otherwise, opening any folder under Base in Finder on macOS may create
a tracked .DS_Store file, which we don't want committed to the repo.
2023-11-14 14:53:37 -05:00
Timothy Flynn
411f5af0b8 Meta: Automatically generate a compilation database for clangd
This is similar to how we set CMAKE_EXPORT_COMPILE_COMMANDS in the CMake
build. This adds about 5-10ms to a clean `gn gen` on my machine.
2023-11-14 14:29:35 -05:00
Timothy Flynn
665a95e39e Meta: Support (and default to) Ladybird's AppKit chrome in the GN build
The Qt chrome may be used by setting `enable_qt = true` in args.gn.
2023-11-14 14:29:35 -05:00
Adam Harald Jørgensen
e2f9011a8d Shell: Improve error propagation
This commit replaces 31 release_value_but_fixme_should_propagate_errors
calls with TRYs. :^)
2023-11-14 20:08:27 +03:30
Adam Harald Jørgensen
e89ba794d0 Shell: Include parent and base directories in expanded globs 2023-11-14 20:08:27 +03:30