Commit graph

45910 commits

Author SHA1 Message Date
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
Ali Mohammad Pur 7d4a30af56 LibCore: Avoid logical OOB read in AllocatingMemoryStream::offset_of()
The previous impl was trimming the last chunk to the free space instead
of the used space, which yielded an OOB read if the needle wasn't found.
2023-01-20 20:34:31 +00:00
Timothy Flynn c8e25a71e0 AK: Disable use of consteval in String::from_utf8_short_string for Apple
This causes an ICE on older versions of clang, and Apple's clang is
currently based on such a version.
2023-01-20 20:33:04 +00:00
Timothy Flynn 95d1678553 LibJS: Mark infallible operations that may throw only due to OOM 2023-01-20 20:31:38 +00:00
Timothy Flynn 52b76060f9 LibJS: Add a macro for infallible operations that may throw OOM
If a spec step hasn't been marked as fallible, but might throw due to
OOM, this is to make it clear that OOM is the only thing that may cause
a failure.
2023-01-20 20:31:38 +00:00
Timothy Flynn f1de4f8872 Everywhere: Convert known short-strings to the infallible String factory
For now, this is limited to strings that are 3 bytes or less. We can use
7 bytes on 64-bit platforms, but we do not yet assume 64-bit for Lagom
hosts (e.g. wasm).
2023-01-20 14:24:12 -05:00
Timothy Flynn d48266a420 AK: Support creating known short string literals at compile time
In cases where we know a string literal will fit in the short string
storage, we can do so at compile time without needing to handle error
propagation. If the provided string literal is too long, a compilation
error will be emitted due to the failed VERIFY statement being a non-
constant expression.
2023-01-20 14:24:12 -05:00
Timothy Flynn e634778679 CI: Install a more up-to-date version of emscripten
This is to allow using more recent C++20 features in upcoming commits.
Version 3.1.6 is what is installed on Ubuntu 22.10 and works with the
C++20 features we want.
2023-01-20 14:24:12 -05:00
Sam Atkins 93ca5d4772 Tests: Use AK::shuffle() for shuffling 2023-01-20 17:45:33 +00:00
Sam Atkins 4b525fc98e ColorLines: Use AK::shuffle() for shuffling 2023-01-20 17:45:33 +00:00