Commit graph

45952 commits

Author SHA1 Message Date
Sam Atkins c7c4d70f6e LibCards+Games: Return ErrorOr from deck-creation factory functions :^)
Also, be smarter about appending cards to the deck: we can
unchecked_append them to the deck, since we already ensured enough
capacity earlier.
2023-01-22 21:31:36 +00:00
Sam Atkins 0855e9f014 LibCards+Game: Return ErrorOr from CardGame::drop_cards_on_stack() 2023-01-22 21:31:36 +00:00
Sam Atkins 8b3a94ffbc LibCards+Games+GamesSettings: Return ErrorOr from CardStack::push()
Very few of these calls can propagate their errors yet, but one step at
a time. :^)
2023-01-22 21:31:36 +00:00
Sam Atkins 83687f85df LibCards+Solitaire: Rename CardStack::move_to_stack() -> take_all()
`a.move_to_stack(b)` sounded too much like it moves a's cards to b, when
it actually moves b's cards to a.
2023-01-22 21:31:36 +00:00
Nico Weber 3423b54eb9 LibTextCodec: Make utf-16be and utf-16le codecs actually work
There were two problems:

1. They didn't handle surrogates
2. They used signed chars, leading to eg 0x00e4 being treated as 0xffe4

Also add a basic test that catches both issues.
There's some code duplication with Utf16CodePointIterator::operator*(),
but let's get things working first.
2023-01-22 21:30:44 +00:00
Nico Weber aa9037eed4 AK: Add spec comments to Utf16CodePointIterator::operator*() 2023-01-22 21:30:44 +00:00
Nico Weber 401246ae21 LibJS: Use is_unicode_surrogate more
No behavior change.
2023-01-22 21:27:32 +00:00
Nico Weber 868b358b1a LibJS: Add spec comments to quote_json_string 2023-01-22 21:27:32 +00:00
Nico Weber ba97f471ca LibJS: Add spec comments to CodePointAt 2023-01-22 21:27:32 +00:00
Timothy Flynn ef275e25b8 AK: Reduce String's allocated data by one byte
This was copied from allocation_size_for_stringimpl, which had to ensure
the string is null-terminated. String makes no such guarantee.
2023-01-22 20:27:52 +00:00
Karol Kosek c111536f28 LibGfx: Port JPGLoader to Core::Stream 2023-01-22 20:58:42 +01:00
Karol Kosek 2d976ab2a6 AK: Define is_trivially_serializable trait for Little and BigEndian<>
This will allow us get LittleEndian<> and BigEndian<> wrapped types
directly from Stream::read_value<>().
2023-01-22 20:58:42 +01:00
Karol Kosek c39d3c30b7 LibGfx: Return stream errors when reading a marker in JPGLoader 2023-01-22 20:58:42 +01:00
Tim Schumacher a9eea2e0c4 LibDebug: Use Core::Stream to read opcodes for expression evaluation 2023-01-22 19:12:26 +01:00
Tim Schumacher 91505d8cf3 LibDebug: Port the rest of DWARF parsing to Core::Stream 2023-01-22 19:12:26 +01:00
Tim Schumacher e62269650a LibDebug: Propagate errors throughout DWARF parsing
Splitting this into a separate commit was an afterthought, so this does
not yet feature any fallible operations.
2023-01-22 19:12:26 +01:00
Tim Schumacher e235c42e4d LibDebug: Parse DWARF address ranges using Core::Stream 2023-01-22 19:12:26 +01:00
Tim Schumacher 908b88db34 LibDebug: Use Core::Stream to read the DWARF abbreviations map 2023-01-22 19:12:26 +01:00
MacDue 9b35e3d95b Base: Add test page for canvas gradients 2023-01-22 18:15:52 +01:00
MacDue 27a3e11f02 LibWeb: Implement the canvas gradients
This gets:

- CanvasRenderingContext2D.createLinearGradient()
- CanvasRenderingContext2D.createConicGradient()
- CanvasRenderingContext2D.createRadialGradient()

Actually working as fill styles for paths and rectangles :^)
Getting them working for strokes is left as an exercise is
left as an exercise for the reader.
2023-01-22 18:15:52 +01:00
MacDue 24cb57ac88 LibWeb: Update CRC2D .fillStyle and .strokeStyle to accept gradients
While doing add some structures to hold these new fill styles and
plumb them over to the painter.
2023-01-22 18:15:52 +01:00
MacDue 2be4142138 Meta: Register CanvasGradient as a platform object 2023-01-22 18:15:52 +01:00
MacDue 1a89d77688 LibGfx: Implement paint styles required for HTML canvas gradients
This implements the gradients for:

- CanvasRenderingContext2D.createLinearGradient()
- CanvasRenderingContext2D.createConicGradient()
- CanvasRenderingContext2D.createRadialGradient()

As loosely defined in: https://html.spec.whatwg.org/multipage/canvas.html#fill-and-stroke-styles
(It's really not very well defined for radial gradients)

Actual implementation (for radial gradients) was done with a lot
of trial and error, then visually comparing to other browsers.
2023-01-22 18:15:52 +01:00
MacDue f3c0987afe LibGfx: Add Painter::fill_rect(rect, paint_style)
The usual fill_rect()... but with style :^)
2023-01-22 18:15:52 +01:00
MacDue 223cedc896 LibGfx: Update fill_path() to support taking a PaintStyle
This means fill_path() now paints the scanlines its self rather than
calling draw_line() which easily allows each pixel along the scanline
to have a different color.
2023-01-22 18:15:52 +01:00
MacDue b31d768e95 LibGfx: Add paint styles and allow gradients to be used as them
Also while here add option to disable pre-multiplied alpha for gradients
(this will be handy later).
2023-01-22 18:15:52 +01:00
Nico Weber 19ce63babf icc: Print MultiLocalizedUnicodeTagData contents 2023-01-22 15:25:58 +00:00
Nico Weber 3bc70d7aa5 icc: Print TextTagData contents 2023-01-22 15:25:58 +00:00
Nico Weber ec7a2058a2 LibGfx: Add ICCProfile support for multiLocalizedUnicodeType
This is used in v4 profiles for the required 'cprt' and 'desc' tags.
2023-01-22 15:25:58 +00:00
Nico Weber 3dfb012a1a LibGfx: Add ICCProfile support for textType
This is used in v2 profiles for the required 'cprt' tag.
2023-01-22 15:25:58 +00:00
Nico Weber d33eef14a0 LibGfx: Minorly simplify a line of code in ICCProfile with OptionalNone
No behavior change.
2023-01-21 22:16:38 -05:00
Nico Weber b56a145a67 LibGfx+icc: Make device manufacturer and device model clickable 2023-01-21 22:16:38 -05:00
Timothy Flynn 243caa8fa9 LibJS: Port the VM's single-character ASCII strings to String
This creates the Strings representing the ASCII characters at compile
time, then creates the PrimitiveStrings from those Strings when the VM
is created.
2023-01-22 01:03:13 +00:00
Timothy Flynn 12c8bc3e85 AK: Add a String factory to create a string from a single code point 2023-01-22 01:03:13 +00:00
Timothy Flynn 8aca8e82cb AK: Change String's default constructor to be constant
This allows creating expressions such as:

    constexpr Array<String, 10> {};
2023-01-22 01:03:13 +00:00
Timothy Flynn 34574c5ee8 LibJS+LibWeb: Convert empty PrimitiveString invocators to String 2023-01-22 01:03:13 +00:00
Timothy Flynn 1bcde5d216 LibJS: Port ListFormat and PatternPartition to String 2023-01-22 01:03:13 +00:00
Timothy Flynn 20536897e4 LibJS+LibLocale: Port remaining locale APIs to String 2023-01-22 01:03:13 +00:00
Andrew Kaster d73a143004 LibC: Remove #ifdef KERNEL guard from stddef.h
We aren't including this from the Kernel anywhere anymore, so let's
simplify the file.
2023-01-21 10:43:59 -07:00
Andrew Kaster 5b33381875 LibC: Don't include sys/cdefs.h in ttydefaults as it is used in Kernel 2023-01-21 10:43:59 -07:00
Andrew Kaster c87557e9c1 Kernel+Libraries: Don't include limits.h from LibELF/Validation.h
The fallout of this is that Kernel/Syscalls/execve.cpp doesn't have
access to ARG_MAX anymore, so move that definition to Kernel/API as well
2023-01-21 10:43:59 -07:00
Andrew Kaster ad30b8c447 Kernel+Libraries: Move defines and types from sys/auxv.h to Kernel/API
And don't include <sys/auxv.h> from LibELF/AuxiliaryVector.h, to reduce
the number of Kernel files that include LibC headers.
2023-01-21 10:43:59 -07:00
Andrew Kaster 7ab37ee22c Everywhere: Remove string.h include from AK/Traits.h and resolve fallout
A lot of places were relying on AK/Traits.h to give it strnlen, memcmp,
memcpy and other related declarations.

In the quest to remove inclusion of LibC headers from Kernel files, deal
with all the fallout of this included-everywhere header including less
things.
2023-01-21 10:43:59 -07:00
Andrew Kaster 0420736143 LibC: Remove duplicate declaration of clock_t and time_t
These are pulled from Kernel/API/POSIX/sys/types.h. Removing these
declarations makes sure we only have one place defining them.
2023-01-21 10:43:59 -07:00
Andrew Kaster 100fb38c3e Kernel+Userland: Move LibC/sys/ioctl_numbers to Kernel/API/Ioctl.h
This header has always been fundamentally a Kernel API file. Move it
where it belongs. Include it directly in Kernel files, and make
Userland applications include it via sys/ioctl.h rather than directly.
2023-01-21 10:43:59 -07:00
Andrew Kaster ddea37b521 Kernel+LibC: Move name length constants to Kernel/API from limits.h
Reduce inclusion of limits.h as much as possible at the same time.

This does mean that kmalloc.h is now including Kernel/API/POSIX/limits.h
instead of LibC/limits.h, but the scope could be limited a lot more.
Basically every file in the kernel includes kmalloc.h, and needs the
limits.h include for PAGE_SIZE.
2023-01-21 10:43:59 -07:00
Andrew Kaster 046c23f567 Kernel+LibC: Move LibC/signal_numbers.h to Kernel/API/POSIX
Make Userland and Tests users just include signal.h, and move Kernel
users to the new API file.
2023-01-21 10:43:59 -07:00
Lucas CHOLLET d4ef2e226c LibGUI: Mimic a user click when calling Button::click()
The `mimic_pressed` function was primarily used in one place, the
Calculator. This patch removes quite a lot of logic duplication there.
It is also profitable to a lot of other places where `click()` was
called without mimicking a click.
2023-01-21 14:49:46 +01:00
Lucas CHOLLET 96b3063121 LibGUI: Rename Button method set_mimic_pressed => mimic_pressed
This function does more things than a simple getter, so it's probably
better to not use this notation.

I also drop the parameter as it was always used with the same value.
2023-01-21 14:49:46 +01:00
Lucas CHOLLET c15a7b79ef LibGUI: Remove public getter Button::is_mimic_pressed()
This method shouldn't be used outside the class and having a getter for
a bool seems a bit overkill.
2023-01-21 14:49:46 +01:00