Commit Graph

18216 Commits

Author SHA1 Message Date
Timothy Flynn
fa9ba8bce5 LibWeb: Support rendering background images with 'background-repeat'
Update the painting of background images for both <body> nodes and other
non-initial nodes. Currently, only the following values are supported:
    repeat, repeat-x, repeat-y, no-repeat

This also doesn't support the two-value syntax which allows for setting
horizontal and vertical repetition separately.
2021-04-03 11:24:33 +02:00
Timothy Flynn
bd5a91269f LibWeb: Store computed CSS value of background-repeat 2021-04-03 11:24:33 +02:00
Timothy Flynn
fcfeadaffa Base: Add test page for the 'background-repeat' property
This page tests the following values for background-repeat:
    repeat, repeat-x, repeat-y, no-repeat

The test is duplicated for the <body> node and for child <div> nodes,
because the code that paints these nodes are in separate locations.
2021-04-03 11:24:33 +02:00
AnotherTest
2601441486 LibCrypto: Avoid overly big allocs in intermediate ModularPower results
If we don't limit the sizes of the intermediate results, they will grow
indefinitely, causing each iteration to take longer and longer (in both
memcpy time, and algorithm runtime).
While calculating the trimmed length is fairly expensive, it's a small
cost to pay for uniform iteration times.
2021-04-03 11:22:01 +02:00
AnotherTest
2020176f0f LibTLS: Make the TLS connection options user-configurable
The user may now request specific cipher suites, the use of SNI, and
whether we should validate certificates (not that we're doing a good job
of that).
2021-04-03 11:22:01 +02:00
AnotherTest
b5f24c84e4 LibTLS: Remove long-outdated comment that no longer makes sense 2021-04-03 11:22:01 +02:00
AnotherTest
d6d6750dd8 LibTLS: Move TLS extensions to a separate 'extensions' struct
This has no behavioural effect.
2021-04-03 11:22:01 +02:00
Andreas Kling
22d13d8b1a Taskbar: Tweak taskbar widget margins
Basically, nudge everything down 1 pixel.
2021-04-02 23:33:17 +02:00
Andreas Kling
6ba00ae5b9 LibGUI: Subtract layout margin when placing items along secondary axis
While space distribution along the primary axis of a BoxLayout is
pretty sophisticated, the secondary axis is very simple: we simply
center the widget.

However, this doesn't always look very nice if we don't take margins
into account, so make sure we subtract them from the rect we do all
the centering within.
2021-04-02 23:33:17 +02:00
thislooksfun
05d7869dc0 Documentation: Split brew install commands into core and fuse+ext2
If you don't need/want to use Fuse+ex2 then half of the existing
install command is unnecessary, and it's hard to pick out which you
do and don't need to, for example, build Lagom. This makes it clear
which commands you can skip if you don't need ex2 support.
2021-04-02 23:08:05 +02:00
thislooksfun
408398e276 Documentation: Add cmake to brew installs
MacOS does not ship with CMake, so we have to install it before it
can be used!
2021-04-02 23:08:05 +02:00
thislooksfun
20ca1acdbf Documentation: Update macOS build path in BuildInstructions.md
This is a follow-up to d0427b610c.
2021-04-02 23:08:05 +02:00
Brendan Coles
666aeecaa2 Meta: Resolve some pylint violations in Python lint scripts
Resolves:

* all: consider-using-sys-exit
* all: wrong-import-order
* all: TODO: Require that a few keys are set? (fixme)
* some: missing-function-docstring
* some: line-too-long
2021-04-02 23:07:58 +02:00
Linus Groh
e875513ff7 LibJS: Use empty value for Reference unresolvable state, not undefined
This fixes an issue where `undefined.foo = "bar"` would throw a
ReferenceError instead of a TypeError as undefined was also used for
truly unresolvable references (e.g. `foo() = "bar"`). I also made the
various error messages here a bit nicer, just "primitive value" is not
very helpful.
2021-04-02 22:24:30 +02:00
Linus Groh
d6cffb82a2 LibJS: Move 'typeof' string functionality from AST to Value
We should be able to get the 'typeof' string for any value directly, so
this is now a standalone Value::typeof() method instead of being part of
UnaryExpression::execute().
2021-04-02 22:24:30 +02:00
thankyouverycool
dc6db819f9 LibGUI: Always outline selected date and paint today's date bold
Fixes selected dates and today's date not painting correctly when
viewed from adjacent months
2021-04-02 22:23:21 +02:00
thankyouverycool
14e074cd24 LibGUI+Calendar: Inherit from Frame class
Fixes incorrect painting with variable thickness and cuts down
on some layout boilerplate.
2021-04-02 22:23:21 +02:00
Timothy Flynn
7d8d45e757 LibWeb: Add a line box fragment for <br> nodes
This is required for the block formatting context to know the height of
the <br> element while computing the height of its parent. Specifically,
this comes into play when the <br> element is the first or last child of
its parent. In that case, it previously would not have any fragments, so
BlockFormattingContext::compute_auto_height_for_block_level_element
would infer its top and bottom positions to be 0.
2021-04-02 20:36:02 +02:00
Daniël van de Burgt
a106f852d3
WindowServer+MouseSettings: Add ability to configure double-click speed (#5876)
This adds a double-click speed slider control to the Mouse Settings
panel, and value labels for both the movement speed and double-click
speed sliders.

To allow for updating and persisting the configured double-click
speed through the WindowServer, two IPC calls - `SetDoubleClickSpeed`
and `GetDoubleClickSpeed` - have been added.
2021-04-02 16:08:18 +02:00
thislooksfun
e55b8712d4 AK: Inline HashTable writing bucket lookup
The old approach was more complex and also had a very bad edge case
with lots of collisions. This approach eliminates that possiblility.
It also makes both reading and writing lookups a little bit faster.
2021-04-02 12:54:54 +02:00
thislooksfun
509eb10df4 AK: Inline the bucket index calculation
The result of the modulo is only used in the array index, so why
make the code more complex by calculating it in two different places?
2021-04-02 12:54:54 +02:00
thislooksfun
8fb7739cfb AK: Add tests for HashTable 2021-04-02 12:54:54 +02:00
Andreas Kling
21bc5fdec3 LibWeb: Don't interpreter invalid CSS pseudo-classes as '*' selector
Bogus pseudo-classes like ":bogus" would actually match every element.
2021-04-02 11:48:00 +02:00
Andreas Kling
3e3d196f06 WindowServer: Un-nest MenuManager::handle_mouse_event() a bit 2021-04-02 10:54:50 +02:00
Timothy Flynn
77a601d52e LibJS: Implement most of String.prototype.replace 2021-04-02 10:48:40 +02:00
Linus Groh
96121ddb11 js: Hook up promise rejection tracking callbacks
We now leverage the VM's promise rejection tracker callbacks and print a
warning in either of these cases:

- A promise was rejected without any handlers
- A handler was added to an already rejected promise
2021-04-02 10:47:40 +02:00
Linus Groh
9da13302ab js: Add REPL pretty-printing handler for Promises 2021-04-02 10:47:40 +02:00
Linus Groh
ade3adcc7a LibWeb: Run queued promise jobs after callbacks
We now run queued promise jobs after calling event handler, timer, and
requestAnimationFrame() callbacks - this is a bit ad-hoc, but I don't
want to switch LibWeb to use an event loop right now - this works just
fine, too.
We might want to revisit this at a later point and do tasks and
microtasks properly.
2021-04-02 10:47:40 +02:00
Linus Groh
f418115f1b LibJS: Add initial support for Promises
Almost a year after first working on this, it's finally done: an
implementation of Promises for LibJS! :^)

The core functionality is working and closely following the spec [1].
I mostly took the pseudo code and transformed it into C++ - if you read
and understand it, you will know how the spec implements Promises; and
if you read the spec first, the code will look very familiar.

Implemented functions are:

- Promise() constructor
- Promise.prototype.then()
- Promise.prototype.catch()
- Promise.prototype.finally()
- Promise.resolve()
- Promise.reject()

For the tests I added a new function to test-js's global object,
runQueuedPromiseJobs(), which calls vm.run_queued_promise_jobs().
By design, queued jobs normally only run after the script was fully
executed, making it improssible to test handlers in individual test()
calls by default [2].

Subsequent commits include integrations into LibWeb and js(1) -
pretty-printing, running queued promise jobs when necessary.

This has an unusual amount of dbgln() statements, all hidden behind the
PROMISE_DEBUG flag - I'm leaving them in for now as they've been very
useful while debugging this, things can get quite complex with so many
asynchronously executed functions.

I've not extensively explored use of these APIs for promise-based
functionality in LibWeb (fetch(), Notification.requestPermission()
etc.), but we'll get there in due time.

[1]: https://tc39.es/ecma262/#sec-promise-objects
[2]: https://tc39.es/ecma262/#sec-jobs-and-job-queues
2021-04-02 10:47:40 +02:00
Linus Groh
563712abce Ports: Build Python with --disable-ipv6
The addition of some IPv6 related things makes the configure script
think we support it now. We don't.
2021-04-01 22:49:44 +02:00
AnotherTest
0f468a5013 LibRegex: Test alternatives in the expected order
That is, first try to match the left side of the alternation, and then
the right side.
Fixes part of #6042.
2021-04-01 21:55:47 +02:00
AnotherTest
6bbb26fdaf LibRegex: Allow references to capture groups that aren't parsed yet
This only applies to the ECMA262 parser.
This behaviour is an ECMA262-specific quirk, such references always
generate zero-length matches (even on subsequent passes).
Also adds a test in LibJS's test suite.

Fixes #6039.
2021-04-01 21:55:47 +02:00
vcollette
804ab79995
AK: Fix bogus return type of Result::release_error() (#6054)
The function was not used anywhere so the error was unnoticed.
2021-04-01 21:03:57 +02:00
Manuel Palenzuela
a8f8e883c1 Ports: Updated the SDL2_mixer port to make it compile without
the opus and modplug music libraries.

Previously it wasnt compiling as we do not have ports of those
libraries. I have also changed the install location of the library so it
installs under /usr/include/SDL2 instead of /usr/local/include/SDL2.
2021-04-01 20:55:49 +02:00
Manuel Palenzuela
8324e48218 Ports: Added a SDL2_image port 2021-04-01 20:55:32 +02:00
Linus Groh
4e2d4b193a Ports: Get Python's --build value from config.guess 2021-04-01 20:54:05 +02:00
Alexander
86ecbd809f Ports: add libvorbis 2021-04-01 08:28:20 +02:00
Linus Groh
1ea8d73628 LibJS: Provide 'details' key in results object for duplicate test
The test-js program expects this to exist for 'result: "fail"' results
and would crash if any duplicated test(message) occurs, as we didn't
provide 'details' in that case.
2021-03-31 23:59:21 +02:00
Timothy Flynn
316e19c3ac Base: Add a bullet emoji • 2021-03-31 23:58:45 +02:00
Timothy Flynn
53ccfc1f4c LibWeb: Don't hit test a stacked child if it is behind its parent
When hit testing a stacked context, skip hit testing children if the
child's z-index is less than the parent's. The children are already
sorted by z-index, but also need to consider the parent.
2021-03-31 23:53:15 +02:00
Timothy Flynn
2cc10c62ee Base: Add test for a box placed over links with negative z-index
In this test, a set of links has a background box placed behind them via
a negative z-index. The expectation is that a hit test on a link during
a mouse-move event should select that link, and not the background box.
2021-03-31 23:53:15 +02:00
AnotherTest
cbd62c472e UserspaceEmulator: Default-initialize the siginfo struct used in waitid
Otherwise it'll have some random value from the stack, and the kernel
will not bother setting it to zero.
Also add a debug print and tweak the FIXME message.
2021-03-31 23:49:26 +02:00
AnotherTest
c4cf4ef111 Shell: Place Pipe redirections at the beginning of the redirection list
This makes commands like `foo 2>&1 | bar` behave as expected (which is
to pipe both stdout and stderr of `foo` to stdin of `bar`).
Previously, this would've piped stderr of `foo` into stdout, and the
stdout of `foo` into the stdin of `bar`.
2021-03-31 23:49:26 +02:00
AnotherTest
e8cfa43717 Utilities/sleep: Go back to sleep if not interrupted by SIGINT
This can happen if the process is stopped and continued at a later time.
2021-03-31 23:49:26 +02:00
AnotherTest
5d19509616 Shell: Handle SIGCHLD after sending SIGCONT to job
This fixes `fg` and `bg` causing the shell to go into an infinite loop
of trying to `waitpid` until some current job changes state.

a.k.a. "Fix Shell backgrounding, yet again!" :P
2021-03-31 23:49:26 +02:00
AnotherTest
50f5959996 Shell: Use existing job state when waitpid() returns 0 in jobs 2021-03-31 23:49:26 +02:00
AnotherTest
e3fd914187 Kernel: Send SIGCHLD to the parent process when changing stopped state
This is done also by linux (signal.c:936 in v5.11) at least.
It's a pretty handy notification that allows the parent process to skip
going through a `waitpid` and guesswork to figure out the current state
of a child process.
2021-03-31 23:49:26 +02:00
AnotherTest
47080941cc Shell: Replace '#if SH_DEBUG` with dbgln_if() and if constexpr 2021-03-31 23:49:26 +02:00
Idan Horowitz
3b201da473 Utilities: Add simple traceroute utility
This utility traces the route packets take to a user specified host.

QEMU user networking (the type of networking we currently have setup)
does not support sending "real" raw IPv4 packets, and as such we cant
specify a custom TTL value. As a result, this utility will only work
on real hardware, qemu setup with tun networking (requires root) and
other hypervisors that support bridged adapters (VirtualBox/VMWare).
2021-03-31 23:42:24 +02:00
Idan Horowitz
aa6547492e LibC+ping: Move internet_checksum to serenity header
This will be useful for traceroute and any other packet related
application, so this will reduce code duplication.
2021-03-31 23:42:24 +02:00