Commit graph

58441 commits

Author SHA1 Message Date
kleines Filmröllchen
3a9278b31c Documentation: Add guidelines for writing manual pages
Based on current consensus and the way our manpages are written.
2024-01-29 05:30:30 -07:00
Bastiaan van der Plaat
350affe406 LibGUI+WindowServer: Add menu minimum width support 2024-01-29 05:29:41 -07:00
kleines Filmröllchen
adc845e0cb Userland: Port to automatic GML initializer where possible 2024-01-29 05:21:48 -07:00
kleines Filmröllchen
dec066fa5c GMLCompiler: Add common pattern for a user-defined fallible initializer
Many widget classes need to run substantial initialization code after
they have been setup from GML. With this change, an
initialize_fallibles() function is called if available, allowing the
initialization to be invoked from the GML setup automatically. This
means that the GML-generated creation function can now be used directly
for many more cases, and reduces code duplication.
2024-01-29 05:21:48 -07:00
Sönke Holz
8878e0c815 Kernel/riscv64: Implement everything in PageDirectory.cpp
This code is heavily based on aarch64's PageDirectory.cpp.
2024-01-29 05:17:03 -07:00
MacDue
b10f58a1fe LibWeb: Support x and y attributes on nested SVGs
This allows positioning a child SVG relative to its parent SVG.

Note: These have been implemented as CSS properties as in SVG 2, these
are geometry properties that can be used in CSS (see
https://www.w3.org/TR/SVG/geometry.html), but there is not much browser
support for this. It is nicer to implement than the ad-hoc SVG
attribute parsing though, so I feel it may make sense to port the rest
of the attributes specified here (which should fix some issues with
viewport relative sizes).
2024-01-29 10:01:10 +00:00
Aliaksandr Kalenik
556679fedd LibWeb: Account for scroll offset in hit-testing
The hit-testing position is now shifted by the scroll offsets before
performing any checks for containment. This is implemented by assigning
each PaintableBox/InlinePaintable an offset corresponding to the scroll
frame in which it is contained. The non-scroll-adjusted position is
still passed down when recursing to children because the assigned
offset accumulated for nested scroll frames.

With this change, hit testing works in the Inspector.
Fixes https://github.com/SerenityOS/serenity/issues/22068
2024-01-29 09:57:40 +01:00
Aliaksandr Kalenik
beb1c85b6b LibWeb: Force scroll offsets update in Internals::hit_test()
Since we might enter Internals::hit_test() before the enclosing scroll
offsets are updated in the paintables tree during pre-paint, this
update need to be enforced.
2024-01-29 09:57:40 +01:00
Timothy Flynn
66959bcc09 LibWeb: Use the stream teeing methods for cloning Fetch response bodies 2024-01-29 07:21:59 +01:00
Timothy Flynn
6981ddfe13 LibWeb: Implement the ReadableByteStreamTee half of ReadableStreamTee 2024-01-29 07:21:59 +01:00
Timothy Flynn
d7612969e0 LibWeb: Invoke the correct Streams BYOB AOs when in a closed state 2024-01-29 07:21:59 +01:00
Timothy Flynn
ed1076d9ca LibWeb: Implement the ReadableByteStreamControllerRespondWithNewView AO 2024-01-29 07:21:59 +01:00
Timothy Flynn
5e5b42730c LibWeb: Implement the CloneAsUint8Array AO 2024-01-29 07:21:59 +01:00
Timothy Flynn
debfe996d7 LibWeb: Implement the ReadableStreamDefaultTee half of ReadableStreamTee 2024-01-29 07:21:59 +01:00
Timothy Flynn
d8413774df LibWeb: Expose the ReadableStream tee IDL interface
This just sets up the plumbing to the underlying ReadableStreamTee AO,
which as of this commit, will just throw a NotImplemented exception.
2024-01-29 07:21:59 +01:00
Timothy Flynn
5ccd1ff1bf LibWeb: Implement the StructuredClone AO 2024-01-29 07:21:59 +01:00
Timothy Flynn
59716f807f Meta: Port recent changes to the GN build
187862ebe0
514af065a5
2024-01-29 07:21:59 +01:00
Aliaksandr Kalenik
20de69693b LibWeb: Fix hidden overflow clipping with nested CSS transforms
This is a fix for regression introduced in
0bf82f748f

All CSS transforms need to be removed from the clip rectangle before
applying it. However, it is still necessary to calculate it with
applied transforms to find the correct intersection of all clip
rectangles in the containing block chain.
2024-01-29 07:21:38 +01:00
Linus Groh
e1d1aac7bc LibJS/Bytecode: Apply BigInt/Symbol ToObject avoidance in another place
Same as d667721b2 but in a different place.
2024-01-28 19:49:51 -05:00
Tim Ledbetter
d1226f0b15 LibWeb: Don't crash when querying offsets of empty inline elements
Previously, querying `offsetTop` or `offsetLeft` of an inline element
with no text would cause a crash.
2024-01-28 23:32:40 +01:00
Tim Ledbetter
99fbd33d7d LibWeb: Make button flex wrapper inherit min-height property
This ensures that the vertical positioning of button text is correct
if a `min-height` property is present.
2024-01-28 14:48:33 +01:00
Aliaksandr Kalenik
0bf82f748f LibWeb: Move clip rect calculation to happen before painting
With this change, clip rectangles for boxes with hidden overflow or the
clip property are no longer calculated during the recording of painting
commands. Instead, it has moved to the "pre-paint" phase, along with
the assignment of scrolling offsets, and works in the following way:

1. The paintable tree is traversed to collect all paintable boxes that
   have hidden overflow or use the CSS clip property. For each of these
   boxes, the "final" clip rectangle is calculated by intersecting clip
   rectangles in the containing block chain for a box.
2. The paintable tree is traversed another time, and a clip rectangle
   is assigned for each paintable box contained by a node with hidden
   overflow or the clip property.

This way, clipping becomes much easier during the painting commands
recording phase, as it only concerns the use of already assigned clip
rectangles. The same approach is applied to handle scrolling offsets.

Also, clip rectangle calculation is now implemented more correctly, as
we no longer stop at the stacking context boundary while intersecting
clip rectangles in the containing block chain.

Fixes:
https://github.com/SerenityOS/serenity/issues/22932
https://github.com/SerenityOS/serenity/issues/22883
https://github.com/SerenityOS/serenity/issues/22679
https://github.com/SerenityOS/serenity/issues/22534
2024-01-28 08:25:28 +01:00
Shannon Booth
eaf9a56c10 LibWeb: Actually clear stream controller algorithms when needed
Now that these algorithms are a HeapFunction as opposed to SafeFunction,
the problem mentioned in the FIXME is no longer applicable as these
functions are GC-allocated like everything else.
2024-01-27 21:40:25 -05:00
Shannon Booth
5f484d200a LibWeb: Port Stream algorithms from JS::SafeFunction to JS::HeapFunction 2024-01-27 21:40:25 -05:00
Shannon Booth
e118430648 LibJS: Allow JS::create_heap_function to accept a lambda
This helps us avoid from needing to construct a Function<T> when
invoking `create_heap_function` with a lambda.

Co-Authored-By: Ali Mohammad Pur <mpfard@serenityos.org>
2024-01-27 21:40:25 -05:00
Shannon Booth
c6319d68c3 AK: Introduce EquivalentFunctionType
This allows you to get the type from a function from some given
callable 'T'.

Co-Authored-By: Ali Mohammad Pur <mpfard@serenityos.org>
2024-01-27 21:40:25 -05:00
Ali Mohammad Pur
0e61d039c9 AK: Use IsSame<FlatPtr, T> instead of __LP64__ to guess FlatPtr's type
Instead of playing the guessing game, simply use whatever type FlatPtr
itself resolves to.
2024-01-28 04:30:33 +03:30
Andreas Kling
9326ded5a4 LibJS: Fast path for Increment of Int32 value in bytecode interpreter
5% speed-up on Kraken/ai-astar.js in interpreter mode. :^)
2024-01-27 22:29:49 +01:00
Andreas Kling
9fcd6776cf LibJS: Add fast path for Array.length in the bytecode interpreter
13.8% speed-up on Kraken/ai-astar.js in interpreter mode. :^)
2024-01-27 22:29:49 +01:00
Andreas Kling
514af065a5 LibJS: Move shared bytecode/JIT helpers to a header file
This allows them to be inlined into the bytecode interpreter.

7.6% speedup on Kraken/ai-astar.js in interpreter mode. :^)
2024-01-27 22:29:49 +01:00
Tim Ledbetter
6f5dd9e11c LibWeb: Return correct RoleType for composite ARIA role 2024-01-27 14:52:41 -05:00
Tim Ledbetter
f0d2a21d77 LibWeb: Add missing ARIA roles to RoleType::build_role_object()
This change allows `contentinfo`, `none`, `subscript` and `superscript`
RoleTypes to be built. These were the only non-abstract role types
missing from this function.

This fixes an issue where clicking on an element with one of these role
types in Inspector would cause a crash.
2024-01-27 14:52:41 -05:00
Linus Groh
d667721b24 LibJS: Skip object creation for BigInt and Symbol values in GetValue
I'm not sure why these were omitted initially - works fine for other
engines, e.g.:

- d5aed64eff/src/types/language/value.zig (L1279-L1292)
- 5792a94c10/Source/JavaScriptCore/runtime/JSCJSValue.cpp (L180-L206)
2024-01-27 13:11:18 -05:00
MacDue
5cf1570f40 LibWeb: Add initial support for nesting SVG viewports
Previously, we were handling viewBoxes/viewports in a slightly hacky
way, asking graphics elements to figure out what viewBox to use during
layout. This does not work in all cases, and can't allow for more
complex SVGs where it is possible to have nested viewports.

This commit makes the SVGFormattingContext keep track of the
viewport/boxes, and it now lays out each viewport recursively, where
each nested `<svg>` or `<symbol>` can establish a new viewport.

This fixes some previous edge cases, and starts to allow nested
viewports (there's still some issues to resolve there).

Fixes #22931
2024-01-27 18:12:13 +01:00
Andreas Kling
546143e9a6 LibWeb: Fix vector OOB access when comparing some calc() values
Before comparing the elements of two vectors, we have to check that
they have the same length. :^)

Fixes a crash seen on https://chat.openai.com/
2024-01-27 17:06:43 +01:00
Timothy Flynn
9272d185ad LibWeb: Implement a slightly better ad-hoc Body::clone method
Just creating a stream on the JS heap isn't enough, as we will later
crash when trying to read from that stream as it hasn't been properly
initialized. Instead, until we have teeing implemented (which is a
rather huge part of the Streams spec), create streams using proper AOs
that do initialize the stream.
2024-01-27 16:01:56 +01:00
Timothy Flynn
c8c3866101 LibWeb: Implement the CreateReadableByteStream AO 2024-01-27 16:01:56 +01:00
Andreas Kling
8e20a44380 LibWeb: Avoid expensive containing_block lookups in PaintableFragment
The paintable has the containing block cached, so it's better (and less
code in general) to ask for it there.
2024-01-27 14:31:47 +01:00
Andreas Kling
ad7e6878fe LibWeb: Allocate CSS::ComputedValues objects on the heap
This makes them cheap to move around, since we can store them in a
NonnullOwnPtr instead of memcopying 2584(!) bytes.

Drastically reduces the chance of stack overflow while building the
layout tree for deeply nested DOMs (since tree building was putting
these things on the stack).

This change also exposed a completely unnecessary ComputedValues deep
copy in block layout.
2024-01-27 12:27:44 +01:00
Nico Weber
d89e42902e LibGfx/JPEGLoader: Extract inverse_dct_8x8() function
No behavior change.
2024-01-27 10:21:33 +00:00
Nico Weber
494fc1234e LibGfx/JPEGWriter: Rename y<=>x, u<=>v
Usually x and u go horizontally and y and v go vertically.

No behavior change.
2024-01-27 10:20:56 +00:00
Andrew Kaster
08a3c562f3 LibWeb: Resolve postMessage test promises if iframes already loaded
For some reason on macOS with ASAN enabled, the test promises in
HTML/Window-postMessage do not resolve. These promises wait for both
the in-document and the blob url iframes to load. It's not clear why
this works fine in Linux nor why the onload handler doesn't fire
when the iframe has already loaded.
2024-01-27 07:51:30 +01:00
Sam Atkins
e025bcc4f9 LibWeb: Make use of transform-box when calculating transforms
We don't currently calculate the fill- or stroke-boxes of SVG elements,
so for now we use the content- and border-boxes respectively, as those
are the closest equivalents. The test will need updating when we do
support them.

Also, the test is a screenshot because of rendering differences when
applying transforms: a 20px box does not get painted the same as a 10px
box scaled up 2x. Otherwise that would be the more ideal form of test.
2024-01-27 07:46:37 +01:00
Sam Atkins
391cfdc085 LibWeb: Parse the CSS transform-box property 2024-01-27 07:46:37 +01:00
Nico Weber
c3c7707de4 LibGfx/JPEGWriter: Don't throw away highest-frequency component in FDCT 2024-01-26 20:19:55 -05:00
Timothy Flynn
83d2f59e2a LibWebView: Port the CookieJar to String 2024-01-26 20:22:39 +01:00
Timothy Flynn
30fae8fa1d LibSQL: Allow constructing SQL values from a String
LibSQL still uses ByteString internally for storage, but to help outside
application port to String, add helpers to construct values from String
and to convert a value to a String.
2024-01-26 20:22:39 +01:00
Timothy Flynn
c4820838bf LibWeb+WebContent: Port the did_request_named_cookie IPC to String 2024-01-26 20:22:39 +01:00
Timothy Flynn
9b957ead13 LibWebView+WebContent: Do not manually serialize cookie sources over IPC
LibIPC can serialize enumeration automatically (this was not the case
when these IPCs were added).
2024-01-26 20:22:39 +01:00
Timothy Flynn
85b8971a80 Ladybird+LibWeb+WebContent: Port the did_request_cookie IPC to String 2024-01-26 20:22:39 +01:00