Commit graph

42445 commits

Author SHA1 Message Date
Sam Atkins
f485db2501 LibGfx: Make Rect::set_{bottom,right}_without_resize() work for non-int 2022-10-24 23:14:57 +01:00
Karol Kosek
37729f5b91 GMLPlayground: Restrict filesystem access using unveil() 2022-10-24 23:09:30 +01:00
Karol Kosek
25104a30c1 GMLPlayground: Open and save files using FileSystemAccessClient 2022-10-24 23:09:30 +01:00
networkException
681e36706b LibWeb: Implement recent changes to module script fetching
This patch implements all changes to the specification touching the
subset of module script fetching we support.

Notably it adds parts of the specification for supporting import maps.

With this we are also able to get rid of a non standard workaround for a
spec issue we discovered while initially implementing module scripts :^)
2022-10-24 23:06:56 +01:00
networkException
9afea1248f LibWeb: Add disallow further import maps steps to ESO 2022-10-24 23:06:56 +01:00
networkException
794dc2e16b LibWeb: Expose an import map and import maps allowed on Window 2022-10-24 23:06:56 +01:00
networkException
d7947995d9 LibWeb: Add the ImportMap struct 2022-10-24 23:06:56 +01:00
networkException
ee27d8cdfd LibWeb: Add is_code_unit_prefix() function 2022-10-24 23:06:56 +01:00
Yedaya Katsman
dcad8494d6 LibJS: Accept calendar names case-insensitively
This is a normative change in the Temporal spec

See tc39/proposal-temporal@03101c6
2022-10-24 23:00:19 +01:00
Linus Groh
b00d49bbf0 LibWeb: Teach MainThreadVM about module scripts 2022-10-24 22:58:51 +01:00
Linus Groh
7e7def71c1 LibWeb: Use getters instead of direct member access in Response methods
This fixes the behavior of those methods for FilteredResponse subclasses
as those only override the getter methods, not their private members.
2022-10-24 22:58:37 +01:00
Linus Groh
8f8fcfee1a LibWeb: Also make non-const Response getters virtual
We wouldn't want a filtered response to bypass the overridden methods
based on constness.
2022-10-24 22:58:37 +01:00
Linus Groh
0a186cb460 LibWeb: Handle filtered response in Response::clone() 2022-10-24 22:58:37 +01:00
Linus Groh
c380d2cfdc LibWeb: Move url_origin() to URL/URL.{cpp,h} 2022-10-24 22:58:37 +01:00
Linus Groh
93405b4aff LibWeb: Add virtual destructor to Environment
This makes it polymorphic and allows checking the subclass of an
Environment with is<T>().

We also need to change the inheritance order so JS::Cell comes first for
this to work. Unfortunately, I have no idea why that is.

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2022-10-24 22:58:37 +01:00
Linus Groh
e40c8f550f LibWeb: Add non-const variants of Request::{current_,}url() 2022-10-24 22:58:37 +01:00
Linus Groh
0ee8da9556 LibWeb: Add referrer policy to PolicyContainer 2022-10-24 22:58:37 +01:00
Linus Groh
4817b7c623 LibWeb: Add policy container to {Window,Worker}EnvironmentSettingsObject 2022-10-24 22:58:37 +01:00
Luke Wilde
488a979306 LibWeb: Layout inner floats/abspos boxes after laying out the top float
Calling parent_context_did_dimension_child_root_box immediately after
laying out the inside of the floating box is not correct, as we haven't
worked out the dimensions of the floating box yet.

In particular, this caused the icons in the top bar of Cookie Clicker
to not hug the top of the viewport. This is because the icons are
absolutely positioned elements inside a floating element which has
padding applied to it. Since we laid out the abspos element before
the floating element, it got padding values of 0 from the parent, the
default value, meaning it didn't take away the padding of it's floating
parent.

This follows how abspos boxes layout their inside boxes as well.
2022-10-24 21:12:19 +02:00
Andreas Kling
0e232b1c8d LibJS: Only use 1 bit for Cell boolean flag 2022-10-24 19:37:36 +02:00
Andreas Kling
455167008d LibWeb: Implement XMLHttpRequest.requestType setter according to spec 2022-10-24 18:06:55 +02:00
Andreas Kling
e448c74736 LibWeb: Protect XMLHttpRequest from GC in special circumstances
The XHR gives us a set of conditions where XHR objects must survive
garbage collection, even when there are no pointers to them on the heap.
This patch implements those conditions using the new cell
self-protection mechanism in LibJS.
2022-10-24 18:06:55 +02:00
Andreas Kling
e0a08f2ab0 LibWeb: Add EventTarget::has_event_listener(FlyString type)
This returns true if the EventTarget has one or more registered
listeners for a given even type.
2022-10-24 18:06:55 +02:00
Andreas Kling
51579810bd LibJS: Add Cell::must_survive_garbage_collection() mechanism
This allows cells to prevent themselves from being garbage collected,
even when there are no references to them.
2022-10-24 18:06:55 +02:00
Luke Wilde
8ace6b4f1d LibWeb: Establish stacking context when backdrop-filter is not 'none' 2022-10-24 18:05:58 +02:00
Ali Mohammad Pur
6b50425013 wasm: Map the entire input wasm file instead of using Core::File
This is a 30x (!) speedup in parsing time as we don't lose time to
Core::File's silly memmove()-into-provided-buffer stuff anymore.
2022-10-24 15:54:20 +02:00
Ali Mohammad Pur
8b0f05c540 LibWasm: Allow vectors of up to 500M entries
This usually shows up in custom sections, containing plain bytes.
2022-10-24 15:54:20 +02:00
Ali Mohammad Pur
21c6e4c257 LibWasm: Calculate the max data segment size correctly
This is given in pages, we need to first convert to bytes before
comparing with bytes.
2022-10-24 15:54:20 +02:00
Tim Schumacher
18e2bc635f LibCore: Link against LibSystem
Depending on what OS LibCore is being built for (either SerenityOS or
not-SerenityOS), the library does not just wrap functions from LibC,
but it also implements syscalls itself. Therefore, it needs to link
against LibSystem, as that is the only library that is allowed to do
syscalls.

When cross-compiling the OS this is currently not an issue because
LibC links against LibSystem, and CMake passes that dependency through
transitively by accident. However, on Lagom, LibC is just a dummy
INTERFACE library, so the LibSystem dependency is never pulled in,
resulting in undefined symbols whenever we build LibCore on SerenityOS
as a part of Lagom.
2022-10-24 15:52:42 +02:00
Tim Schumacher
4ee0737d10 Meta: Default to the SDL QEMU frontend on SerenityOS
We don't yet have anything else than SDL, and certainly not GTK.
2022-10-24 15:52:42 +02:00
Tim Schumacher
40165a1c40 Meta: Also set CC/CXX when selecting the host toolchain
This ensures that the toolchain building scripts will use the host
toolchain that has been found manually, and that they won't fall back to
`cc` (which in the worst case may not even be installed).
2022-10-24 15:52:42 +02:00
Tim Schumacher
7ecc50db57 Lagom: Link the system's LibSystem on SerenityOS 2022-10-24 15:52:42 +02:00
Gunnar Beutner
8cc952b3dc Ports: Add port for the Boost C++ libraries
This currently requires GCC.
2022-10-24 15:49:39 +02:00
Gunnar Beutner
de6048b7d3 Kernel: Add definitions for SO_SNDLOWAT and SO_RCVLOWAT 2022-10-24 15:49:39 +02:00
Gunnar Beutner
01ffed710c Kernel: Add definition for MSB_EOR
None of the protocols we support at the moment use this, but it makes
boost happy.
2022-10-24 15:49:39 +02:00
Gunnar Beutner
1b13d52a87 LibC: Make 'attributes' parameter for pthread_create const 2022-10-24 15:49:39 +02:00
Gunnar Beutner
ce4b66e908 Kernel: Add support for MSG_NOSIGNAL and properly send SIGPIPE
Previously we didn't send the SIGPIPE signal to processes when
sendto()/sendmsg()/etc. returned EPIPE. And now we do.

This also adds support for MSG_NOSIGNAL to suppress the signal.
2022-10-24 15:49:39 +02:00
Tim Schumacher
e5e7ea90b1 Toolchain: Update LLVM to 15.0.3 2022-10-24 15:33:58 +02:00
Linus Groh
9ad6031bca LibWeb: Move internal response in FilteredResponse create() functions 2022-10-24 09:26:16 +01:00
Linus Groh
02a4cba086 LibWeb: Use MUST() for infallible ByteBuffer::copy() invocations
ByteBuffer has an inline capacity of 32 bytes, so when we provide a
string smaller than that, it cannot fail.
2022-10-24 09:26:16 +01:00
Linus Groh
65f5c7adbc LibWeb: Add Fetch::Infrastructure::Header::from_string_pair() helper
This allows us to use this:

```cpp
auto header = TRY_OR_RETURN_OOM(realm,
    Infrastructure::Header::from_string_pair(name, value));
```

Instead of the somewhat unwieldly:

```cpp
auto header = Infrastructure::Header {
    .name = TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(name.bytes())),
    .value = TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(value.bytes())),
};
```
2022-10-24 09:26:16 +01:00
Linus Groh
c12c6fd5ea LibWeb: Fix typo in Fetch::Infrastructure::Request::add_range_header() 2022-10-24 09:24:15 +01:00
Gunnar Beutner
eca4c51f78 Ports: Add Pacman port 2022-10-24 03:25:20 +02:00
Gunnar Beutner
7d4387d383 Ports: Fix building TiMidity++
The build would previously fail if Xorg headers are installed on the
host system.
2022-10-24 03:25:20 +02:00
Andreas Kling
8aab33de5f LibWeb: Skip positioned children in paint_descendants()
Positioned descendants are now handled entirely by paint_internal()
so we can just skip over positioned children in paint_descendants().
This avoids drawing the same boxes multiple times.
2022-10-23 23:32:42 +02:00
Andreas Kling
8bf0e71c0c LibWeb: Paint non-positioned stacking contexts with z-index 0 or auto
As I understand it, these have to be painted interleaved with positioned
descendants in the same z-index category, in tree order.
2022-10-23 23:32:42 +02:00
Andreas Kling
447519f678 LibWeb: Paint positioned descendants with z-index: auto
This "worked" before because all positioned elements would create their
own stacking context. When we stopped doing this, there was nobody to
actually paint positioned descendants with `z-index: auto`.

This patch splits up steps 8 and 9 of the paint order algorithm and
implements step 8 as a paint tree traversal. There's more to step 8 than
I've implemented here, so I've left a FIXME for our future selves.
2022-10-23 23:32:42 +02:00
Andreas Kling
8a0e40c5b0 LibWeb: Update StackingContext::paint_descendants() for new rule
Since positioned elements no longer automatically create stacking
contexts, we can't rely on this assumption when painting descendants of
a stacking context.

In this commit, we fix an issue that manifested as a failure to
Gfx::Painter::restore() in the "Overlay" paint phase. What happened was
that a CSS clip was being applied in the "Background" paint phase, and
then unapplied in the "Overlay" phase. Due to bogus checks in
paint_descendants(), the "Background" phase never ran for positioned
elements, but the "Overlay" phase did.

The check for positioned elements was bogus in the first place and had
never actually worked before, since we would always skip over positioned
descendants due to them having stacking contexts.
2022-10-23 23:32:42 +02:00
Andreas Kling
055a1998c1 LibWeb: StackingContext::paint_descendants() can take const layout node
It doesn't mutate the layout tree in any way.
2022-10-23 23:32:42 +02:00
Andreas Kling
faba3ebfca LibWeb: Don't create stacking contexts for all positioned elements
We were mistakenly creating stacking contexts for all elements with
non-static CSS position.

For `absolute` and `relative`, we should only create stacking contexts
if the `z-index` value is something other than `auto`.

This makes it possible to click the cookie on Cookie Clicker. :^)
2022-10-23 23:32:42 +02:00