Commit graph

49171 commits

Author SHA1 Message Date
Matteo Benetti
3e1626acdc Spreadsheet+LibSyntax: Never insert spans directly
Function `CellSyntaxHighlighter::rehighlight()` direct inserted spans
to TextDocument `m_span` vector missing out important reordering and
merging operation carried out by `TextDocument::set_spans()`.

This caused overlapping spans for a cell with only a `=` symbol
(one for the actual token and one for the highlighting) to
miscalculate `start` and `end` value and a `length` value (of
`size_t` type) with a `0-1` substraction (result: 18446744073709551615)
causing `Utf32View::substring_view()` to fail the
`!Checked<size_t>::addition_would_overflow(offset, length)` assertion

This remove the possibility to directly alter `TextDocument`'s spans
thus forcing the utilization of `HighlighterClient::do_set_spans()`
interface function.

Proper refactor have been applied to
`CellSyntaxHighlighter::rehighlight()` function
2023-04-14 10:00:52 +02:00
Cubic Love
fb47b988ca Base: Add US English Apple Macintosh keymap
Add the full alt + shift-alt keymap for the EN-US Apple Keyboard Layout
2023-04-14 10:00:06 +02:00
Linus Groh
89503a0cfe LibJS: Port PrototypeObject::typed_this_value() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Linus Groh
a23dd88f61 LibJS: Port PrototypeObject::typed_this_object() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Linus Groh
15360e50d3 LibJS: Port PrototypeObject::this_object() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Linus Groh
b33b0d60e6 LibJS: Port Value::get_method() to GCPtr 2023-04-14 09:59:29 +02:00
Linus Groh
9279b0780d LibJS: Port Value::to_bigint() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Linus Groh
f345f72b55 LibJS: Port Value::to_object() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Linus Groh
e79f5b6e85 LibJS: Port Value::to_primitive_string() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
Srikavin Ramkumar
04198a29a8 Base: Fix typo in cursor test page 2023-04-14 09:57:49 +02:00
Srikavin Ramkumar
627d68acdf Ladybird: Display Qt cursors corresponding to missing CSS cursors 2023-04-14 09:57:49 +02:00
Srikavin Ramkumar
33686c8a63 LibWeb: Support NotAllowed CSS cursor 2023-04-14 09:57:49 +02:00
Timon Kruiper
957f89ce4a AK: Add very naive implementation of {sin,cos,tan} for aarch64
The {sin,cos,tan} functions in AK are used as the implementation of the
same function in libm. We cannot use the __builtin_foo functions as
these would just call the libc functions. This was causing an infinite
loop. Fix this by adding a very naive implementation of
AK::{sin, cos,tan}, that is only valid for small inputs. For the other
functions in this file, I added a TODO() such that we'll crash, instead
of infinite looping.
2023-04-13 20:24:25 +02:00
Timon Kruiper
9ed04bdb33 Kernel/aarch64: Add implementation of Processor::for_each 2023-04-13 20:24:25 +02:00
Timon Kruiper
4927eb5396 Kernel/aarch64: Change RPi::Framebuffer::PixelOrder to BGR
This is what the WindowServer expects. Confusingly the pixel format for
MULTIBOOT_FRAMEBUFFER_TYPE_RGB is actually BGRx8888.
2023-04-13 20:22:08 +02:00
Timon Kruiper
baa5cb9e30 Kernel/aarch64: Add volatile modifier to various asm statements
This prevents the optimizer from reordering them, which hopefully
prevents future bugs.
2023-04-13 20:22:08 +02:00
Timon Kruiper
10030038e9 Kernel/aarch64: Make sure no reordering of DAIF::read is possible
We were crashing on the VERIFY_INTERRUPTS_DISABLED() in
RecursiveSpinlock::unlock, which was caused by the compiler reordering
instructions in `sys$get_root_session_id`. In this function, a SpinLock
is locked and quickly unlocked again, and since the lock and unlock
functions were inlined into `sys$get_root_session_id` and the DAIF::read
was missing the `volatile` keyword, the compiler was free to reorder the
reads from the DAIF register to the top of this function. This caused
the CPU to read the interrupts state at the beginning of the function,
and storing the result on the stack, which in turn caused the
VERIFY_INTERRUPTS_DISABLED() assertion to fail. By adding the `volatile`
modifier to the inline assembly, the compiler will not reorder the
instructions.

In aa40cef2b7, I mistakenly assumed that the crash was related to the
initial interrupts state of the kernel threads, but it turns out that
the missing `volatile` keyword was the actual problem. This commit also
removes that code again.
2023-04-13 20:22:08 +02:00
Tom
7795b7bc17 WindowServer: Refactor window geometry overlay rect calculation logic
This moves the ideal overlay rect calculation into its own function.
2023-04-13 20:18:49 +02:00
Tom
e1077ebbad WindowServer: Prevent some overdraw by the window geometry overlay
While the window geometry overlay is centered inside the tile overlay
neither the text nor the location change, so there is no need to
re-render and update it every time the window moves.
2023-04-13 20:18:49 +02:00
Tom
5a73691fe9 WindowServer: Move window geometry label into the tile overlay area
This moves the window geometry overlay into the center of the
tile window overlay when it's visible or when it moves.
2023-04-13 20:18:49 +02:00
Tom
fe54a0ca27 WindowServer: Implement tile window overlay
This adds a tiling mode that will show a tile window overlay rather
than immediately tiling a window, triggering window resizes.
2023-04-13 20:18:49 +02:00
Tom
035b0f9df6 LibGfx: Add Rect::interpolated_to function
This function interpolates the edges between the rectangle and another
rectangle based on a percentage value.
2023-04-13 20:18:49 +02:00
Tom
9ff1fa1cf3 WindowServer: Fix some gliches when overlays are moved or removed
Keep track of areas that overlays were rendered to when we recompute
occlusions. This allows us to then easily figure out areas where
overlays were moved from or removed from.
2023-04-13 20:18:49 +02:00
Tom
426d1b7410 WindowServer: Only register animations when they're running
This allows us to keep Animation objects around, and the compositor
will only use them when the animation is actually running.
2023-04-13 20:18:49 +02:00
Tom
fa7f9b0f35 WindowServer: Fix calculating tile rect on secondary screens
The screen rectangle's origin is only {0, 0} on the main screen, so
we need to move the tile rectangle relative to its location.
2023-04-13 20:18:49 +02:00
Tom
6f9c5b71fd WindowServer: Use enum class for Effects and ShowGeometry 2023-04-13 20:18:49 +02:00
Luke Wilde
2125464b76 LibWeb: Don't match the root node of HTMLCollection
Every user of HTMLCollection does not expect the root node to be a
potential match, so let's avoid it by using non-inclusive sub-tree
traversal. This avoids matching the element that getElementsByTagName
was called on for example, which is required by Ruffle:
da689b7687/web/packages/core/src/ruffle-object.ts (L321-L329)
2023-04-13 18:24:18 +02:00
Timothy Flynn
f80c05424e LibLocale: Update to CLDR version 43.0.0
https://cldr.unicode.org/index/downloads/cldr-43
2023-04-13 18:22:04 +02:00
Timothy Flynn
0b69e9f974 LibLocale: Prepare locale data generator for breaking changes in CLDR 43
In CLDR 42 and earlier, we were able to assume all cldr-localename files
existed for every locale. They now do not exist for locales that don't
provide any localized data. Namely, this is the "und" locale (which is
an alias for the root locale, i.e. the locale we fall back to when a
user provides an unknown locale).

Further, we were previously able to assume that each currencies.json in
cldr-numbers contained all currencies. This file now excludes currencies
whose localized names are the same as the currency key. Therefore, we
now preprocess currencies.json to discover all currencies ahead of time,
much like we already do for languages.json.
2023-04-13 18:22:04 +02:00
Linus Groh
259a84b7b6 Documentation: Document preference for SCREAMING_CASE constants 2023-04-13 15:57:30 +02:00
Andreas Kling
01ca7e0544 LibWeb: Whine instead of dying on unexpected box during line layout
Log a FIXME on the debug log, along with a layout tree dump of the box
that we didn't expect to see. This will be annoying (until fixed),
but far less so than crashing the browser.
2023-04-13 14:30:16 +02:00
Linus Groh
2555d7a36a LibJS: Make well-known symbol getters return NonnullGCPtr
None of these are ever null after the VM has been initialized, as proved
by virtually every caller immediately dereferencing the raw pointer.
2023-04-13 14:29:42 +02:00
Linus Groh
b84f8fb55b LibJS: Make intrinsics getters return NonnullGCPtr
Some of these are allocated upon initialization of the intrinsics, and
some lazily, but in neither case the getters actually return a nullptr.

This saves us a whole bunch of pointer dereferences (as NonnullGCPtr has
an `operator T&()`), and also has the interesting side effect of forcing
us to explicitly use the FunctionObject& overload of call(), as passing
a NonnullGCPtr is ambigous - it could implicitly be turned into a Value
_or_ a FunctionObject& (so we have to dereference manually).
2023-04-13 14:29:42 +02:00
Linus Groh
ed9e2366da LibJS: Add spec comments to WeakSetPrototype 2023-04-13 13:04:44 +02:00
Linus Groh
bccffed7e9 LibJS: Add spec comments to WeakSetConstructor 2023-04-13 13:04:44 +02:00
Linus Groh
77fc05afd6 LibJS: Add spec comments to WeakRefPrototype 2023-04-13 13:04:44 +02:00
Linus Groh
7c9f1dcced LibJS: Add spec comments to WeakRefConstructor 2023-04-13 13:04:44 +02:00
Linus Groh
7bf92b5c3b LibJS: Add spec comments to WeakMapPrototype 2023-04-13 13:04:44 +02:00
Linus Groh
627dc1b88b LibJS: Add spec comments to WeakMapConstructor 2023-04-13 13:04:44 +02:00
Linus Groh
89bcc05a0d LibJS: Add spec comments to TypedArrayPrototype 2023-04-13 13:04:44 +02:00
Linus Groh
aefa053473 LibJS: Add spec comments to TypedArrayConstructor 2023-04-13 13:04:44 +02:00
Linus Groh
81c6ad047a LibJS: Add spec comments to SymbolPrototype 2023-04-13 13:04:44 +02:00
Linus Groh
0ae511edae LibJS: Add spec comments to SymbolConstructor 2023-04-13 13:04:44 +02:00
Linus Groh
066133d97b LibJS: Add spec comments to StringConstructor 2023-04-13 13:04:44 +02:00
Linus Groh
1b3c3f9777 LibJS: Add spec comments to SetPrototype 2023-04-13 13:04:44 +02:00
Linus Groh
58566d2a3f LibJS: Add spec comments to SetConstructor 2023-04-13 13:04:44 +02:00
Sam Atkins
d0f80b40b2 LibWeb: Reimplement CalculatedStyleValue as a calculation node tree
VALUES-4 defines the internal representation of `calc()` as a tree of
calculation nodes. ( https://www.w3.org/TR/css-values-4/#calc-internal )

VALUES-3 lacked any definition here, so we had our own ad-hoc
implementation based around the spec grammar. This commit replaces that
with CalculationNodes representing each possible node in the tree.

There are no intended functional changes, though we do now support
nested calc() which previously did not work. For example:
    `width: calc( 42 * calc(3 + 7) );`

I have added an example of this to our test page.

A couple of the layout tests that used `calc()` now return values that
are 0.5px different from before. There's no visual difference, so I
have updated the tests to use the new results.
2023-04-13 09:53:47 +02:00
Sam Atkins
5f2f780662 LibWeb: Expose type and raw values of basic CSS types
This makes it possible to do arithmetic on them without having to
resolve to their canonical unit, which often requires context
information that is not available until the last minute. For example, a
Length cannot be resolved to px without knowing the font size, parent
element's size, etc.

Only Length currently requires such context, but treating all these
types the same means that code that manipulates them does not need to
know or care if a new unit gets added that does require contextual
information.
2023-04-13 09:53:47 +02:00
Sam Atkins
89e55c5297 AK+Tests: Add Vector::find_first_index_if() 2023-04-13 09:53:47 +02:00
Sam Atkins
1352f8820b LibWeb: Simplify CalculatedStyleValue types to match CSS-VALUES-4 :^)
Level 4 drops the limitations of what types can be a denominator, which
means `<calc-number-sum>`, `<calc-number-product>` and
`<calc-number-value>` all go away.
2023-04-13 09:53:47 +02:00