Commit Graph

23610 Commits

Author SHA1 Message Date
Sam Atkins
5708a47157 Snake: Implement image-based skins
Co-authored-by: HawDevelopment <hawdevelopment@gmail.com>
2023-03-20 09:29:30 +01:00
Sam Atkins
da7c883dfa Snake: Move geometry types into Geometry.h and add Direction enum 2023-03-20 09:29:30 +01:00
Sam Atkins
3ce87ea5f9 Snake: Remember if game was paused when picking color
If we were paused before, don't start the game after closing the dialog.
2023-03-20 09:29:30 +01:00
Aliaksandr Kalenik
4f496e97fe LibWeb: Add keep-alive in response headers if it present in request
This fix addresses issue where, if request headers contain
"Connection: keep-alive", we keep socket open without letting client
know that we support keep-alive connections. This can result in a
large number of open and unused sockets.
2023-03-19 22:31:59 -04:00
Elisée Maurer
38a3e28799 LibWeb: Stub out a few form validation and selection methods 2023-03-19 18:58:50 +00:00
Caoimhe
23d31ac11d SoundPlayer: Keep track of the selected visualization in the config 2023-03-19 18:57:30 +00:00
Caoimhe
4c49e0f4a3 SoundPlayer: Move get_image_from_music_file to the advanced view 2023-03-19 18:57:30 +00:00
Aliaksandr Kalenik
dcc4868a3c LibWeb: Rename PaintableBox::clip_rect() 2023-03-19 19:04:51 +01:00
Aliaksandr Kalenik
7ddacef3b5 LibWeb: Apply border-radius clip only if overflow hidden for both axis
Before this change `apply_clip_overflow_rect` might crash trying to
access `clip_rect` that does not have value because we currently
support calculation of visible rectangle when `overflow: hidden`
is applied for both axis.
2023-03-19 19:04:51 +01:00
Srikavin Ramkumar
633983d354 LibWeb: Update stylesheet loading to use fetch infrastructure 2023-03-19 14:16:15 +00:00
Srikavin Ramkumar
f7176463b5 LibWeb: Implement 'create a potential-CORS request' algorithm 2023-03-19 14:16:15 +00:00
kleines Filmröllchen
1ee2091b2d LibAudio: Support FLAC files with unknown amount of samples
This is a special case of the sample count field in the header which we
treated as a format error before. Now we just take care to check stream
EOF before reading chunks.

This makes the final FLAC spec test pass, making us one of the most
compliant loaders! :^)
2023-03-19 14:15:35 +00:00
kleines Filmröllchen
b2a018ee59 LibAudio: Use specified bit depth directly
We report a rounded up PCM sample format to the outside, but use the
exact bit depth as specified in header and frames.

This makes the three FLAC spec tests with a a bit depth of 20 pass.
2023-03-19 14:15:35 +00:00
Aliaksandr Kalenik
16a4949e33 WebDriver: Fix handling of disconnected WebContent process
If WebContent process got disconnected it is only necessary to remove
associated window instead of terminating the entire session.
2023-03-19 14:51:40 +01:00
Aliaksandr Kalenik
7146c33522 WebDriver: Close all WebContent connections while destroying a session
While closing a session, it is necessary to close all windows that may
have been opened during that session.
2023-03-19 14:51:40 +01:00
Aliaksandr Kalenik
63c16ff41a WebDriver: Inline Sesssion::stop() in session destructor
Previously it was possible to have following sequence of calls
while destroying a session:
1. `WebContentConnection::die()` calls `Client::close_session()`
2. `Client::close_session()` removes a session from active sessions
map which causes session destructor call.
3. Session destructor calls `Client::close_session()` to remove a
session from active sessions.

With `stop()` method inlined into destructor `close_session()` need
to be called just once while destroying a session.
2023-03-19 14:51:40 +01:00
Lucas CHOLLET
b79cd5cf6e LibGUI: Update progress of thumbnail generations on failure
Not doing it result in FileManager's progress bar being left as
incomplete even if all jobs were finish.
2023-03-19 01:26:37 +00:00
Lucas CHOLLET
ebb9c3a430 LibThreading: Execute on_error on the original EventLoop
As the user might want to have interactions with LibGUI while handling
errors, this code should be executed in the original `EventLoop`.
Similarly to what is done with the error-free path.
2023-03-19 01:26:37 +00:00
Lucas CHOLLET
b084759690 LibGfx/JPEG: Make JPEGImageDecoderPlugin's constructor take a Stream
This allows us to get rid of the raw pointer and size in the JPEG
context struct.
2023-03-19 00:41:33 +00:00
Matt Purnell
bc23b07570 LibGfx: Correct the type of Lookup.subtable_offsets
According to the spec (and the variable name), it should be an array of
offsets, not u16s. Noticed while watching Andreas' most recent video.
2023-03-19 00:32:01 +00:00
kleines Filmröllchen
27d9ed0224 LibAudio: Use new generic seek table for MP3
MP3 had the exact same data structure, except less readable and less
efficient.
2023-03-19 00:28:02 +00:00
kleines Filmröllchen
0cd0565abc LibAudio: Improve FLAC seeking
"Improve" is an understatement, since this commit makes all FLAC files
seek without errors, mostly with high accuracy, and partially even fast:
- A new generic seek table type is introduced, which keeps an
  always-sorted list of seek points, which allows it to use binary
  search and fast insertion.
- Automatic seek points are inserted according to two heuristics
  (distance between seek points and minimum seek precision), which not
  only builds a seek table for already-played sections of the file, but
  improves seek precision even for files with an existing seek table.
- Manual seeking by skipping frames works properly now and is still used
  as a last resort.
2023-03-19 00:28:02 +00:00
Caoimhe
87bfb47d1f FileManager: Extract .zip files to a temporary folder when opened
Prior to this commit, when you double-click a .zip file to open it, it
gets opened in Text-Editor as there is no other file association.

Now, when FileManager is invoked with a .zip file as the first argument,
a temporary directory will be created and the .zip will be extracted
into it. Once the FileManager window is closed, Core::TempFile will
delete the temporary directory.

This adds something like what we see in other operating systems' file
explorers, except for the fact that most other operating systems will
treat the .zip file as its own independent read-only filesystem. It
would be nice to do that in the future, but I feel like this is
sufficient for now.
2023-03-19 00:14:03 +00:00
Caoimhe
de18485a2f LibCore: Improve the TempFile wrapper
- We were using primitive versions of mkstemp and mkdtemp, they have
  been converted to use LibCore::System.
- If an error occurred whilst creating a temporary directory or file, it
  was thrown and the program would crash. Now, we use ErrorOr<T> so that
  the caller can handle the error accordingly
- The `Type` enumeration has been made private, and `create_temp` has
  been "split" (although rewritten) into create_temp_directory and
  create_temp_file. The old pattern of TempFile::create_temp(Type::File)
  felt a bit awkward, and TempFile::create_temp_file() feels a bit nicer
  to use! :^)

Once the Core::Filesystem PR is merged (#17789), it would be better for
this helper to be merged in with that. But until then, this is a nice
improvement.
2023-03-19 00:14:03 +00:00
Caoimhe
5072a2280d LibCore: Add syscall wrapper for mkdtemp() 2023-03-19 00:14:03 +00:00
Andreas Kling
1f99f9523d LibWeb: Add temporary hack for line-height: calc(...)
At the moment, we can't resolve CSS calc() values without having a
LayoutNode. The new StyleProperties::line_height() overload was trying
to do exactly that, which led to an assertion.

This patch makes `line-height: calc(...)` behave the same as
`line-height: normal` for now and adds a FIXME.
2023-03-18 21:15:51 +01:00
Mathis Wiehl
ed1a7aee43 LibWeb: Don't deref HTMLInputElement parent if its null
Don't crash in case the elements parent is null.
2023-03-18 21:05:23 +01:00
Andreas Kling
245e3b9c3a LibWeb: Honor pointer-events: none when hitting a PaintableBox
If the PaintableBox had children, but we didn't hit any of them, we
default to saying that you hit the PaintableBox itself.

However, if said PaintableBox has `pointer-events: none`, we should
say nothing was hit, so that the hit testing can continue.

This fixes an issue where Discord server icons were not clickable.
2023-03-18 20:30:09 +01:00
Andreas Kling
76e520884e LibWeb: Traverse shadow boundaries when looking for focus candidates
This makes focusing input fields by clicking on them work.

Fixes #17801
2023-03-18 20:28:15 +01:00
Andreas Kling
72d817d4ea LibWeb+Browser+Ladybird: Add menu action to dump paint tree 2023-03-18 20:23:35 +01:00
Simon Wanner
a13c21c807 LibWeb: Specify height as 1lh to fix the size of empty text boxes
Previously, empty text boxes would fall back to the min-height: 16px
set on the <input> element. As soon as there is any content they
would usually gain height because the line height of that text is
more than 16px (depending on the font/font-size used).

Now they use height: 1lh for the inner div (which contains the
actual text), which matches the exact height of 1 line of content.
2023-03-18 20:14:52 +01:00
Simon Wanner
a5a3913e39 LibWeb+LibWebView: Show shadow roots in the DOM inspector 2023-03-18 20:14:52 +01:00
Simon Wanner
554c4af90f LibWeb: Add support for the lh and rlh length units
Resolving these units is somewhat tricky because of their interaction
with both font-size and line-height, but this implementation seems to
work as tested in http://wpt.live/css/css-values/lh-unit-001.html and
http://wpt.live/css/css-values/lh-unit-002.html
2023-03-18 20:14:52 +01:00
Timothy Flynn
8a8340b3cd LibWeb: Port MutationRecord types to FlyString
Co-authored-by: Luke Wilde <lukew@serenityos.org>
2023-03-18 19:50:45 +01:00
Timothy Flynn
db2ba5f1d9 LibWeb: Initialize static web strings during main-thread VM creation
These are currently initialized in a [[gnu::constructor]], which has a
weird initialization order. These constructors are invoked before main()
and, incidentally, before any user-defined default constructors of the
static strings they are initializing.

This will become an issue when these strings are ported to FlyString,
which has a user-defined default constructor. In that scenario, when the
FlyString constructor is executed after the [[gnu::constructor]], the
strings will be "reset" to the empty string.

Instead of relying on a non-standard compiler extension here, let's just
initialize these strings explicitly during main-thread VM creation, as
this now happens in WebContent's main().
2023-03-18 19:50:45 +01:00
Timothy Flynn
0d0b87fd46 LibJS: Add a PrimitiveString::create overload for FlyString
This is to disambiguate this type from the StringView overload.
2023-03-18 19:50:45 +01:00
Andreas Kling
7f632ee6f8 LibWeb: Fix bogus callback comparisons in EventTarget
When CallbackType::callback was converted from Object& to NNGCP<Object>,
we started comparing the addresses of NNGCPs instead of the addresses of
Objects.

That broke the Discord login form, and this patch fixes it.

Regression from 7c0c1c8f49.
2023-03-18 16:37:09 +01:00
Andreas Kling
8b177a6da5 LibWeb: Clarify stacking context creation for viewport box
Explicitly check is_viewport() instead of looking at the corresponding
DOM node. (The viewport has the DOM document as its DOM node, but that's
not obvious from context here.)
2023-03-18 16:34:41 +01:00
Mathis Wiehl
8169b878f8 LibWeb: Invalidate sibling styles on input element checked state change
Checkedness of an input element can influence sibling style, as well as
style of their children, when they use the `:checked` pseudo-class in
combination with a kind of sibling selector. That means its not
sufficient to just invalidate the input elements on style.

This is actually more commonly observable than one might expect, because
this pattern is often used as a JS-free toggle solution for things like
menus.
2023-03-18 16:01:12 +01:00
Mathis Wiehl
f7d2392b6c LibWeb: Consider deprecated application/font-woff mime type
Though deprecated by IANA, `application/font-woff` is still in active
use as a MIME type for WOFF fonts by web servers throughout the wild
web.
2023-03-18 13:47:51 +01:00
Mathis Wiehl
3a45bba4e0 LibWeb: Load alternative font urls if others fail
We don't support all parts of the font formats we assume as "supported"
in the CSS parser. For example, if an open type font has a CFF table, we
reject loading it. This meant that until now, when such an
unsupported-supported font url was first in the list of urls, we
couldn't load it at all, even when we would support a later url.

To resolve that, try loading all font urls one after each other, in case
we are not able to load the higher priority one.

This also resolves a FIXME related to spec compliant url prioritization.
Our CSS parser already filters and prioritizes font src urls in
compliance with the spec. However, we still had to resort to brittle
file extension matching, because some websites don't set the `format`
and if the first url in a src list happened to be one we don't support,
the font could not be loaded at all. This now is unnecessary because we
can try and discard the urls instead.
2023-03-18 13:47:51 +01:00
Andreas Kling
1dc074fc18 LibWeb: Treat flex item's cyclic percentage cross size as auto
This fixes an issue where e.g `height: 100%` on a flex item whose
container has indefinite height was being resolved to 0. It now
correctly behaves the same as auto.
2023-03-18 00:26:19 +01:00
Andreas Kling
062b8e5957 LibWeb: Print unimplemented calc() expressions in the debug log 2023-03-18 00:26:19 +01:00
kleines Filmröllchen
9ff01723ba Userland: Use more common WAV MIME type
There is no official IANA MIME type for WAV (see
https://www.iana.org/assignments/media-types/media-types.xhtml#audio),
so this will always be subjective. While
https://www.rfc-editor.org/rfc/rfc2361 suggests audio/vnd.wave, we use
audio/wav since that seems to be most common across the internet.
2023-03-17 22:20:16 +00:00
Daniel Bertalan
e3195b060d LibVT: Fix integer overflow when parsing long OSC sequences
We were storing indices into OSC escape sequences as `u8`s, which
overflow at a length of just 256 characters. This caused a crash when
parsing OSC 8 hyperlinks pointing to long filenames.
2023-03-17 16:50:22 +00:00
Timothy Flynn
6e1b5b541a LibWeb: Move initialization of the MainThreadVM to WebContent's main()
It is a fallible operation, so this lets us abort early if it fails.
2023-03-17 16:39:08 +00:00
Timothy Flynn
13dfadba79 LibJS: Propagate errors from VM creation 2023-03-17 16:39:08 +00:00
Timothy Flynn
eb5aae24f4 LibJS: Move creation of fallible VM objects to its creation factory
No change of behavior in this patch, but this will allow this factory to
propagate any errors from the creation of these objects.
2023-03-17 16:39:08 +00:00
gohai
d5577002d5 LibGfx/OpenType: Fix bound-check 2023-03-17 15:44:45 +01:00
Kemal Zebari
3918a8492b Browser: Have the bookmark button use the editor dialog
Now when the bookmark button that has not yet bookmarked the current
URL is pressed, it will add the bookmark but also prompt the user
with the BookmarkEditor dialog in case they wish to make final
touches to their bookmark title or URL. If they cancel or escape
the dialog, the bookmark will be removed.
2023-03-17 13:43:11 +00:00