Commit Graph

53090 Commits

Author SHA1 Message Date
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
Zaggy1024
ba236e3f21 PixelPaint: Don't const_cast to update the editor on filter application 2023-08-06 11:56:21 +02:00
Shannon Booth
faf9d08371 AK: Fix IPv6 serialization on multiple '0' parts ending in a '0' part
This could happen if a sequence of '0' parts was followed by a longer
sequence of '0' parts at the end of the host. The first sequence was
being used for the compress, and not the second.

For example, [1:1:0:0:1:0:0:0] was being serialized as: [1:1::1:0:0:0]
instead of [1:1:0:0:1::].

Fix this by checking at the end of the loop if we are in the middle of a
sequence of '0' parts that is longer than the current longest.
2023-08-06 10:53:32 +02:00
Tim Ledbetter
7f99f3bf29 fortune: Use simple formatting when stdout isn't connected to a terminal
This changes the default behavior, so that, by default, color codes,
hyperlinks and additional spacing are only emitted when standard
output is connected to a terminal.

The default coloring behavior can be overridden with the `--color`
option. Valid arguments for this option are: 'always', 'never' and
'auto' (default).
2023-08-06 08:58:00 +02:00
Shannon Booth
db5ad0c2b0 AK: Remove ApplyPercentDecoding from URL
Nowhere was setting this flag from the default.
2023-08-06 08:57:23 +02:00
Shannon Booth
98666b012d AK: Remove URL::ApplyPercentEncoding
Everywhere only ever expects percent encoding to occur, so let's just
remove this flag altogether. At the same time, replace some
DeprecatedString with StringView.
2023-08-06 08:57:23 +02:00
Shannon Booth
c4d7be100e AK: Directly append URL paths where applicable
This is a little closer to the spec text, and helps us avoid using
the ApplyPercentEncoding flag.
2023-08-06 08:57:23 +02:00
Andreas Kling
fc44d09221 CI: Pull test262 runner from SerenityOS/libjs-test262 2023-08-06 08:56:23 +02:00
Aliaksandr Kalenik
c72a2f9e46 LibWeb/CSS: Serialize short version if possible for "place-" properties
Output short version when both parts of place-content, place-items,
place-self are the same.
2023-08-06 08:26:36 +02:00
Aliaksandr Kalenik
da2cd73bcf LibWeb: Add place-self css property support 2023-08-06 08:26:36 +02:00
Tim Ledbetter
f24aab662f Ports: Update freeciv to version 3.0.8
This commit also removes a logging patch, as these changes have now
been upstreamed.
2023-08-05 22:29:57 +02:00
Tim Ledbetter
0be4a3b635 Ports/doom: Use upstream doomgeneric SDL port
Doing this means we no longer need to maintain our own Doom fork and
we get  the newest features of the upstream repository, such as sound
effects and music.
2023-08-05 20:27:45 +02:00
Hendiadyoin1
36dcb0ada7 LibWeb: Use int-hash for CSSPixels 2023-08-05 20:03:09 +02:00
Hendiadyoin1
6c341ca985 LibWeb: Implement rounding for PixelUnits 2023-08-05 20:03:09 +02:00
Hendiadyoin1
cc74083f27 LibWeb: Inline and constexpr most PixelUnits methods 2023-08-05 20:03:09 +02:00
Hendiadyoin1
1e5ba09d76 LibWeb: Saturate PixelUnits on creation when needed 2023-08-05 20:03:09 +02:00
Hendiadyoin1
95d00553c9 LibWeb: Use default comparator for PixelUnits 2023-08-05 20:03:09 +02:00