Commit graph

28950 commits

Author SHA1 Message Date
Andreas Kling 959b18bde3 LibWeb: Remove a bunch of pointless "else" in EventHandler 2021-10-12 14:44:52 +02:00
Andreas Kling d90be22a73 LibWeb: Use strong pointers and null checks in handle_keydown() 2021-10-12 14:44:00 +02:00
Andreas Kling dcb409a112 LibWeb: Use strong pointers and null checks in handle_keyup() 2021-10-12 14:39:09 +02:00
Andreas Kling 865162b1c3 LibWeb: Stop the style/layout update timers after updating style/layout
If we had a scheduled update of either of these kind, make sure to
cancel it after performing an update. Otherwise we might do a redundant
second update with the same results.

This could happen if something schedules an async layout, and before it
can happen, something requires a sync layout, which we do right away.
2021-10-12 12:17:25 +02:00
Andreas Kling 76ac1b2496 LibWeb: Add missing upcalls in HTMLSelectElement 2021-10-12 12:17:25 +02:00
Andreas Kling 06e54ea916 LibWeb: Add missing upcalls in HTMLInputElement
We need to call the base class in overrides of inserted() and
removed_from(), or things like style invalidation will break.
2021-10-12 12:17:25 +02:00
James Mintram af2761600d AK: Add support for ARCH(AARCH64) to Platform.h 2021-10-11 23:41:56 +01:00
Linus Groh 44e70d1bc0 LibJS+LibWeb: Let WrapperGenerator deal with legacy_null_to_empty_string
This concept is not present in ECMAScript, and it bothers me every time
I see it.
It's only used by WrapperGenerator, and even there only relevant in two
places, so let's fully remove it from LibJS and use a simple ternary
expression instead:

    cpp_name = js_name.is_null() && legacy_null_to_empty_string
        ? String::empty()
        : js_name.to_string(global_object);
2021-10-11 23:36:03 +01:00
mjz19910 8ea79c05db Documentation: Fix spelling error
A spelling error caused an invalid file to be referenced,
change the summary value so it mentions to the correct file.
2021-10-11 22:52:12 +01:00
Andreas Kling b819719860 LibJS: Make sure queued promise jobs have an execution context when run 2021-10-11 22:21:46 +02:00
Tobias Christiansen 9aa720e83e LibWeb: Flexbox: Assume container size before layouting children
Before layouting the children of a flex container we now either assume
the parent's size or the specified size of the container.
2021-10-11 20:16:53 +02:00
Tim Schumacher e9ce1a8d83 Ports: Add compatibility symlinks to ncurses
Some applications search for the external version of libtic and
libtinfo, which are no longer present after
91ad7754fe.

Having a symlink fixes that, since libncurses exports the necessary
functions if they aren't available as a seperate library.
2021-10-11 10:51:43 -07:00
Rodrigo Tobar bf4e536f00 Kernel: Correctly interpret ioctl's FIONBIO user value
Values in `ioctl` are given through a pointer, but ioctl's FIONBIO
implementation was interpreting this pointer as an integer directly.
This meant that programs using `ioctl` to set a file descriptor in
blocking mode met with incorrect behavior: they passed a non-null
pointer pointing to a value of 0, but the kernel interpreted the pointer
as a non-zero integer, thus making the file non-blocking.

This commit fixes this behavior by reading the value from the userspace
pointer and using that to set the non-blocking flag on the file
descriptor.

This bug was found while trying to run the openssl tool on serenity,
which used `ioctl` to ensure newly-created sockets are in blocking mode.
2021-10-11 10:46:01 -07:00
Tobias Christiansen 01a716d529 LibWeb: Flexbox: Use right margins when direction is column
Previously both branches of the if were the same which is obviously not
correct.
2021-10-11 19:29:10 +02:00
Andreas Kling f188e48c3c LibWeb: Add Event.timeStamp
Note that the value is always 0 for now. Actually initializing the time
stamp is left as a FIXME.
2021-10-11 18:20:46 +02:00
Linus Groh f952db1a1f LibWeb: Implement PromiseRejectionEvent
This paves the way for the rejectionhandled and unhandledrejection
events.

It's also used by core-js (in browsers, at least) to check whether
Promise needs to be polyfilled, so adding it should allow more websites
to leverage LibJS's native Promise implementation :^)
2021-10-11 13:30:17 +01:00
Linus Groh 661dd32432 LibWeb: Add support for the Promise<T> IDL type to WrapperGenerator
This includes parsing parameterized types (foo<T>) as well as generating
the appropriate code in generate_wrap_statement() and generate_to_cpp().
2021-10-11 13:30:17 +01:00
Linus Groh 7afd215e95 LibWeb: Initialize IDL any values without default value to undefined
Previously this would generate the following code:

    JS::Value foo_value;
    if (!foo.is_undefined())
        foo_value = foo;

Which is dangerous as we're passing an empty value around, which could
be exposed to user code again. This is fine with "= null", for which it
also generates:

    else
        foo_value = JS::js_null();

So, in summary: a value of type `any`, not `required`, with no default
value and no initializer from user code will now default to undefined
instead of an empty value.
2021-10-11 13:30:17 +01:00
Linus Groh a9a7d65099 LibWeb: Replace heycam.github.io/webidl URLs with webidl.spec.whatwg.org
Web IDL is now a WHATWG standard and the specification was moved
accordingly: https://twitter.com/annevk/status/1445311275026821120

The old URLs now redirect, but let's use canonical ones.
2021-10-11 13:15:16 +01:00
James Magahern 4041848caa ClockWidget: Left-align clock and center based on ideal width
I personally find it very distracting when the clock continuously
shifts around as seconds tick. Because we're not using a monospace
font for the clock, this is to be expected since each number has a
different typographic width.

However, a tradeoff can be made to make this slightly less distracting.
Instead of _perfectly_ centering the time string for every given
possible time, we can center it once based on a constant measurement
and render the rest of the string as left-aligned.

The advantage is that the clock no longer shifts around anymore while
seconds tick. The disadvantage is that the time may sometimes be not
perfectly centered by a pixel or two for certain numbers. Personally,
I find the tradeoff well worth it, and I don't think I would even
notice the imperfect centering unless I was specifically looking for
it and watching it for a long time.
2021-10-11 10:15:34 +02:00
Dana Burkart d79ab32850 LibWeb: Consider empty fragments the same as whitespace in LineBox
When computing whether whitespace should be collapsed or not, we have to
consider empty fragments, since <br> will produce an empty fragment to
force a line break.

LineBox::is_empty_or_ends_in_whitespace() is amended to look at the
length of the last fragment, and return true if it is 0.
2021-10-11 09:51:58 +02:00
Linus Groh f0281ec19d LibJS: Implement Temporal.PlainMonthDay.prototype.toPlainDate() 2021-10-11 08:31:39 +01:00
Linus Groh 2c222ba40b LibJS: Implement Temporal.PlainYearMonth.prototype.toPlainDate() 2021-10-11 08:31:39 +01:00
Linus Groh 99adb54391 LibJS: Implement Temporal.Calendar.prototype.dateUntil() 2021-10-11 08:31:39 +01:00
Ali Mohammad Pur 045c85af4b Shell: Raise an error if an execute node ends up trying to run nothing
...while capturing its standard output.
As `$()` is an invalid construct, execute nodes are not supposed to
capture the output of no command being run; but it is possible to create
empty commands such as CastToCommand(Redirection(...)) or similar.
Make this a hard error instead of an unescapable select().
This was noticed in #10432, which should now error out like so:
```
Error: Cannot capture standard output when no command is being executed
  0| $(<$file)
~~~~~^^^^^^^^^
  1|
```
2021-10-11 10:56:01 +03:30
Tim Schumacher 3908753347 Ports: Fix issues with the libmodplug and SDL_sound ports
- Lock SDL_sound to specific commit
- Convert properties to arrays where required
- Fix depends being called "deps"
2021-10-10 19:11:02 -07:00
Tim Schumacher 262b718912 Ports: Fix nano authentication options splitting
This was a typo from when everything was migrated to arrays.
2021-10-11 00:37:02 +01:00
Andreas Kling fdc1c15064 LibWeb: Stub out a basic ResizeObserver interface
This patch establishes scaffolding for the ResizeObserver API.
2021-10-11 00:54:01 +02:00
Andreas Kling 5c9ca5c2dc LibWeb: Stub out a basic Selection interface
This patch establishes scaffolding for the Selection API.
2021-10-11 00:32:19 +02:00
xSlendiX 6782cf5193 Ports: Add SDL_sound 2021-10-10 15:26:05 -07:00
xSlendiX f573b7b47a Ports: Add libmodplug 2021-10-10 15:26:05 -07:00
Ben Wiederhake e900f94a03 Meta: Run check-markdown as part of 'Azure Linux NoFuzz' 2021-10-10 15:18:55 -07:00
Ben Wiederhake a296f6bb8d Meta: Invoke markdown-checker if available while linting 2021-10-10 15:18:55 -07:00
Ben Wiederhake c06a0bae04 Meta: Fix broken external links
Meta/Lagom/ReadMe.md never had any other name; not sure how that typo
happened.

The link to the non-existent directory is especially vexing because the
text goes on to explain that we don't want such a directory to exist.

Found by running markdown-checker, and 'wget'ing all external links.
2021-10-10 15:18:55 -07:00
Ben Wiederhake 8ff942b5a4 Manpages+markdown-checker: Permit only specific missing files
I can't write these manpages ad-hoc, and in most cases I don't want to
remove the link because it is justified. The hope is that with this
FIXME in place, there is more motivation to write these manpages for
someone who knows enough about them. Or at least we will introduce fewer
dead links in the future, making Help more useful.
2021-10-10 15:18:55 -07:00
Ben Wiederhake 3a9f289dc6 Manpages: Fix broken link to ioctl page
Found by markdown-checker.
2021-10-10 15:18:55 -07:00
Ben Wiederhake 81e1aa0aa3 Manpages: Don't reference non-existing chroot
Chroot exists neither in code nor in documentation. If we add-in the
feature again, it will be simple enough to add it back in to the
documentation. For now, let's clean it up, instead of refering to things
that don't exist.

Found by markdown-checker.
2021-10-10 15:18:55 -07:00
Ben Wiederhake 9df8c31cdc Documentation: Fix broken empty links
The intention seems to be to enable links like:
https://github.com/SerenityOS/serenity/blob/master/Documentation/CodingStyle.md#east-const
However, this has never worked, and is also not how the syntax works.
Because there seems to be no demand for the intended feature (nobody
since 2019 fixed it), this patch removes it.

Found by markdown-checker.
2021-10-10 15:18:55 -07:00
Ben Wiederhake 3f88d65b78 markdown-checker: New tool that checks document links 2021-10-10 15:18:55 -07:00
Ben Wiederhake 50ad294527 AK: Implement a way to resolve relative paths lexically 2021-10-10 15:18:55 -07:00
Ben Wiederhake 24e7196158 LibMarkdown: Implement introspection of the document tree 2021-10-10 15:18:55 -07:00
Ben Wiederhake aca01932bd LibMarkdown: Make href always a String
This already was the case in some sense, but made it very inconvenient
to access it.
2021-10-10 15:18:55 -07:00
Timothy Flynn 597379e864 LibUnicode: Generate and use unique locale-related alias strings
Almost all of these are already in the unique string list.
2021-10-10 22:21:48 +02:00
Timothy Flynn acb7bd917f LibUnicode: Generate and use unique subtag and complex alias strings 2021-10-10 22:21:48 +02:00
Timothy Flynn 3d67f6bd29 LibUnicode: Generate and use unique list-format strings
The list-format strings used for Intl.ListFormat are small, but quite
heavily duplicated. For example, the string "{0}, {1}" appears 6,519
times. Generate unique strings for this data to avoid duplication.
2021-10-10 22:21:48 +02:00
Timothy Flynn f9e605397c LibUnicode: Generate and use a set of unique locale-related strings
In the generated UnicodeLocale.cpp file, there are 296,408 strings for
localizations of languages, territories, scripts, currencies & keywords.
Of these, only 43,848 (14.8%) are actually unique, so there are quite a
large number of duplicated strings.

This generates a single compile-time array to store these strings. The
arrays for the localizations now store an index into this single array
rather than duplicating any strings.
2021-10-10 22:21:48 +02:00
Timothy Flynn 3f0095b57a LibUnicode: Skip unknown languages and territories
Some CLDR languages.json / territories.json files contain localizations
for some lanuages/territories that are otherwise not present in the CLDR
database. We already don't generate anything in UnicodeLocale.cpp for
these anomalies, but this will stop us from even storing that data in
the generator's memory.

This doesn't affect the output of the generator, but will have an effect
after an upcoming commit to unique-ify all of the strings in the CLDR.
2021-10-10 22:21:48 +02:00
Ben Wiederhake 6d99b7b72e Meta: Re-enable warnings for deprecated copies also for Lagom 2021-10-10 21:21:35 +01:00
Ben Wiederhake 0321034c87 Meta: Re-enable warnings for deprecated copies
This used to supress two true-positives, and zero false-positives.

That's good enough in my book to warrant re-activation.
2021-10-10 21:03:27 +01:00
Ben Wiederhake ee18912373 LibGfx: Implement copy-assign for Matrix
This used to generate a warning about using a deprecated copy-assign,
default-generated by the compiler, and deprecated because we hand-
implement the copy-constructor. This warning is correct, since the
default-generated copy-assign may or may not be as efficient as memcpy.

This patch gets rid of the warning, and has either no performance impact
or a slightly positive one. If this turns out to be wrong, we should
probably also fix the copy-constructor.
2021-10-10 21:03:27 +01:00