Commit graph

28982 commits

Author SHA1 Message Date
Linus Groh
fb85fd4867 LibJS/Tests: Test ShadowRealm.prototype.evaluate() this value type check 2021-10-15 09:36:21 +01:00
Luke Wilde
09536f5f48 LibJS: Fix typo in LHS Object and RHS BigInt loosely equals check
Step 12 was using `lhs.is_bigint()` instead of `rhs.is_bigint()`,
meaning you got:
```js
1n == Object(1n); // true
Object(1n) == 1n; // false
```

This also adds spec comments to is_loosely_equal.
2021-10-15 01:59:09 +01:00
Timothy Flynn
3ad159537e LibUnicode: Use u16 for unique string indices instead of size_t
Typically size_t is used for indices, but we can take advantage of the
knowledge that there is approximately only 46K unique strings in the
generated UnicodeLocale.cpp file. Therefore, we can get away with using
u16 to store indices. There is a VERIFY that will fail if we ever exceed
the limits of u16.

On x86_64 builds, this reduces libunicode.so from 9.2 MiB to 7.3 MiB.
On i686 builds, this reduces libunicode.so from 3.9 MiB to 3.3 MiB.

These savings are entirely in the .rodata section of the shared library.
2021-10-15 00:06:18 +01:00
Andreas Kling
07096b7765 LibWeb: Compute horizontal overflow for the initial containing block
This finally allows LibWeb to scroll pages horizontally instead of just
clipping things at the right edge.
2021-10-15 00:11:21 +02:00
Linus Groh
0241071ca2 LibJS: Use GlobalObject::associated_realm() for function object realms
As outlined in the previous commit, this should be more reliable than
Interpreter::realm(), as we don't always have access to an Interpreter.
2021-10-14 23:02:19 +01:00
Linus Groh
cbbf4abb0d LibJS: Add a way to get from a GlobalObject to its associated Realm
This is just another workaround, but it should be much more reliable
than Interpreter::realm(), especially when allocating NativeFunctions
and ECMAScriptFunctionObjects: we're guaranteed to have a GlobalObject
at that point, and it likely was set as the GlobalObject of a Realm and
can lead us back to it. We're however not guaranteed that the VM can
give us an Interpreter, which is why functions in LibWeb can be a bit
crashy at the moment.

We use a WeakPtr<Realm> to properly handle the unlikely case where the
Realm goes away after associating a GlobalObject to it.

We'll always need _something_ of this sort if we want to support
OrdinaryFunctionCreate and CreateBuiltinFunction without the explicit
realm argument while no JS is running, because they want to use the
current Realm Record (always in the first and as fallback in the second
case).
2021-10-14 23:02:19 +01:00
Andreas Kling
2447b27d97 LibWeb: Implement position:fixed painting at the stacking context level
This makes everything within the stacking context stick show up in the
correct position.
2021-10-14 23:50:33 +02:00
Andreas Kling
7b0cd15495 LibWeb: Cleanup + spec comments in replaced element height computation 2021-10-14 23:22:59 +02:00
Andreas Kling
463ee07c00 LibWeb: Cleanup + spec comments in replaced element width computation 2021-10-14 23:22:59 +02:00
Andreas Kling
27d4ac316f LibWeb: Introduce simple scrollable overflow, size ICB to viewport
Per spec, the initial containing block (ICB) should have the size of the
viewport. We have only done this for the width until now, since we had
no way to express scrollable overflow.

This patch adds Layout::Box::m_overflow_data, an optional struct that
can hold on to information about a box's overflow. Then we have BFC
set the ICB up with some scrollable overflow instead of sizing it to fit
its content vertically.

This fixes a number of broken layouts where correctness depends on
having the appropriate ICB height.
2021-10-14 23:22:59 +02:00
Andreas Kling
c94873806c LibWeb: Make ReplacedBox intrinsic size setters take Optional<float>
This allows callers to unset the respective intrinsic sizes by passing
an empty Optional.
2021-10-14 23:22:59 +02:00
Valtteri Koskivuori
a38983dc0c ConfigServer: Sync config files to disk automatically
At the risk of introducing premature optimization, it only syncs to disk
5 seconds after the latest valid configuration update, to handle cases
where programs might send frequent updates that would go to disk every
time otherwise.
Also syncs to disk when the client connection closes.

Co-authored-by: Timothy Flynn <trflynn@pm.me>
2021-10-14 21:41:48 +02:00
Andreas Kling
410e2b43ce LibWeb: Use Box::has_intrinsic_aspect_ratio() check in FFC step 3
Now that we can ask any Box about its intrinsic aspect ratio, let's fix
a FIXME in FlexFormattingContext.
2021-10-14 19:42:09 +02:00
Andreas Kling
a58cc2eeb4 LibWeb: Rename "intrinsic ratio" => "intrinsic aspect ratio" 2021-10-14 18:48:49 +02:00
Andreas Kling
81590b1804 LibWeb: Make intrinsic width/height/ratio a Box concept and simplify it
Apparently it's not only replaced elements that can have intrinsic
sizes, so let's move this concept from ReplacedBox to Box. To avoid
bloating Box, we make the accessors virtual.
2021-10-14 18:39:27 +02:00
Linus Groh
1b1bf5c321 LibJS: Change normal_completion() parameter to Optional<Value>
The Completion constructor `VERIFY()`s that the passed argument is not
an empty Value, so normal_completion({}) would crash (although it's
currently not being used anywhere).
We want to pass an empty Optional<Value> instead.
2021-10-14 11:13:05 +01:00
James Mintram
a48985422c Kernel: Add UBSanitizer.cpp to the Aarch64 kernel build 2021-10-14 10:20:03 +01:00
Timothy Flynn
ebe704a03d LibWeb: Stub out a basic IntersectionObserver interface
Note there are a couple of type differences between the spec and the IDL
file added in this commit. For example, we will need to support a type
of Variant to handle spec types such as "(double or sequence<double>)".
But for now, this allows web pages to construct an IntersectionObserver
with any valid type.
2021-10-14 10:32:51 +02:00
Timothy Flynn
ff66218631 LibWeb: Allow creating "any" types in IDL with integral default values
This enables defining "any" types in IDL files such as:

    any threshold = 0;

This isn't able to parse decimal values yet.
2021-10-14 10:32:51 +02:00
Luke Wilde
b7404015aa Base: Add a test for the early return steps of "prepare a script"
This tests the early return steps of "prepare a script" that come
_before_ step 10 "Set the element's "already started" flag". The
relevant steps are steps 6, 7 and 8. If this algorithm returns on any
of these steps, the script can be reinserted matching the requirements
and will run.

https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script

I wrote this test page up while testing something else, but found a bug
in Firefox where it doesn't allow re-preparing the script if step 8
fails: https://bugzilla.mozilla.org/show_bug.cgi?id=1735590
2021-10-14 10:32:13 +02:00
James Mintram
ceb3328877 Kernel: Fix all linker errors for Aarch64 build 2021-10-14 01:23:08 +01:00
James Mintram
ab70268d61 Kernel: Add the AK sources to the Aarch64 kernel build 2021-10-14 01:23:08 +01:00
James Mintram
545ce5b595 Kernel: Add per platform Processor.h headers
The platform independent Processor.h file includes the shared processor
code and includes the specific platform header file.

All references to the Arch/x86/Processor.h file have been replaced with
a reference to Arch/Processor.h.
2021-10-14 01:23:08 +01:00
James Mintram
23676bee1f Kernel: Add -fsigned-char to ensure consistency across platforms 2021-10-14 01:23:08 +01:00
James Mintram
2a4969d281 Kernel: Move asserts inside platform #if clauses 2021-10-14 01:23:08 +01:00
James Mintram
580006d784 Kernel: Replace includes with a forward declaration 2021-10-14 01:23:08 +01:00
James Mintram
baa7925c0c Kernel: Remove unused includes 2021-10-14 01:23:08 +01:00
James Mintram
26d7c25076 Kernel: Add header includes closer to their use 2021-10-14 01:23:08 +01:00
Linus Groh
1adf57530c js: Implement pretty-printing of ShadowRealm 2021-10-14 00:41:41 +01:00
Linus Groh
c70784bb82 LibJS: Implement ShadowRealm.prototype.evaluate() 2021-10-14 00:41:41 +01:00
Linus Groh
b0ee7f38d0 LibJS: Implement ShadowRealm.prototype[@@toStringTag] 2021-10-14 00:41:41 +01:00
Linus Groh
d40331ef69 LibJS: Start implementing ShadowRealm
This commit adds the ShadowRealm object itself, its constructor, and
prototype (currently empty).
2021-10-14 00:41:41 +01:00
Linus Groh
50f8755792 LibJS: Implement Wrapped Function Exotic Objects
This is a new concept from the ShadowRealm API stage 3 proposal:
https://tc39.es/proposal-shadowrealm/#sec-wrapped-function-exotic-objects
2021-10-14 00:41:41 +01:00
James Mintram
d92967406a Kernel: Add post build step to generate kernel8.img
Add a postbuild step which creates a raw binary file called kernel8.img
from the Prekernel elf file.
2021-10-13 23:34:29 +01:00
Andreas Kling
42f6bd5f83 LibWeb: Add spec comments to FFC layout algorithm step 2 2021-10-13 23:56:26 +02:00
Andreas Kling
1d0c4a07ff LibWeb: Add spec comments to FFC layout algorithm step 5 2021-10-13 23:56:26 +02:00
Andreas Kling
82bb5ef8b7 LibWeb: Tidy up and add spec comments to FFC layout algorithm step 3 2021-10-13 23:56:26 +02:00
Andreas Kling
1e832dd91a LibWeb: Add CSS::FlexBasisData::is_definite()
This will allow some more expressive code in FlexFormattingContext.
2021-10-13 23:56:26 +02:00
Andreas Kling
d37e5dc64c LibWeb: Add FFC::flex_container() and use throughout
Since FFC is only ever run() on the flex container, we can assume (but
verify) that the run box is the flex container and use an accessor
throughout. The end result: less parameter passing.
2021-10-13 23:56:26 +02:00
Andreas Kling
1580c59f39 LibWeb: Make FFC line and item vectors members instead of locals
This gives all member functions access to these vectors without having
to pass them as arguments.
2021-10-13 23:56:26 +02:00
Andreas Kling
c793797e61 LibWeb: Make various function parameters const in FlexFormattingContext
This is mainly to validate that inputs are treated as inputs only and
don't get written to.
2021-10-13 23:56:26 +02:00
Andreas Kling
9359df4be9 LibWeb: Move FFC layout algorithm step 16 to a separate function 2021-10-13 23:56:26 +02:00
Andreas Kling
f401794d23 LibWeb: Move FFC layout algorithm step 15 to a separate function 2021-10-13 23:56:26 +02:00
Andreas Kling
6d433c99f4 LibWeb: Move FFC layout algorithm step 14 to a separate function 2021-10-13 23:56:26 +02:00
Andreas Kling
e590e17b8a LibWeb: Move FFC layout algorithm step 12 to a separate function 2021-10-13 23:56:26 +02:00
Andreas Kling
176f1ad214 LibWeb: Move FFC layout algorithm step 11 to a separate function 2021-10-13 23:56:26 +02:00
Andreas Kling
8f027b4792 LibWeb: Move FFC layout algorithm step 8 to a separate function 2021-10-13 23:56:26 +02:00
Andreas Kling
3402584646 LibWeb: Move FFC layout algorithm step 7 to a separate function 2021-10-13 23:56:26 +02:00
Andreas Kling
0c0df78030 LibWeb: Move FFC layout algorithm step 6 to a separate function 2021-10-13 23:56:26 +02:00
Andreas Kling
0fd25fcbbc LibWeb: Move FFC layout algorithm step 5 to a separate function 2021-10-13 23:56:26 +02:00