Commit graph

52143 commits

Author SHA1 Message Date
Timothy Flynn af5eaf5edf Base: Add a test page to log KeyboardEvent data
This page prepends a row to a table with the last-received
KeyboardEvent.
2023-07-09 06:32:20 +02:00
Timothy Flynn cd995d113b LibWeb: Implement KeyboardEvent.location closer to the spec 2023-07-09 06:32:20 +02:00
Timothy Flynn 71bf9f1d0d LibWeb: Implement KeyboardEvent.key according to the spec
This implementation only includes key codes marked as required by the
spec, as those are the only keys we have in our kernel.
2023-07-09 06:32:20 +02:00
Timothy Flynn 64022031c4 LibWeb: Implement KeyboardEvent.code according to the spec
This implementation only includes key codes marked as required by the
spec, as those are the only keys we have in our kernel.
2023-07-09 06:32:20 +02:00
Timothy Flynn f319f72d00 Ladybird: Add a few missing Qt-to-Serenity keycode mappings
And add a link to the Qt documentation that maps event keys to their
enumerated names for convenience.
2023-07-09 06:32:20 +02:00
Timothy Flynn 2945e4b8e9 LibWeb: Add spec links for the KeyboardEvent IDL
Mostly for convenience.
2023-07-09 06:32:20 +02:00
Timothy Flynn ddf4f6f44f Ladybird: Include the keypad modifier in key events sent to WebContent 2023-07-09 06:32:20 +02:00
Timothy Flynn f798e43ea8 Kernel: Add a key code modifier to detect the number pad
This is analagous to how Qt exposes whether the number pad was used for
a key press.
2023-07-09 06:32:20 +02:00
Andi Gallo 4c81d39483 LibWeb: Adjust border widths for tables using collapsing borders
When using the collapsing border model, cells on either side of the edge
get half the specified width of the border for their box model.
2023-07-09 06:29:43 +02:00
Aliaksandr Kalenik 8b6450842e LibJS: Use local variables for function declarations when possible
Previously, the usage of local variables was limited for all function
declarations. This change relaxes the restriction and only prohibits
locals for hoistable annexB declarations.
2023-07-09 06:26:10 +02:00
Aliaksandr Kalenik 167495b87b LibJS/Bytecode: Always return false on attempt to delete local variable
Since it is not possible for delete operator to return true when it is
applied to local variable, DeleteVariable can safely always return
false for locals.

This also fixes operators/delete-local-variable.js in test-js.
2023-07-09 06:26:10 +02:00
Ali Mohammad Pur 0c5c75e8a4 LibCore: Slightly rework the Core::Promise API
The previous iteration of this API was somewhat odd and rough in random
places, which degraded usability and made less than perfect sense.
This commit reworks the API to be a little closer to more
conventional promise APIs (a la javascript promises).

Also adds a test to ensure the class even works.
2023-07-08 23:13:00 +01:00
Ali Mohammad Pur 5a0ad6812c AK: Add a CallableAs<R, Args...> concept
This is just the concept version of the IsCallableWithArguments type
trait previously defined in Function.h.
2023-07-08 23:13:00 +01:00
Lucas CHOLLET 35599605c1 LibGfx/BMP: Move some const to the east 2023-07-08 22:56:30 +01:00
Lucas CHOLLET fd765d2031 LibGfx/ICO: Fix an erroneous condition
This is a remnant of the conversion to `ErrorOr` done in 492d5d7c.
2023-07-08 22:56:30 +01:00
MacDue 91e1a77854 SpiceAgent: Pledge cpath
Without this the spice agent can't create files on drag/drop.
2023-07-08 22:55:06 +01:00
Xexxa c0528d4188 Base: Add more emoji
🫃 - U+1FAC3 PREGNANT MAN
🫄 - U+1FAC4 PREGNANT PERSON
🤺 - U+1F93A PERSON FENCING
🤾 - U+1F93E PERSON PLAYING HANDBALL
🤾‍♂️ - U+1F93E U+200D U+2642 MAN PLAYING HANDBALL
🤾‍♀️ - U+1F93E U+200D U+2640 WOMAN PLAYING HANDBALL
🧁 - U+1F9C1 CUPCAKE
🗼 - U+1F5FC TOKYO
🪈 - U+1FA88 FLUTE
2023-07-08 22:51:42 +01:00
Xexxa 74e77c205d Base: Adjust emoji
Align U+1F451 and U+1F450 vertically to better align with other emoji

👐 - U+1F450 OPEN HANDS
👑 - U+1F451 CROWN
2023-07-08 22:51:42 +01:00
Xexxa 6303285b1c Base: Adjust emoji
Make clothes color of U+1F930 match other emoji better

🤰 - U+1F930 PREGNANT WOMAN
2023-07-08 22:51:42 +01:00
sarsaparilla89 9ac4470b9b LibC: Fix max value of short 2023-07-08 15:53:02 -04:00
Xexxa c09bcc2f16 Base: Add more emoji
🦸 - U+1F9B8 SUPERHERO
🦹 - U+1F9B9 SUPERVILLAIN
🧍 - U+1F9CD PERSON STANDING
🧍‍♂️ - U+1F9CD U+200D U+2642 MAN STANDING
🧍‍♀️ - U+1F9CD U+200D U+2640 WOMAN STANDING
🦰 - U+1F9B0 RED HAIR (component)
🦱 - U+1F9B1 CURLY HAIR (component)
🦳 - U+1F9B3 WHITE HAIR (component)
🦲 - U+1F9B2 BALD (component)
🥯 - U+1F96F BAGEL
🚜 - U+1F69C TRACTOR
🪪 - U+1FAAA IDENTIFICATION CARD
2023-07-08 18:48:42 +01:00
Aliaksandr Kalenik c4656a70c1 LibJS: Allow usage of locals if function parameters have default values
Initially, the usage of local variables for parameters had to be
disabled when default values were used because there was a bug that
didn't allow to correctly find the scope to which identifiers used
within the default parameter expression belonged, and hence correctly
identify if a variable can be local. However, this bug was fixed in
2f85faef0f, so now this restriction
is no longer needed.
2023-07-08 15:36:36 +02:00
Ali Mohammad Pur 59e8f713db LibWasm: Implement Element section segment type 4 2023-07-08 15:13:25 +02:00
Ali Mohammad Pur aafef1e92d LibWasm: Make the main module's functions addressable by globals 2023-07-08 15:13:25 +02:00
Caoimhe 9204a60397 zip: Move away from DeprecatedString 2023-07-08 13:14:50 +01:00
Caoimhe f222028f79 zip: Use the helpers in ZipOutputStream for adding files 2023-07-08 13:14:50 +01:00
Caoimhe b5124bd826 LibArchive: Add helper functions for adding members to a ZipOutputStream 2023-07-08 13:14:50 +01:00
Aliaksandr Kalenik 2f85faef0f LibJS: Fix scope detection for ids in default function params
This change fixes an issue where identifiers used in default function
parameters were being "registered" in the function's parent scope
instead of its own scope. This bug resulted in incorrectly detected
local variables. (Variables used in the default function parameter
expression should be considered 'captured by nested function'.)

To resolve this issue, the function scope is now created before parsing
function parameters. Since function parameters can no longer be passed
in the constructor, a setter function has been introduced to set them
later, when they are ready.
2023-07-08 14:03:12 +02:00
Timothy Flynn 996c020b0d Everywhere: Remove 'clang-format off' comments that are no longer needed 2023-07-08 10:32:56 +01:00
Timothy Flynn c911781c21 Everywhere: Remove needless trailing semi-colons after functions
This is a new option in clang-format-16.
2023-07-08 10:32:56 +01:00
Timothy Flynn aff81d318b Everywhere: Run clang-format
The following command was used to clang-format these files:

    clang-format-16 -i $(find . \
        -not \( -path "./\.*" -prune \) \
        -not \( -path "./Base/*" -prune \) \
        -not \( -path "./Build/*" -prune \) \
        -not \( -path "./Toolchain/*" -prune \) \
        -not \( -path "./Ports/*" -prune \) \
        -type f -name "*.cpp" -o -name "*.h")
2023-07-08 10:32:56 +01:00
Timothy Flynn 388d455575 Meta: Switch to clang-format-16 as the standard formatter
This includes a few new options to the .clang-format configuration file
to A) adhere to option changes within clang-format 16 (namely the option
AlignTrailingComments), and B) enforce existing style guide rules with
new clang-format rules.
2023-07-08 10:32:56 +01:00
Timothy Flynn 1e733b1cf4 Meta: Alphabetize clang-format options
Except for Language, which is typically first. This helps when scrolling
down the list of options in the clang-format documentation.
2023-07-08 10:32:56 +01:00
Andreas Kling db5bde01dc LibWeb: Resolve % top and bottom insets against containing block height
This makes cookie banner buttons show up on Linktree again. :^)

Regressed in fd37ad3a84
2023-07-08 10:51:12 +02:00
Sebastian Zaha fd37ad3a84 LibWeb: Fix absolute positioning issues
Make sure the insets and margins calculated according to the spec are
not later ignored and ad-hoc recomputed in
layout_absolutely_positioned_element.

Use the static position calculation in a couple of places where the
spec (and comment) was indicating it should be used.

Fixes #19362
2023-07-08 06:13:56 +02:00
Sebastian Zaha 61fe7c230f LibWeb: Implement abspos for replaced elements
Added implementation and spec comments for sections 10.3.8 and 10.6.5,
with an implementation similar to the existing ones for non-replaced
elements.
2023-07-08 06:13:56 +02:00
Sebastian Zaha 6a66a05809 LibWeb: Adjust 4 abspos tests to highlight errors
The tests still pass, but opening the files in Ladybird and Safari or
Firefox shows clearly where the layouting in Ladybird is incorrect
for some absolute positioned elements. The previous 1px border was
subtly hiding some issues.
2023-07-08 06:13:56 +02:00
Sebastian Zaha d77986f01c headless-browser: Ensure IPC::File is closed after sending
On systems with the default ulimit for open files <= 256 (default
on some systems) the LibWeb tests were crashing because the
input file handles are not closed in headless-browser.
2023-07-08 06:11:08 +02:00
Sebastian Zaha 59c862cab9 Documentation: Debugging Ladybird in CLion 2023-07-08 06:09:18 +02:00
Aliaksandr Kalenik 71c54dd37b LibJS: Always init arguments stored in locals for generator functions
Since AST interpreter switches to bytecode to execute generator
functions, arguments stored in local variables always need to be
initialized for such functions.
2023-07-08 05:38:45 +02:00
Lucas CHOLLET e5b70837de LibGfx: Remove ImageDecoder::set_[non]volatile()
These methods are unused so let's remove them.
2023-07-08 01:45:46 +01:00
Daniel Bertalan 210448b6ed LibC: Relax memmove() to memcpy() in more cases
`memcpy()` and `memmove()` are functionally equivalent if the source and
destination memory regions do not overlap. If this is the case, we
should prefer `memcpy()` as it's implemented in a simpler and faster
way. As our `memcpy()` starts copying from the lowest address first,
relaxing a `memmove()` call to `memcpy()` is safe if the destination:
- starts at a lower address than the source
- starts at a higher address than the source's end
2023-07-07 23:46:54 +02:00
Nicolas Ramz 176baf7cdb LibWeb: Support background attribute on table elements 2023-07-07 19:09:55 +01:00
Aliaksandr Kalenik b1af91d8c4 LibJS: Use local variables to store function parameters in some cases
Using local variables to store function parameters makes Kraken tests
run 7-10% faster.

For now this optimization is limited to only be applied if:
- Parameter does not use destructuring assignment
- None of the function params has default value
- There is no access to "arguments" variable inside function body
2023-07-07 19:35:08 +02:00
Aliaksandr Kalenik 2e81cc4cf7 LibJS: Use Identifier to represent FunctionParameter name
Using identifier instead of string allows to store supplemental
information about whether it can be represented as local variable.
2023-07-07 19:35:08 +02:00
Timothy Flynn 2f1d6c0b9a LibJS/Bytecode: Ensure we do not generate bytecode for super expressions
Similar to AST mode, super expressions are handled elsewhere.
2023-07-07 18:11:51 +02:00
Timothy Flynn 23daf5097b LibJS/Bytecode: Generate bytecode for deleting super properties 2023-07-07 18:11:51 +02:00
Timothy Flynn 0d50e5eeee LibJS/Bytecode: Extract code to generate a super reference to a helper
This code is already repeated twice, and would be repeated a third time
for the `delete` operator.
2023-07-07 18:11:51 +02:00
Timothy Flynn d5ca51b461 LibJS: Forward declare the MemberExpression AST node 2023-07-07 18:11:51 +02:00
Timothy Flynn 621d55ad65 LibJS/Bytecode: Do note coerce referenced values to an Object too early
Converting a base value to an Object is performed by Reference::delete_.
Doing this early in the bytecode operator could be observable, although
it would likely be the first observable step in Reference::delete_
anyways. This will just align these operators with upcoming operators
for super references, where doing this coercion first will be observable
(we need to throw an exception for deleting a super property before this
coercion).
2023-07-07 18:11:51 +02:00