Commit graph

54991 commits

Author SHA1 Message Date
Sam Atkins a3a5af3fd1 LibWeb: Implement length and item() for ResolvedCSSStyleDeclaration 2023-09-29 20:20:55 +02:00
Sam Atkins 08cf35cf9a LibWeb: Allow indexing into CSSStyleDeclaration by number
The `item(unsigned long index)` method is marked as a getter in IDL, so
let's treat it as such.
2023-09-29 20:20:55 +02:00
Sam Atkins 33e4a35d2d LibWeb: Resolve style for box-shadow and text-shadow 2023-09-29 15:12:09 +01:00
Sam Atkins 44836cd8ed LibWeb: Resolve style for logical-side length properties
For now, we just hard-code the logical sides to physical ones, but at
least the hard-coding is all in one place. :^)
2023-09-29 15:12:09 +01:00
Sam Atkins 2fa1df2ec4 LibWeb: Implement resolved style for line-height 2023-09-29 15:12:09 +01:00
Sam Atkins 30e31d83b6 LibWeb: Construct resolved shorthands from resolved longhands
Recursively call `style_value_for_property()` for the longhands, instead
of duplicating the logic to construct them.
2023-09-29 15:12:09 +01:00
Sam Atkins 737cccec70 LibWeb: Remove manual construction of resolved sided-border values
The automatic shorthand code will handle these just fine.
2023-09-29 15:12:09 +01:00
Sam Atkins 77fb85d27a LibWeb: Add spec comments to style_value_for_property()
Also, re-order things to match. No behaviour changes.

This reveals quite a few properties that are missing here, or which we
implement somewhat incorrectly.
2023-09-29 15:12:09 +01:00
Niklas Poslovski 485ae28ba7 AK: Add support for backtraces on Haiku 2023-09-29 15:11:52 +01:00
Karol Kosek 9ce2682ce6 Userland: Port lists of mime types to String 2023-09-29 14:40:21 +01:00
Karol Kosek e75d694974 Userland: Compare event MIME type list with a StringView
The following commit will port MIME types to String. Traits<String>
- used in Vector::contains_slow - can't compare String type with char*,
so we need to use StringView instead.
2023-09-29 14:40:21 +01:00
Karol Kosek 2f35348104 Userland: Store MIME keys as String in Core::MimeData 2023-09-29 14:40:21 +01:00
Karol Kosek 4f638d3af2 Userland: Take StringView in MimeData::data() and has_{format,text,urls} 2023-09-29 14:40:21 +01:00
Tim Ledbetter d054116012 Documentation: Replace TRY() example in Patterns.md
The `Menubar::add_menu()` call used in the previous code snippet no
longer returns `ErrorOr`, which defeats the purpose of the example.
2023-09-29 14:05:46 +01:00
Sam Atkins dcf3bdcb9a LibWeb: Use correct realm when focusing HTMLTextAreaElement
This matches HTMLInputElement, and fixes the crash when focusing a
textarea.
2023-09-29 07:21:43 -04:00
Bastiaan van der Plaat b32b277192 Ladybird/AppKit: Move frameAutosaveName inside if block 2023-09-29 07:21:31 -04:00
Bastiaan van der Plaat 0ce9dc4c8e Ladybird/AppKit: Add color picker support 2023-09-29 06:27:05 -04:00
Oskar Skog ebee480bcc Ports/python3: Update patch for configure
- Dropped modifications to `configure.ac`
- "Merged" `0007-Set-name-of-shared-libpython.patch` into
  `0002-Tweak-configure.patch`
- Use `CCSHARED=fPIC`
2023-09-29 09:55:48 +02:00
Andre Herbst 14d8403a7b Ports/zig: Bump zig version to 0.12.0-dev.141+ddf5859c2
Fixes build error
```
error "It looks like you're trying to enable vendor availability
markup, but you haven't defined the corresponding macros yet!"
```
while trying to #include <__availability> header without having
the necessary preprocessor directive
`_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS` set
2023-09-29 00:58:17 +02:00
Sam Atkins ca16a1ed08 LibWeb: Store GridSize values as a Variant
A GridSize can't hold both a LengthPercentage and a Flex at the same
time, so let's limit that.
2023-09-28 20:33:20 +01:00
Sam Atkins b66ff21379 LibWeb: Add missing check for flexible grid tracks
Previously this didn't cause issues because the default flex-factor is
0, but once we only store a flex-factor for FlexibleLength-type
GridSizes, this causes a crash.
2023-09-28 20:33:20 +01:00
Sam Atkins 127bfd64a8 LibWeb: Use Flex type in GridSize 2023-09-28 20:33:20 +01:00
Sam Atkins dfd3d9a72d LibWeb: Support flex in typed attr() 2023-09-28 20:33:20 +01:00
Sam Atkins b0317bb3a1 LibWeb: Implement Flex and FlexStyleValue types 2023-09-28 20:33:20 +01:00
Sam Atkins f1d7ea67c0 LibWeb: Add missing check for frequency values 2023-09-28 20:33:20 +01:00
Aliaksandr Kalenik 66b7da4fc7 LibJS: Remove unused make_super_property_reference()
This function is no longer used anywhere after we removed AST
interpreter.
2023-09-28 20:34:47 +02:00
Héctor Molinero Fernández b7676d3bad Ports: Generate OpenSSH host keys using a service 2023-09-28 20:26:38 +02:00
Nico Weber 563bb9d20c ICC: Implement Profile::to_pcs() for grayscale colors
There's probably a nicer way of doing this where we don't need to expand
the gray value into a full Vector3, but for now this is good enough.

Makes PDFs written by macOS 13.5.2's "Save as PDF..." feature show up.
2023-09-28 16:57:31 +01:00
Nico Weber 6b4da8680d ICC: Move a lambda up a bit
No behavior change.
2023-09-28 16:57:31 +01:00
Aliaksandr Kalenik 42e9dfedc2 LibJS: Pre-calculate the number of bindings for function environments
We can use `ensure_capacity` for binding vectors if we know their sizes
in advance. This ensures that binding vectors aren't reallocated during
the `function_declaration_instantiation` execution.

With this change, `try_grow_capacity()` and `shrink_to_fit()` are no
longer visible in the `function_declaration_instantiation()` profiles
when running React-Redux-TodoMVC from Speedometer.
2023-09-28 15:33:43 +02:00
Aliaksandr Kalenik 98f479318a LibJS: Do not create environment bindings for local variables
If variable is local it is not stored in an environment so we don't
need a binding.
2023-09-28 15:33:43 +02:00
Aliaksandr Kalenik 4561469d52 LibJS: Fix BindingPattern::contains_expression() is name is expression
If any of binding pattern entry's name is expession
`contains_expression()` should return true.

For example:
```js
function evalInComputedPropertyKey(
  {[eval("var x = 'inner'")]: ignored}
) {}
```

`contains_expression()` should return true for the binding param in
this function.
2023-09-28 15:33:43 +02:00
Andreas Kling aeb8b5685f LibJS: Make Bytecode::Generator::emit() return void
There are no callers left that use the return value.
2023-09-28 14:52:03 +02:00
Andreas Kling 887183cad6 LibJS: Remove last user of Op::Jump::set_targets() and API itself
This was just a matter of instantiating a BasicBlock earlier so we
can reference it when making the jump.
2023-09-28 14:52:03 +02:00
Andreas Kling bdd21cf9db LibJS: Remove almost all uses of Op::Jump::set_targets()
We should initialize jump targets when constructing the jump instruction
instead of doing it later. This was already the case in all construction
sites but one. This first patch converts all those sites to pass final
targets to the constructor directly.
2023-09-28 14:52:03 +02:00
Andreas Kling 84850700a0 LibJS: Make BC::Generator::emit_with_extra_register_slots() return void
Nobody was using the return value.
2023-09-28 14:52:03 +02:00
Sam Atkins 9e99368694 LibWeb: Track quote-nesting level while building the layout tree
This makes multiple levels of quote actually use different quotation
marks, instead of always the first available pair of them.

Each Layout::Node remembers what the quote-nesting level was before its
content was evaluated, so that we can re-use this number in
`apply_style()`. This is a bit hacky, since we end up converting the
`content` value into a string twice.

`StyleProperties::content()` now takes an initial quote-nesting level,
and returns the final level after that content.
2023-09-28 14:49:10 +02:00
Sam Atkins 493dd5d93c LibWeb: Create ::before pseudo-element before element children
This allows any effects of `content` (eg quotes and counters) to happen
in the right order.

To make it work there are a couple of other changes needed:
- Skip nodes generated by ::before when constructing button layout.
- When in a flex parent, don't merge an inline text node into a previous
  one that is generated from a pseudo-element.
2023-09-28 14:49:10 +02:00
Sam Atkins d431aeed04 LibWeb: Repeat last available quote-type, instead of looping them all
I misunderstood this part of the spec before.
2023-09-28 14:49:10 +02:00
Shannon Booth 2d8b2328fd LibJS: Syntax error for a unary expression followed by exponentiation
This change makes LibJS correctly report a syntax error when a unary
expression is followed by exponentiation, as the spec requires.
Apparently this is due to that expression being ambiguous ordering.

Strangely this check does not seem to apply in the same way for '++' and
'--' for reasons that I don't fully understand. For example

```
let x = 5;
++x ** 2
```

Since `--5` and `++5` on it's own results in a syntax error anyway, it
seems we do not need to perform this exponentiation check in those
places.

Diff Tests:
    +6     -6 
2023-09-28 13:11:11 +02:00
Bastiaan van der Plaat 5e7a82a853 LibWeb: Create canvas bitmap when not existing in toDataURL and toBlob 2023-09-28 13:09:25 +02:00
Andreas Kling d24e07579f LibJS: Use a Vector<u8> for BasicBlock instruction storage
This reduces the minimum size of a basic block from 4 KiB to 0 bytes.
With this change, memory usage at the end of Speedometer is 1.2 GiB,
down from 1.8 GiB.
2023-09-28 11:25:19 +02:00
Andreas Kling 89a86798a2 Meta: Add note about tests to CONTRIBUTING.md 2023-09-28 06:25:40 +02:00
Aliaksandr Kalenik 32be413f4e LibWeb: Add missing visit_edges() for ImageStyleValue
ImageStyleValue has a visit_edges() method, although it is not a
GC-allocated object. This is necessary because it owns a GC-allocated
ImageRequest that we want to visit, instead of using JS::Handle, to
avoid leaks. In the future, we might want to make StyleValue be
GC-allocated.

For now, this change adds missing visit_edges() calls for objects that
own ImageStyleValue.
2023-09-28 06:11:17 +02:00
Aliaksandr Kalenik b43b3d2f8d LibWeb: Null check container while creating srcdoc navigation params
Fixes https://github.com/SerenityOS/serenity/issues/21205
Fixes https://github.com/SerenityOS/serenity/issues/21240
2023-09-28 06:09:52 +02:00
Andreas Kling feedbd6a01 LibJS: Put __builtin_unreachable() in unused bytecode opcode handlers
For the opcodes that are handled directly in the interpreter loop,
we want the compiler to know that there's nothing to inline here.
2023-09-28 06:09:16 +02:00
Andreas Kling f3606adc58 LibJS: Inline bytecode ops for direct local/register access
These can do a lot less stuff if we put them directly in the interpreter
loop and allow them to access the locals/registers arrays directly.
2023-09-28 06:09:16 +02:00
Andreas Kling ae1ac9871b LibJS: Move all bytecode instruction implementations to Interpreter.cpp
This allows aggressive inlining without LTO.
2023-09-28 06:09:16 +02:00
Andreas Kling e5474c384d LibJS: Inline flow control ops in the bytecode interpreter loop
Instead of calling out to helper functions for flow control (and then
checking control flags on every iteration), we now simply inline those
ops in the interpreter loop directly.
2023-09-28 06:09:16 +02:00
Andreas Kling 39cfb64269 LibJS: Return early from Interpreter on unhandled exception
If we don't have a local unwind context to handle the exception, we can
just return right away. This allows us to remove one check from the
inner loop.
2023-09-28 06:09:16 +02:00