Commit graph

24598 commits

Author SHA1 Message Date
Andreas Kling a6a2caf6db LibCore: Remove unused "client ID" from InspectorServerConnection
This was sharing an ID allocator with event loop timers for some reason.
More importantly, it wasn't actually used for anything.
2023-04-25 14:48:40 +02:00
Andreas Kling 8e7d7b0ec2 LibCore: Remove some unnecessary includes from EventLoop.h 2023-04-25 14:48:40 +02:00
Andreas Kling 029f5b0dad LibCore: Move deferred_invoke() implementation out of line 2023-04-25 14:48:40 +02:00
Andreas Kling 411d36719e LibCore: Simplify Core::Notifier by only allowing one event type
Not a single client of this API actually used the event mask feature to
listen for readability AND writability.

Let's simplify the API and have only one hook: on_activation.
2023-04-25 14:48:40 +02:00
Andreas Kling 1587caef84 LibCore: Move event queueing to a per-thread event queue
Instead of juggling events between individual instances of
Core::EventLoop, move queueing and processing to a separate per-thread
queue (ThreadEventQueue).
2023-04-25 14:48:40 +02:00
Andreas Kling 3a70a16ca7 LibCore: Remove unused EventLoop::wake_current() 2023-04-25 14:48:40 +02:00
Andreas Kling 9601b516b8 LibCore: Remove awkward EventLoop::wake_once() API
This was used in exactly one place, to avoid sending multiple
CustomEvents to the enqueuer thread in Audio::ConnectionToServer.

Instead of this, we now just send a CustomEvent and wake the enqueuer
thread. If it wakes up and has multiple CustomEvents, they get delivered
and ignored in no time anyway. Since they only get ignored if there's
no work to be done, this seems harmless.
2023-04-25 14:48:40 +02:00
Tim Ledbetter 896d1e4f42 LibSQL: Handle statements with malformed exists expressions correctly
Previously, statements containing malformed exists expressions such as:

`INSERT INTO t(a) VALUES (SELECT 1)`;

could cause the parser to crash. The parser will now return an error
message instead.
2023-04-25 08:32:21 -04:00
Emil Militzer 880878e552 LibWeb: Add missing valid-identifiers for display CSS property 2023-04-25 13:46:11 +02:00
Aliaksandr Kalenik ce9d9a10b8 LibWeb: Start fleshing out Navigable::navigate()
Start implementation of https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate

Co-authored-by: Andreas Kling <kling@serenityos.org>
2023-04-25 12:54:01 +02:00
Aliaksandr Kalenik 1ee4a3e310 LibWeb: Add m_ongoing_navigation in Navigable 2023-04-25 12:54:01 +02:00
Andreas Kling 2626e28bb6 LibWeb: Add HTML::Task::Source::NavigationAndTraversal 2023-04-25 12:54:01 +02:00
Andreas Kling aef36ce828 LibWeb: Add ReferrerPolicy::EmptyString
One of the valid enum values for "referrer policy" is the empty string.
Since we're using an enum for this, just add it as an enum value.
2023-04-25 12:54:01 +02:00
Andreas Kling 4d8edf65b5 LibWeb: Add HistoryHandlingBehavior::Push
Also add FIXMEs about removing no-longer-used enum values.
2023-04-25 12:54:01 +02:00
Aliaksandr Kalenik 5446c7adc3 LibWeb: Add HTML::POSTResource
This is "POST resource" from the HTML spec.
2023-04-25 12:54:01 +02:00
Emil Militzer 50af15e6b8 LibWeb: Fix the update of the favicon during navigation
The check on the currently active document for an existing favicon has
been removed. It caused an issue during navigation because the active
document will only be updated after the load and the favicon check has
been executed against the old document.
2023-04-25 06:50:34 -04:00
Zaggy1024 eba72fa3a7 LibVideo/VP9: Wait for workers to finish when there are decoding errors
Previously, the `Parser::decode_tiles()` function wouldn't wait for the
tile-decoding workers to finish before exiting the function, which
could mean that the data the threads are working with could become
invalid if the decoder is deleted after an error is encountered.
2023-04-25 06:35:13 -04:00
Tim Ledbetter 05c8aa71f2 Applications: Update man page links for applications
This commit updates all application man page links to point to the
Applications subdirectory.
2023-04-25 02:16:48 -06:00
Tim Ledbetter 9d30eb4b34 LibManual: Allow paths that include subsections when creating PageNodes
Previously, attempting to open a man file within a subsection would
fail.
2023-04-25 02:16:48 -06:00
Tim Ledbetter 2618639bdb Help: Ensure window title is updated when a subsection is selected 2023-04-25 02:16:48 -06:00
Tim Ledbetter 10700ca4c1 LibManual: Associate SubsectionNode with similarly named markdown file
For a subsection named `Foo` with a markdown file `Foo.md` in the same
directory, the document `Foo.md` will be returned when the subsection is
selected.

This prevents PageNodes and SubsectionNodes from sharing the same
name, which fixes an issue in Help where subsections could not be
navigated.
2023-04-25 02:16:48 -06:00
Timothy Flynn f9d8e42636 LibVideo: Allocate Vector2D underlying storage with new, not malloc
Using malloc does not invoke T's constructor, nor were were invoking T's
constructor ourselves. Accessing T without invoking its constructor is
undefined behavior.
2023-04-25 02:11:11 -06:00
Karol Baraniecki 190a6650bd cal: Add the -y option to show the current year
Without `-y`, to show the current full year you'd have to specify which
one: `cal 2023`. Adding `-y` makes it possible to see the full current
year without remembering what year we are in.

This option is also stolen from FreeBSD :^)

Additionally, validate args: prevent passing both -3 and -y at the
same time. Passing both `--three-month-mode` and `--year` to `cal`
doesn't make sense. You'd either want the one or the other.
2023-04-25 01:54:53 -06:00
Karol Baraniecki dab82e1531 cal: Add the -3 option
This allows to view just the previous, current, and next month
simultaneously. The idea for this is shamelessly stolen from FreeBSD :^)
2023-04-25 01:54:53 -06:00
Karol Baraniecki 94e14bbe65 cal: Get default week start day from Calendar
Making it configurable in system settings :^)
The --start-day option can still overwrite this global default.

This change makes it no longer possible to use unveil: as we have
to load the Calendar config file, which might be in a dynamic location.

It's also neccessary to add `cpath` to the pledge, as opening a
nonexistent config file with Core::ConfigFile::open_for_app creates it.
2023-04-25 01:54:53 -06:00
Karol Baraniecki 114da3a275 cal: Make start of the week configurable
Making all the other parts of the world happier :^)

Add a `--starting-day` (`-s`) option to be compatible with GNU cal,
which has a similar option. The GNU option takes allows passing either
an int or a day name. Let's do something similar using weekdays we
already have in AK/DateConstants.h.

Also add myself to the copyright header, as by now I've modified most of
the lines in this file.
2023-04-25 01:54:53 -06:00
Karol Baraniecki b4bec4dd2f cal: Pad days on the left with spaces instead of zeroes
I think this looks a lot prettier:
          1  2  3  4
 5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

than that:
         01 02 03 04
05 06 07 08 09 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
2023-04-25 01:54:53 -06:00
Karol Baraniecki af2a606f25 cal: Only show year next to each month in one-month-mode
Additionally rename a loop variable in serenity_main() because
after introducing the `Header` enum IMO it's less readable with `i`.
2023-04-25 01:54:53 -06:00
Karol Baraniecki a3e6b18efc cal: Fix width calculation by not leaving an extra space at month's end
Do this by constructing month rows from a Vector of Strings.
2023-04-25 01:54:53 -06:00
Karol Baraniecki 1d47d5bb8b cal: Display month names
For now let's use them from AK/DateConstants.h, in accordance with the
FIXME those propably should be provided by the locale.
2023-04-25 01:54:53 -06:00
Karol Baraniecki 79f5fb798a cal: Use global string widths instead of hardcoding them
...in the format strings. Additionally, get rid of magic numbers,
and make them `constexpr`.
2023-04-25 01:54:53 -06:00
Karol Baraniecki 905f2ca152 cal: Center the month-year text
For now this only has an effect when displaying two-digit years, but
when month names get implemented this will be helpful.
2023-04-25 01:54:53 -06:00
Karol Baraniecki 119dc042ab cal: Mark the current day as inverted text
...instead of putting a star `*` next to it. This makes `cal`s output
much prettier, and gets rid of one FIXME. :^)

Don't use the escape sequence from the deleted FIXME - \e[30;47m would
set the background to white and foreground to black - which presumably
wouldn't do much on a light-theme terminal. Instead use \e[7m which sets
the color as "inverted".
2023-04-25 01:54:53 -06:00
Karol Baraniecki 71cc35ae40 cal: Rewrite cal to use new Strings and handle errors
This additionally fixes a couple of code quality issues in `cal`,
removes reading from unset variables and writing to variables which are
never read.
2023-04-25 01:54:53 -06:00
Karol Baraniecki 812225a70c cal: Correctly identify current day
This fixes cal not highlighting the current day.

After this commit `cal` will show something like this among its output
for the 23rd day of the month

          1  2  3  4
 5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23*24 25
26 27 28
2023-04-25 01:54:53 -06:00
Karol Baraniecki b57c718418 cal: Don't accept passing a [day]
Every other cal implementation just highlights the current day instead
of letting you specify a custom one to highlight. It doesn't seem to be
that useful, and is currently broken - no day gets highlighted at all,
because the `target_day` global is never written to.

Moreover, this complicates parsing the arguments. This commit also fixes
parsing a case where just a year is provided to `cal` - for example `cal
2023`.
2023-04-25 01:54:53 -06:00
Sigmund Lahn f2f14ad9bd LibWeb+WebContent: Make document background and Viewport transparent
This means iframes are transparent by default (as in firefox/chrome).

Painting the outermost canvas background is moved to the PageHost.
2023-04-25 09:33:35 +02:00
Tim Schumacher 5e7c838160 AK: Rename Stream::format() to Stream::write_formatted()
This brings the function name in line with how we usually name those
functions, which is with a `read_` or `write_` prefix depending on what
they do.

While at it, make the internal `_impl` function private and not-virtual,
since there is no good reason to ever override that function.
2023-04-25 07:30:16 +01:00
Lucas CHOLLET ddbe65e2f8 LibGfx/JPEG: Factorize chunk size reading 2023-04-25 06:01:39 +02:00
Lucas CHOLLET 105a40f4f6 LibGfx/JPEG: Rename qtable_id => quantization_table_id 2023-04-25 06:01:39 +02:00
Lucas CHOLLET dd5d2e3505 LibGfx/JPEG: Support up to 4 quantization tables
We used to limit this number to two and name them with their usual
usage. The specification is however broader, and you can find files that
use more tables as in the following link:

https://www.w3.org/MarkUp/Test/xhtml-print/20050519/tests/A_2_1-BF-01.htm
2023-04-25 06:01:39 +02:00
Lucas CHOLLET f46e3e6644 LibGfx/JPEG: Add myself to the copyright header 2023-04-25 06:01:39 +02:00
Lucas CHOLLET 0d3b62cbb7 LibGfx/JPEG: Use more explicit types and add a bunch of const 2023-04-25 06:01:39 +02:00
Sam Atkins 20d517f1da LibChess: Remove use of DeprecatedString in Move::from_algebraic() 2023-04-24 20:58:35 +02:00
Sam Atkins a10cc37ef0 LibChess: Return ErrorOr<String> from to-algebraic/fen methods
Also, avoid creating temporary Strings for numbers, and stop appending
empty StringViews.
2023-04-24 20:58:35 +02:00
Sam Atkins 5f6dd87163 LibChess: Add and use Square::{file,rank}_char() methods
This saves us having to build and allocate a String, just to then use
one character of it.
2023-04-24 20:58:35 +02:00
Sam Atkins c73c697f94 LibChess: Make piece_for_char_promotion() more generally useful
- Rename to make it clear it's not just for promotion
- Understand 'p' for pawns
- Take a char parameter instead of StringView since it's always 1 char
2023-04-24 20:58:35 +02:00
Sam Atkins b111782f18 LibChess: Include pawns in FEN output
Previously, the initial position would look like this:

rnbqkbnr//8/8/8/8//RNBQKBNR w KQkq - 0 1

Now, we correctly give pawns the P/p character in FEN output:

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

Also, we only ever have 1 or 0 characters for a piece, so let's return
`Optional<char>` instead of `StringView` from `char_for_piece()`.
2023-04-24 20:58:35 +02:00
Sam Atkins 8529e660ca LibChess: Move inputs when creating chess Commands 2023-04-24 20:58:35 +02:00
Sam Atkins 29c41e953b LibChess: Convert Commands to use String and propagate errors 2023-04-24 20:58:35 +02:00