Commit graph

53256 commits

Author SHA1 Message Date
Timothy Flynn
5ad78cab8d LibSQL: Remove Core::EventReceiver parent from SQL::Index
This relationship was only used to provide factory methods for the index
(and its BTree child).
2023-08-07 14:38:38 -04:00
Timothy Flynn
1b40bf9783 LibSQL: Remove unused HashIndex and related classes
The features provided by these classes should be used eventually, but so
far we've been maintaining these classes for over 2 years without any
actual use. We can restore them when it comes time to actually use them.
2023-08-07 14:38:38 -04:00
Timothy Flynn
1151ba333a LibSQL+SQLServer: Remove Core::EventReceiver parent from SQL::Database
This relationship was only used to provide factory methods for the
database.
2023-08-07 14:38:38 -04:00
Timothy Flynn
4a04438e43 LibSQL: Remove Core::EventReceiver parent from SQL::Heap
This relationship was only used to provide a name and factory methods
for the heap.
2023-08-07 14:38:38 -04:00
Dennis
2c17742811 Documentation: Add instructions to disable OpenSSL legacy renegotiation
In distributions with newer versions of OpenSSL, when you run
Meta/serenity.sh rebuild-toolchain you'll get curl: (35)
error:0A000152:SSL routines::unsafe legacy renegotiation
disabled. This is because OpenSSL was compiled with legacy
renegotiation disabled by default. I've added instructions
to Documentation/BuildInstructions.md to solve this issue.
2023-08-07 11:14:34 -06:00
Zaggy1024
50c73d02f0 LibAudio: Add a test for creating and destructing a PlaybackStream
This will ensure that we don't leak any memory while playing back
audio.

There is an expectation value in the test that is only set to true when
PulseAudio is present for the moment. When any new implementation is
added for other libraries/platforms, we should hopefully get a CI
failure due to unexpected success in creating the `PlaybackStream`.

To ensure that we clean up our PulseAudio connection whenever audio
output is not needed, add `PulseAudioContext::weak_instance()` to allow
us to check whether an instance exists without creating one.
2023-08-07 10:40:34 -06:00
Zaggy1024
515b255fa4 LibAudio: Clear callbacks and disconnect PulseAudioStream in destructor
If we don't clear the callbacks, they may be called after our functions
are deleted.

Disconnecting the stream also doesn't appear to be done automatically
when calling `pa_stream_unref()` for the last time, so let's do that.
2023-08-07 10:40:34 -06:00
Zaggy1024
2de3cee8ea LibAudio: Disconnect from and unref the PulseAudio context with lock
We don't want to pull the stream out from under our PulseAudio main
loop, so call these with the lock to ensure that nothing is touching
them.

The `pa_threaded_mainloop_stop()` call does not require lock as it sets
a flag to tell the main loop to exit.
2023-08-07 10:40:34 -06:00
Zaggy1024
37acdc9ba7 LibAudio: Unlock the mutex in PulseAudioContext::instance() before exit
The mutex used to protect from multiple threads creating PulseAudio
contexts simultaneously could remain locked when an application exited.
The static variables' destructors could be called on the main thread
while another thread is running `PulseAudioContext::instance()` and
synchronously connecting to a PulseAudio daemon. This would cause an
assertion in Mutex that it is unlocked upon its destructor being
called.

By creating a static `ScopeGuard` that locks and immediately unlocks
the mutex, we can ensure that the main thread waits for the connection
to succeed or fail. In most cases, this will not take long, but if the
connection is timing out, it could take a matter of seconds.
2023-08-07 10:40:34 -06:00
Zaggy1024
f22d7bbb90 LibAudio: Remove invalid FIXME from PulseAudioContext::create_stream()
The entire API is designed to run synchronously, the API callers must
implement the asynchronicity.
2023-08-07 10:40:34 -06:00
Zaggy1024
c3ded6d56c LibAudio: Improve PulseAudio stream connection error messages
We were missing a formatted error message printout when the connection
failed after the initial `pa_stream_connect_playback()` API call.
2023-08-07 10:40:34 -06:00
Zaggy1024
5ea5ae85d2 LibAudio: Remove the strong reference to the PulseAudio control thread
Now that `Thread` keeps itself alive when it is running detached, we do
not need to hold onto it in the PulseAudio playback stream's internal
state object. This was a hack that did not work correctly because the
`Thread` object and its action `Function` would be deleted before the
action had exited and cause a crash.
2023-08-07 10:40:34 -06:00
Zaggy1024
aff64b6a03 LibThreading: Make Thread keep itself alive while its action is running
Previously, a `Thread` could be deleted while its action was running,
even if it was running detached.

By changing it to be atomically reference counted, and incrementing the
count when starting the action, we can keep the Thread and its running
action `Function` alive until it exits. Thus, detached `Thread` objects
can be deleted by the thread creating them and allowed to die
naturally.
2023-08-07 10:40:34 -06:00
Zaggy1024
71df0ee994 LibThreading: Remove Thread's inheritance from Core::EventReceiver
Inheritance from `EventReceiver` on the `Thread` class was only used in
the `BackgroundAction` class, where the children vector was keeping the
action alive until the work was completed. However, this can be
accomplished by instead capturing a `NonnullRefPtr` of `this`. The work
function can then avoid having to remove the `BackgroundAction` from
its parent `Thread` when the work completes.
2023-08-07 10:40:34 -06:00
Zaggy1024
925afcd4b0 Meta: Install libpulse on Azure to build PlaybackStreamPulseAudio on CI 2023-08-07 10:40:34 -06:00
Andrew Kaster
167eb501d9 Ladybird: Copy cacert.pem into the expected build-time path on macOS
With the CMake build, the ladybird binary ends up in
$build/bin/ladybird.app/Contents/MacOS. Which is a bit unfortunate for
a few reasons, but the main one is that --enable-lagom-networking
doesn't work with ./Meta/serenity.sh run lagom ladybird.

Let's copy the file to the expected location. There's very likely better
solutions we can use in the future.
2023-08-07 10:34:26 -06:00
Andreas Kling
25eee91811 AK: Make "foo"_fly_string infallible
Stop worrying about tiny OOMs.

Work towards #20405.
2023-08-07 16:03:27 +02:00
Andreas Kling
34344120f2 AK: Make "foo"_string infallible
Stop worrying about tiny OOMs.

Work towards #20405.
2023-08-07 16:03:27 +02:00
Zaggy1024
db2a8725c6 LibCore: Only use coarse time in the Unix event loop wait_for_events()
A typo in the changes to our userland timekeeping classes caused us to
make a syscall every time we want to check whether a timer is ready to
fire in `EventLoopManagerUnix::wait_for_events()`. Instead, only use
coarse time, and get it immediately before it is used in both cases.

This reduces CPU usage by an (eyeballed) 20-30% while playing back
video with VideoPlayer.
2023-08-07 13:38:20 +02:00
Andreas Kling
742eff26a9 Meta: Add Tim Ledbetter to the contributors list :^) 2023-08-07 12:38:03 +02:00
Andi Gallo
ea6e079e07 LibWeb: Snap table grid to device pixels in collapsed borders mode
Before painting the borders, build a grid snapped to device pixels and
use it to construct the rectangles for the cell edges. Also adjust
their starting coordinate and size such that they join correctly
without overhangs. This approach works at all zoom levels.
2023-08-07 05:51:19 +02:00
Jelle Raaijmakers
9466512847 LibGUI: Traverse into directory upon filename entry in FilePicker
Previously, typing e.g. `/home/anon` in the filename field of the
FilePicker resulted in an error for applications expecting an existing
file to open. Intuitively I expected the file picker to navigate to the
directory I typed there, similar to what we have with the location text
box at the top, so I changed it to do exactly that :^)
2023-08-07 05:25:12 +02:00
Aliaksandr Kalenik
c985a1b2af LibWeb: Add non-const version of paintable_box() in DOM::Node 2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
6868ace8f4 LibWeb: Add non-const version of paintable_box() in Layout::Node
Allows to remove a bunch of const_cast's
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
dc08e9138c LibWeb/Tests: Add basic test for Element::scroll(x, y) 2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
433d3f988d LibWeb: Add ad-hoc implementation for Element::scroll(x, y)
Adds very naive implementation for js function to trigger scroll but
that is enough to start using it in tests :)
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
4160f13174 LibWeb: Include scroll offset in paint tree dump 2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
b89481564b LibWeb: Null check dom_node() in PaintableBox::scroll_offset() 2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
fee5b4deb6 LibWeb: Move set_scroll_offset() from Layout::Box to PaintableBox
Nodes in layout tree should not be aware of scroll state.
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
5b7926fa53 LibWeb: Move scroll_offset() from Layout::Box to PaintableBox
Nodes in layout tree should not be aware of scroll state.
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
23a07a8ab6 LibWeb: Introduce PaintableBox::scroll_by()
Moves code responsible for calculation of new scroll offset into
scroll_by() so it could be reused for JS functions that trigger
scroll.
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
fa56ce11a9 LibWeb: Take in account scroll offset in painting 2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
3eb9ae4ed5 LibWeb: Find closest scrollable paintable to call handle_mousewheel()
This makes event handler to try to find scrollable paintable in the
chain of containing blocks of hit box. This is very naive and will
have to be improved in the future.
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
c7673605bb LibWeb: Move mouse wheel handling from Paintable to PaintableBox
It is only PaintableBox that can have scrollable overflow so it doesn't
make sense to have handle_mousewheel() implementation in Paintable.

Also new implementation of handle_mousewheel() takes in account overflow
limits from scrollable_overflow_rect().
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
55b5c61a79 LibWeb: Move scroll offset state from layout tree to dom tree
Scroll offset state should not be reset by layout tree rebuilt.
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
b6ea4b002b LibWeb: Add info about pseudo element type in Layout::Node 2023-08-07 05:23:31 +02:00
Zaggy1024
74636ccb57 LibWeb: Move the media volume slider 1:1 with the mouse cursor
The volume control's slider is drawn in a rectangle shrunken by its
slider handle's size, so the handle did not move 1:1 with the user's
mouse movement.

To fix this, it will now check for a mousedown in the volume control
with a rectangle sized to fit any possible position of the handle, but
the volume value result will be calculated based on the center of the
handle instead. This allows it to move 1:1 with the mouse cursor.

Co-authored-by: trflynn89 <trflynn89@serenityos.org>
2023-08-06 22:23:00 -04:00
Daniel Bertalan
3d19eebba0 CI: Remove workflows dependent on the LibJS website
The linusg/libjs-website repository, which houses the sources for
libjs.dev, has recently been archived. Because of this, we can no longer
update the test262 results page or the Wasm repl :^(. Let's remove these
GitHub Actions workflows to make CI green again.

We'll eventually need something similar once the situation with the
website is sorted out, but having this in git history is enough for
that.
2023-08-06 19:26:28 -06:00
aryanbaburajan
eb85291a18 Chess: Replace usage of DeprecatedString 2023-08-06 22:21:10 +02:00
aryanbaburajan
a94c0eea94 AK: Add trim_ascii_whitespace method to String 2023-08-06 22:21:10 +02:00
aryanbaburajan
bc8cad31de 2048: Replace usage of DeprecatedString 2023-08-06 22:21:10 +02:00
Tim Ledbetter
87bf5045e4 Ports/nesalizer: Add SDL2 header include path to Makefile
Previously, we were relying on the host's SDL2 headers. If none were
present the build would fail.
2023-08-06 22:06:49 +02:00
Andreas Kling
ddbe6bd7b4 Userland: Rename Core::Object to Core::EventReceiver
This is a more precise description of what this class actually does.
2023-08-06 20:39:51 +02:00
Andreas Kling
bdf696e488 LibCore: Remove unused Core::Object::dump_tree() 2023-08-06 18:09:25 +02:00
Andreas Kling
887dfd72b9 LibCore+LibGUI: Remove leftover gunk after Inspector removal
Just some functions in Core::Object and GUI::Widget that aren't called
from anywhere anymore.
2023-08-06 18:09:25 +02:00
Andreas Kling
26647f2b10 LibCore: Remove the Core::Objects::all_objects() list
Nobody actually used the list of all Core::Objects anyway.
2023-08-06 18:09:25 +02:00
Andreas Kling
405187993a LibGUI+LibCore: Move GML property system from LibCore to LibGUI
Since Core::Object properties are really only used by GML now that the
Inspector is long gone, there's no need for these to pollute
Core::Object.

This patch adds a new GUI::Object class to hold properties, and makes
it the new base class of GUI::Window, GUI::Widget and GUI::Layout.
The "instantiate an object by name" mechanism that GML uses is also
hoisted into GUI::Object as well.
2023-08-06 18:09:25 +02:00
Andreas Kling
9f6ceff7cf LibWeb: Implement basic version of CSSOM View's VisualViewport
We got some errors while loading https://twinings.co.uk/ about this
interface missing, and it looked fairly simple so I sketched it out.
Note that I did leave some FIXMEs where it's not clear exactly which
metrics we should be returning.
2023-08-06 16:29:24 +02:00
MacDue
2a914a7a59 LibGfx: Track edge extent in EdgeFlagPathRasterizer
This allows avoiding accumulating values we know will be zero, this is
not a huge speedup but does shave off a few %.
2023-08-06 16:24:28 +02:00
Andreas Kling
ec24d7555a LibWeb: Add a simple internals objects only available during testing
This object is available as `window.internals` (or just `internals`) and
is only accessible while running in "test mode".

This first version only has one API: gc(), which triggers a garbage
collection immediately.

In the future, we can add more APIs here to help us test parts of the
engine that are hard or impossible to reach via public web APIs.
2023-08-06 15:26:34 +02:00