Commit graph

45919 commits

Author SHA1 Message Date
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
Aliaksandr Kalenik
56ceb6a106 LibWeb: Fix floats y offset calculation
There is a difference in y offset position calculation for floats when
LineBuilder provides final y position while for blocks it needs to be
adjusted by `y_offset`. This difference already accounted in floating
box position calculation and this patch also makes it accounted in check
whether a floating boxes on the same line intersect between each other.
2023-01-21 14:45:09 +01:00
Tim Schumacher
63cf9b973d AK: Remove FileStream 2023-01-21 14:43:56 +01:00
Tim Schumacher
9d7606b8de UserspaceEmulator: Use Core::Stream for writing profiling data
This looks like it should compile, but UserspaceEmulator is currently
broken on any non-i686 platform anyways, so I can't test that.
2023-01-21 14:43:56 +01:00
martinfalisse
173cc5e6e0 Base: Add tests for grid-template-areas and min/max-content 2023-01-21 14:35:00 +01:00
martinfalisse
fa2c3b7c3d LibWeb: Place grid items in grid-areas if applicable
If valid grid-template-areas were given, then place grid items within
these areas. Grid-template-areas take precedence over named line
tracks, meaning if there are grid-areas as well as named tracks, should
use the grid-areas.
2023-01-21 14:35:00 +01:00
martinfalisse
47c77858b6 LibWeb: Calculate valid grid areas
When starting the GridFormattingContext, calculate the valid grid areas
as declared in the `grid-template-areas` property. Since this doesn't
change, are able to do this once and store the results.
2023-01-21 14:35:00 +01:00
martinfalisse
fa5d016176 LibWeb: Implement min/max-content
Use the min/max-content properties when given as a size for a
grid-column or grid-row.
2023-01-21 14:35:00 +01:00
martinfalisse
9d07ec3934 LibWeb: Refactor grid item positioning to use zero-index
In some sections of the code, previously would use the values passed to
`grid-column-start`, `grid-row-end`, etc. literally. Since these values
start at grid-column 1 instead of 0 (as represented in most areas in
the code), this made the code unnecessarily complicated.

Now the values are zero-indexed from the getgo.
2023-01-21 14:35:00 +01:00
martinfalisse
9bc001f410 LibWeb: Parse grid-area CSS property 2023-01-21 14:35:00 +01:00
martinfalisse
a6548c4d80 LibWeb: Parse grid-template-areas CSS property 2023-01-21 14:35:00 +01:00
martinfalisse
0448547553 LibWeb: Parse min and max-content
Parse min and max-content as well as use its values in the GridTrackSize
class.
2023-01-21 14:35:00 +01:00
martinfalisse
9d99bd8258 LibWeb: Use String class in certain CSS Grid classes
Converts the remaining instances of DeprecatedString to String in the
CSS Grid classes.
2023-01-21 14:35:00 +01:00
martinfalisse
aec2dadfdd AK: Add split() for String 2023-01-21 14:35:00 +01:00
Timothy Flynn
4f5353cbb8 AK: Rename double_hash to rehash_for_collision
The name is currently quite confusing as it indicates it hashes doubles.
2023-01-21 10:36:14 +01:00
Timothy Flynn
dbc04bbf1b LibWeb: Use type-correct hashing and formatting functions for pixels
1. Don't use double_hash. This is not for doubles, as its name implies.

2. Specialize traits and formatters using the underlying DistinctNumeric
   type of Web::DevicePixels and Web::CSSPixels.
2023-01-21 10:36:14 +01:00
Timothy Flynn
60b56892ca AK: Add a type alias for DistinctNumeric's underlying type 2023-01-21 10:36:14 +01:00
Nico Weber
a0522aec90 icc: Remove needless use of DateTime::to_deprecated_string()
Turns out DateTime has a Formatter that prints the same thing that
to_deprecated_string() returns.

No behavior change.
2023-01-21 01:50:24 +00:00
Nico Weber
e47e5f5ce0 icc: Tweak output to look nicer
Align header on the `:`, and make bitmask output more structured.
2023-01-21 01:50:24 +00:00
Tim Schumacher
49b30d3013 AK: Remove InputBitStream and OutputBitStream 2023-01-21 00:45:33 +00:00
Tim Schumacher
b1bfeb391e LibPDF: Use Core::Stream to parse the page offset hint table 2023-01-21 00:45:33 +00:00
Nico Weber
f28b052590 LibGfx: Add scaffolding for reading ICC tag table
The idea is that we'll have one type for each tag type.
For now, this treats all tag types as unknown, but it puts most
of the infrastructure for reading tags in place.
2023-01-20 21:44:36 +00:00
Nico Weber
5017d8fdcb LibGfx: Extract Profile::read_header() function 2023-01-20 21:44:36 +00:00
Nico Weber
e5234f582d LibGfx: Make ICCHeader use FourCC types for fourcc fields
No behavior change. Arguably more expressive.
2023-01-20 21:44:36 +00:00
Nico Weber
046c79b468 LibGfx: Make DistinctFourCC compatible with BigEndian 2023-01-20 21:44:36 +00:00
Tim Schumacher
0245614a4f LibCore: Remove FileStream 2023-01-20 20:50:42 +00:00
Tim Schumacher
2def995d22 wasm: Interface with the standard output via Core::Stream 2023-01-20 20:50:42 +00:00
Tim Schumacher
29cdd124d1 gunzip: Use Core::Stream to write the decompression output 2023-01-20 20:50:42 +00:00
Tim Schumacher
debde54928 WebServer: Use Core::Stream to read served files 2023-01-20 20:50:42 +00:00
Tim Schumacher
3a16168ace LibGfx: Use Core::Stream to write bitmap fonts 2023-01-20 20:50:42 +00:00
Tim Schumacher
9eb040af32 Tests: Use Core::Stream to write output files in LibGL tests 2023-01-20 20:50:42 +00:00
Tim Schumacher
d7eead4f4c AK: Remove DuplexMemoryStream 2023-01-20 20:48:40 +00:00
Tim Schumacher
5896f8cf2b LibAudio: Use AllocatingMemoryStream as the MP3 loader bit reservoir 2023-01-20 20:48:40 +00:00
Tim Schumacher
52cb066cae LibWasm: Use AllocatingMemoryStream around Wasm::Printer 2023-01-20 20:48:40 +00:00