Commit Graph

50812 Commits

Author SHA1 Message Date
Karthik Karanth
8177ecb17f Ladybird: Use cursor position for context menu 2023-05-24 06:01:47 +02:00
Tim Ledbetter
245699f303 Base: Add man page for w 2023-05-24 05:55:44 +02:00
Tim Ledbetter
72e1e38fb8 Utilities/w: Add -h option to optionally hide the header 2023-05-24 05:55:44 +02:00
Tim Ledbetter
9596346528 Utilities/w: Add the ability to filter by username 2023-05-24 05:55:44 +02:00
Tim Ledbetter
d2ec82d4f9 Utilities/w: Display the TTY pseudo name in the "TTY" column
This matches the format used by `ps`.

If we cannot determine the TTY
pseudo name we fall back to the full device name, as shown previously.
2023-05-24 05:55:44 +02:00
Tim Ledbetter
2dbc7e4fff Utilities/w: Convert TTY string from /var/run/utmp to TTY pseudo name
Previously, we were comparing the "tty" value from
`/sys/kernel/processes` to the TTY value from
`/var/run/utmp` directly.  This caused the "WHAT" column to always show
"N/A", because the former is the TTY pseudo name, while the latter is
the full device name.
2023-05-24 05:55:44 +02:00
Tim Ledbetter
826894a89c Utilities/w: Port to String 2023-05-24 05:55:44 +02:00
Tim Ledbetter
72c5c3ac77 Utilities/w: Replace LibC function calls with modern equivalents 2023-05-24 05:55:44 +02:00
Timothy Flynn
086316057b LibThreading: Improve resiliancy of timed threading tests
The threading tests currently wait for a very small amount of time for
the expected test condition to be reached, e.g. 20ms. This changes the
tests to *check* the condition every 20ms, but allow the test to run for
up to 2s until the condition is reached. This should hopefully resolve
the failures seen on CI.

This also renames one of the tests to match what it actually does. The
test itself was changed in commit 5b335e7, but the name was not updated
to reflect that change.
2023-05-24 00:25:35 +02:00
Daniel Bertalan
fd316945f5 AK: Define NAKED more resiliently for AArch64
This attribute is used for functions in the kernel that are entirely
written in assembly, yet defined in C++ source files.

Without `__attribute__((naked))`, Clang might decide to inline these
functions, making any `ret` instructions within them actually exit the
caller, or discard argument values as they appear "dead". This issue
caused a kernel panic when using the `execve` syscall in AArch64
SerenityOS built by Clang.

While the empty definition so far appears to work fine with GCC, simpler
test cases do similarly suffer from unintended inlining, so define
`NAKED` as a synonym of `NEVER_INLINE` to avert future issues.

Perhaps we should move users of `NAKED` to plain assembly files?

This makes aarch64Clang builds boot :^)
2023-05-23 23:45:01 +02:00
Caoimhe
bafc1193ee SpiceAgent: Don't send ClipboardGrab if the shared clipboard is disabled
The spice server will ignore any clipboard-related messages if we don't
have the appropriate capabilities, but I think it's better for us to
do less CPU churning whenever the user copies something to their
clipboard.

It also stops the spice server from warning in the console
about a clipboard grab message being recieved when the capability was
never announced.
2023-05-23 22:56:36 +02:00
Sam Atkins
4e47e6a3d6 LibWeb: Reject invalid tokens in calc() expressions
If we finish parsing a calculation tree and it still contains
UnparsedCalculationNodes, then it's not valid, and we shouldn't create
a StyleValue from it.
2023-05-23 15:43:23 +02:00
Andreas Kling
fa25f70086 LibWeb: Make LiveNodeList faster when it only cares about children
Same optimization as HTMLCollection, ported to LiveNodeList.
2023-05-23 14:38:45 +02:00
Andreas Kling
fe92b54137 LibWeb: Don't draw text fragments that would be clipped by the painter
This avoids a ton of work when painting large documents. Even though it
would eventually get clipped by the painter anyway, by bailing out
earlier, we avoid a lot more work (UTF-8 iteration, OpenType lookups,
etc).

It would be even nicer if we could skip entire line boxes, but we don't
have a fast way to get the bounding rect of a line box at the moment.
2023-05-23 14:38:45 +02:00
Andreas Kling
df1bb0ff49 LibWeb: Make HTMLCollection faster when it only cares about children
Some of the live HTMLCollection only ever contain children of their root
node. When we know that's the case, we can avoid doing a full subtree
traversal of all descendants and only visit children.

This cuts the ECMA262 spec loading time by over 10 seconds. :^)
2023-05-23 14:38:45 +02:00
Zaggy1024
e31f696ee6 LibVideo/PlaybackManager: Use a function to start the internal timer
In addition, this renames the internal timer to better suit its new
purpose since the playback state handlers were added. Not only is it
used to time frame presentations, but also to poll the queue when
seeking or buffering.
2023-05-23 05:17:48 -06:00
Zaggy1024
71d70df34f LibVideo/PlaybackManager: Decode frames off the main thread
Running decoding on the main thread can cause frames to be delayed due
to the presentation timer waiting for a decode to finish. If a frame
takes too long to decode, this delay can be quite visible. Therefore,
decoding has been moved to a separate thread, with frames sent to the
main thread through a thread-safe queue.

This results in frame times going from being late by up to 16ms to a
very consistent ~1-2ms.
2023-05-23 05:17:48 -06:00
Zaggy1024
eae7422ebc LibVideo: Fallibly construct playback manager fields 2023-05-23 05:17:48 -06:00
Jelle Raaijmakers
c03152c5d2 LibWeb: Simplify margin & border box construction in LayoutState 2023-05-23 12:35:42 +02:00
Jelle Raaijmakers
a02b28e6c8 LibGfx: Get rid of Gfx::Rect<float> area workaround in Painter
We can now trust `Gfx::Rect<T>` to correctly calculate rectangle
intersections when `T = float`.
2023-05-23 12:35:42 +02:00
Jelle Raaijmakers
f391ccfe53 LibGfx+Everywhere: Change Gfx::Rect to be endpoint exclusive
Previously, calling `.right()` on a `Gfx::Rect` would return the last
column's coordinate still inside the rectangle, or `left + width - 1`.
This is called 'endpoint inclusive' and does not make a lot of sense for
`Gfx::Rect<float>` where a rectangle of width 5 at position (0, 0) would
return 4 as its right side. This same problem exists for `.bottom()`.

This changes `Gfx::Rect` to be endpoint exclusive, which gives us the
nice property that `width = right - left` and `height = bottom - top`.
It enables us to treat `Gfx::Rect<int>` and `Gfx::Rect<float>` exactly
the same.

All users of `Gfx::Rect` have been updated accordingly.
2023-05-23 12:35:42 +02:00
Tim Ledbetter
b7f4363791 Chess: Make the resign button have no effect after the game ends 2023-05-23 11:43:22 +02:00
Tim Ledbetter
5a25082be5 Chess: Don't ask the engine to make a move if the game is finished
Previously, the engine would attempt to make a move if the engine was
changed after the game had ended.

This change also allows the player to always flip the board when the
game is finished, instead of only being able to flip the board on
their turn.
2023-05-23 11:43:22 +02:00
Andreas Kling
8ce1b7ab7e Browser: Default to HTTPS instead of HTTP if no protocol is specified 2023-05-23 11:16:36 +02:00
Andreas Kling
1a1ff8eb5e Ladybird: Default to HTTPS instead of HTTP if no protocol is specified 2023-05-23 11:16:36 +02:00
Andreas Kling
e2c72922f6 LibWeb: Make LayoutState use HashMap instead of potentially huge Vector
Before this change, LayoutState essentially had a Vector<UsedValues*>
resized to the exact number of layout nodes in the current document.

When a nested layout is performed (to calculate the intrinsic size of
something), we make a new LayoutState with its own Vector. If an entry
is missing in a nested LayoutState, we check the parent chain all the
way up to the root.

Because each nested LayoutState had to allocate a new Vector with space
for all layout nodes, this could get really nasty on very large pages
(such as the ECMA262 specification).

This patch replaces the Vector with a HashMap. There's now a small cost
to lookups, but what we get in return is the ability to handle huge
layout trees without spending eternity in page faults.
2023-05-23 09:24:08 +02:00
Andreas Kling
e83681ee34 LibWeb: Use the right DOM node when placing cursor on double-click
This fixes a null pointer dereference when double-clicking in text
content on some pages.
2023-05-23 07:43:26 +02:00
Andreas Kling
80d6330a26 LibWeb: Don't create mutation record node lists if nobody is interested
By deferring allocation of StaticNodeList objects until we know somebody
actually wants the MutationRecord, we avoid a *lot* of allocation work.

This shaves several seconds off of loading https://tc39.es/ecma262/

At least one other engine (WebKit) skips creating mutation records if
nobody is interested, so even if this is observable somehow, we would
at least match the behavior of a major engine.
2023-05-23 06:31:37 +02:00
Tim Schumacher
0f2b6345c6 test-fuzz: Add all the missing fuzzers 2023-05-23 06:11:33 +02:00
Tim Schumacher
9690b4011b Lagom: Extract the list of fuzzing targets to a separate file 2023-05-23 06:11:33 +02:00
Tim Schumacher
faa08ef1a1 test-fuzz: Don't include all fuzzers into the same .cpp file
Instead, use the approach from BuggieBox to compile in the .cpp files
separately.
2023-05-23 06:11:33 +02:00
Rafał Babiarz
38a553e1ce Ladybird: Select all text in LocationEdit on click 2023-05-23 06:09:40 +02:00
Andreas Kling
821f808e52 LibWeb: Avoid rebuilding layout tree unless CSS display property changes
Before this, any style change that mutated a property we consider
"layout-affecting" would trigger a complete teardown and rebuild of the
layout tree.

This isn't actually necessary for the vast majority of CSS properties,
so this patch makes the invalidation a bit finer, and we now only
rebuild the layout tree when the CSS display property changes.

For other layout-affecting properties, we keep the old layout tree (if
we have one) and run the layout algorithms over that once again.
This is significantly faster, since we don't have to run all the CSS
selectors all over again.
2023-05-23 06:06:55 +02:00
Kemal Zebari
8f5cc613d2 Browser: Don't show error message box when canceling editor dialog
Currently, an error message box appears when a user tries to cancel
the editor dialog while editing or adding a bookmark.

This snapshot resolves this by having `add_bookmark()` and
`BookmarksBarWidget::edit_bookmark()` perform an if check on the
result of `BookmarkEditor::edit_bookmark()` to see if the dialog
was canceled.
2023-05-23 06:03:13 +02:00
Andi Gallo
0ad131e13d LibGfx: Fix parsing of rgba values
Trim whitespace of the alpha component before calling
parse_first_floating_point, which doesn't handle it.
2023-05-23 06:02:35 +02:00
Andi Gallo
1bbfe4630d LibWeb: Preserve case for key events
Case-preserving behavior matches observed behavior of other browsers and
the specification.
2023-05-23 06:02:00 +02:00
thankyouverycool
02d94a303c Base+Userland: Apply Human Interface Guidelines to Object text
Corrects a slew of titles, buttons, labels, menu items and status bars
for capitalization, ellipses and punctuation.

Rewords a few actions and dialogs to use uniform language and
punctuation.
2023-05-23 05:59:49 +02:00
thankyouverycool
024360e604 Documentation: Add section on Ellipses to Text.md 2023-05-23 05:59:49 +02:00
thankyouverycool
a03fb66216 LibGUI: Adjust size and layout of InputBox
Increases default dimensions of InputBox, giving it slightly more
divine proportions. Prompt text now always appears above the editor.
2023-05-23 05:59:49 +02:00
Tim Ledbetter
f3a6da580f du: Continue enumerating directories on error
Previously, the program would exit if a directory couldn't be read. We
now write an error message to stderr and continue.
2023-05-23 01:45:10 +02:00
Tim Ledbetter
abdca9b766 du: Print to stderr rather than stdout when directory can't be read 2023-05-23 01:45:10 +02:00
Tim Ledbetter
5dfb4e8066 LibC: Fix incorrect string length calculation in getsignalbyname()
This makes `kill` and `killall` work correctly with signal names.
2023-05-23 01:42:04 +02:00
Nico Weber
ae5d1d5a25 WebP: Let ALPH replace alpha channel instead of augmenting it
Pixels will leave the lossy decoder with alpha set to 255.
The old code would be a no-op in that case.

No observable behavior change yet, since there still is no
decoder for lossy webp.
2023-05-22 19:24:49 +02:00
Timothy Flynn
35fdc7f8c8 SpiceAgent: Gracefully exit when the Spice server disconnects 2023-05-22 15:11:33 +02:00
Timothy Flynn
36d61c01bc SpiceAgent: Reduce copying of potentially large byte buffers
This moves buffers around instead of implicitly copying them, and marks
the message types that hold these buffers as move-only.
2023-05-22 15:11:33 +02:00
Timothy Flynn
b865277275 LibWeb: Wait for media candidates without endlessly queueing microtasks
Rather than queueing microtasks ad nauseam to check if a media element
has a new source candidate, let the media element tell us when it might
have a new child to inspect. This removes endless CPU churn in cases
where there is never a candidate that we can play.
2023-05-22 15:11:08 +02:00
Aliaksandr Kalenik
76aa17be86 LibWeb: Make sure collapsed margins are not ignored if box creates FC
Fixes a bug that if box creates new formatting context then all already
collapsed margins are ignored and only margin_top is used.
2023-05-22 12:51:24 +02:00
Andi Gallo
668578ddc0 LibWeb: Propagate children_are_inline in wrap_in_anonymous
This fixes a crash in box_baseline, due to cells created for
display: table expecting a box child and getting the inline node wrapper
instead.

Fixes #18972.
2023-05-22 10:25:18 +02:00
Karol Kosek
d1328639b4 mkfifo: Don't rely on global errno
Core::System::mkfifo() doesn't rely on POSIX's mkfifo() and sends the
syscall directly to our system. This means that the and errno doesn't
get updated which ultimately caused the program to display an incorrect
message 'mkfifo: Success (not an error)'.
2023-05-22 10:24:08 +02:00
Jelle Raaijmakers
4448a51824 LibGfx: Add search path to debug output in FontDatabase
This helps with debugging why fonts cannot be found.
2023-05-22 10:23:08 +02:00