Commit graph

45415 commits

Author SHA1 Message Date
Nico Weber aee7c44064 LibGfx+icc: Print primary platform
There's a small, old-timey list of platforms in the spec, but as far
as I can tell nobody is using additional platforms on Linux or Android
or what. So let's try going with an enum class instead of the FourCC
machinery for now.
2023-01-08 09:56:07 +00:00
Nico Weber 6d70b6a3a7 LibGfx: Put parse_device_attributes() in spec order 2023-01-08 09:56:07 +00:00
implicitfield ebcd07ff33 LibArchive: Use read_entire_buffer for reading extended headers
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53913
2023-01-08 09:54:08 +00:00
implicitfield 28c99e7a1f LibArchive+Utilities: Stop using DeprecatedString
This also slightly improves error propagation in tar, unzip and zip.
2023-01-08 09:54:08 +00:00
Lucas CHOLLET 8377adfde0 ThemeEditor: Port to Core::Stream 2023-01-08 08:12:50 +00:00
Lucas CHOLLET a5d5b970ff Chess: Port to Core::Stream 2023-01-07 20:05:24 +00:00
Cody Hein 9a05175a88 WindowServer: Do not add existing menu items (by ptr) to m_menus
This resolves a fixme requesting that we do not add duplicate menus
2023-01-07 19:57:57 +00:00
Lucas CHOLLET 8a87aa85ae GMLPlayground: Port to Core::Stream 2023-01-07 19:53:35 +00:00
Lucas CHOLLET cf1eea27d3 LibGUI: Add TextEditor::write_to_file(Core::Stream::File&)
This overload use the `Core::Stream` API instead of the now deprecated
one `Core::File`.
2023-01-07 19:53:35 +00:00
Liav A 72b144e9e9 Kernel/Graphics: Introduce a new mechanism to initialize a PCI device
Instead of using a clunky switch-case paradigm, we now have all drivers
being declaring two methods for their adapter class - create and probe.
These methods are linked in each PCIGraphicsDriverInitializer structure,
in a new s_initializers static list of them.
Then, when we probe for a PCI device, we use each probe method and if
there's a match, then the corresponding create method is called.

As a result of this change, it's much more easy to add more drivers and
the initialization code is more readable.
2023-01-07 11:51:13 -07:00
Liav A 7625f7db73 Kernel/Graphics: Allocate 16 MiB framebuffer if failed allocating larger
We try our best to ensure a DisplayConnector initialization succeeds,
and this makes the Intel driver to work again, because if we can't
allocate a Region for the whole PCI BAR mapped region, then we will try
to allocate a Region with 16 MiB window size, so it doesn't eat the
entire Kernel-allocated virtual memory space.
2023-01-07 11:45:08 -07:00
Liav A 25bb293629 Kernel: Make Device::after_inserting to return ErrorOr<void>
Instead of just returning nothing, let's return Error or nothing.
This would help later on with error propagation in case of failure
during this method.

This also makes us more paranoid about failure in this method, so when
initializing a DisplayConnector we safely tear down the internal members
of the object. This applies the same for a StorageDevice object, but its
after_inserting method is much smaller compared to the DisplayConnector
overriden method.
2023-01-07 11:45:08 -07:00
Andreas Kling 15c0efede9 LibWeb: Take used width into account in flex item intrinsic cross sizing
When calculating intrinsic heights of flex items, we should use the used
width if available.

This primarily matters for item cross sizing, since that happens after
we've determined the item's main size.
2023-01-07 19:41:21 +01:00
Andreas Kling ab2f105344 LibWeb: Store flex item used sizes as Optional<CSSPixels>
This will allow us to tell whether values have been assigned by the flex
layout algorithm yet.
2023-01-07 19:41:21 +01:00
Andreas Kling dbbc75f8fd LibWeb: Improve hypothetical flex item "auto" cross sizes
Take the used main size of the item into account (as available size)
when doing inner or intrinsic layout to determine the cross size.
2023-01-07 19:41:21 +01:00
Andreas Kling 244d4e19fa LibWeb: Run more of flex layout algorithm for intrinsic sizing
We were trying to take a shortcut by avoiding much of the flex layout
algorithm during intrinsic sizing. Unfortunately, this isn't good enough
since we may end up needing some of the flex item metrics for intrinsic
contribution calculations.

This means we do a bit more work for flexboxes, but intrinsic sizes are
correct in more cases.
2023-01-07 19:41:21 +01:00
Liav A c1d3c1e0cb Documentation: Remove references to the removed RTL8139 driver 2023-01-07 11:37:57 -07:00
Liav A 5c97c6d874 Kernel: Remove the RTL8139 PCI network adapter driver
Nobody tests this network card, and the driver has bugs (see the issue
https://github.com/SerenityOS/serenity/issues/10198 for more details),
so it's almost certain that this happened due to code being rotting when
there's simply no testing of it.

Essentially this has been determined to be dead-code so this is the most
important reason to drop this code. Another good reason to do so is
because the RTL8139 only supports Fast Ethernet connections (10/100
Megabits per second), and is considered obsolete even for bare metal
setups.
2023-01-07 11:37:57 -07:00
Ben Wiederhake 3281050359 Everywhere: Remove "LibC/" includes, add lint-rule against it 2023-01-07 10:01:37 -07:00
Ben Wiederhake d575cfda61 AK: Restrict include of LibC header 2023-01-07 10:01:37 -07:00
Ben Wiederhake d1c397ad6e Tests: Remove already-completed fixme 2023-01-07 10:01:37 -07:00
Aliaksandr Kalenik a913410730 LibWeb: Consider span in table column width calculation
Implemention of following parts in CSS Tables 3 spec:
https://www.w3.org/TR/css-tables-3/#min-content-width-of-a-column-based-on-cells-of-span-up-to-n-n--1
https://www.w3.org/TR/css-tables-3/#max-content-width-of-a-column-based-on-cells-of-span-up-to-n-n--1
2023-01-07 14:59:56 +01:00
Andrew Kaster 64a242261e AK: Reimplement DistinctNumeric comparison operators using operator<=>
Unlike what the class comment says, it's actually valid to return int
from this operator and treat it like a "normal" C-like compare method.
2023-01-07 14:51:04 +01:00
Andrew Kaster a8fcd39b88 AK: Reimplement comparisons on AK::Time using operator<=>
This allows us to make all comparision operators on the class constexpr
without pulling in a bunch of boilerplate. We don't use the `<compare>`
header because it doesn't compile in the main serenity cross-build due
to the include paths to LibC being incompatible with how libc++ expects
them to be for clang builds.
2023-01-07 14:51:04 +01:00
Andrew Kaster 83ad5bfba0 AK: Remove global free function comparison operators for timespec
No code was using these, so let's just delete them. They pollute the
lookup for every single comparison operator in the project.
2023-01-07 14:51:04 +01:00
Andrew Kaster a492e2018d Userland: Silence warnings from ElapsedTimer::elapsed() type change
We changed elapsed() to return i64 instead of int as that's what
AK::Time::to_milliseconds() returns, causing a bunch of implicit lossy
conversions in callers. Clean those up with a mix of type changes and
casts.
2023-01-07 14:51:04 +01:00
Andrew Kaster 48bf0b1408 Utilities: Store per-benchmark timeout in AK::Time rather than integer
Integer seconds are cool, but the comparison is a lot easier to
understand when stored as an AK::Time, and converted from_seconds()
after parsing the timeout from the command line.
2023-01-07 14:51:04 +01:00
Andrew Kaster 4e7bdcfeea LibJS: Only start ElapsedTimer for GC metrics when printing is enabled
We don't need to be checking the current time unconditionally when we
only observe the results if we're going to dump the GC stats.

This saves two trips to clock_gettime at the cost of an extra branch.
2023-01-07 14:51:04 +01:00
Andrew Kaster 88957b42e9 3DFileViewer: Use AK::Time to accumulate frame and cycle counts
Let's accumulate frame times in AK::Time and only convert to ms for
display.
2023-01-07 14:51:04 +01:00
Andrew Kaster ddf348daeb Everywhere: Use ElapsedTimer::elapsed_time() for comparisons
Simplify a lot of uses of ElapsedTimer by converting the callers to
elapsed_time from elapsed, as the AK::Time returned is better for unit
conversions and comparisons against constants.
2023-01-07 14:51:04 +01:00
Andrew Kaster 4afa6e264c LibCore+LibWeb: Use AK::Time instead of timeval in Core::ElapsedTimer
This removes the direct dependency on sys/time.h from ElapsedTimer, and
makes the code a lot cleaner by using the helpers from AK::Time for
time math and getting the current timestamp.
2023-01-07 14:51:04 +01:00
Andrew Kaster 82a01bf32f LibJS: Use Core::ElapsedTimer in Bytecode::Pass instead of gettimeofday
We have a nice utility for doing exactly what this code is using, so
let's use it :^)
2023-01-07 14:51:04 +01:00
Andrew Kaster f7025435b2 AK: Add user defined literals for Time for ns, us, ms, and sec
We can use these to simplify Time constants throughout the codebase,
turning Time::from_milliseconds(10) into 10_ms, for example.
2023-01-07 14:51:04 +01:00
Nico Weber 8f4d2486dd LibGfx: Expand spec comment for parse_device_attributes() in ICCProfile 2023-01-07 13:41:41 +00:00
Nico Weber fdbe501d3e LibGfx+icc: Print fields that are fourccs registered with the ICC
Namely:
- preferred CMM type
- device manufacturer
- device model
- profile creator

These all have in common that they can take arbitrary values, so I added
a FourCC class to deal with them, instead of using an enum class.
I made distinct types for each of them, so that they aren't accidentally
mixed up.
2023-01-07 13:41:41 +00:00
Nico Weber 516d800b01 icc: Extract out_optional() function 2023-01-07 13:41:41 +00:00
Sam Atkins f0395a2042 LibGUI+Userland: Rename try_load_from_gml() -> load_from_gml() :^)
It's the only one, so the `try` prefix is unnecessary now.
2023-01-07 14:39:30 +01:00
Sam Atkins e4e12f3a96 LibGUI: Delete old now-unused Widget::load_from_gml() 2023-01-07 14:39:30 +01:00
Sam Atkins 54b1326165 Userland: Replace all uses of load_from_gml with try_load_from_gml
MOAR FIXMES! ;^)
2023-01-07 14:39:30 +01:00
Sam Atkins 703da34947 LibGUI: Create an alias for Widget UnregisteredChildHandler 2023-01-07 14:39:30 +01:00
Sam Atkins 33f42e3490 LibWeb: Remove redundant BFC::is_block_formatting_context() method
This is marked as virtual, but the super-method isn't, and also, the
super-method already returns the correct value, so this isn't needed.
2023-01-07 11:49:04 +00:00
Staubfinger 25dd0a4d2d AK: Make Statistics::median return a mean for an even number of values
The previous implementation of Statistics::median() was slightly
incorrect with an even number of elements since in those cases it needs
to be the arithmetic mean of the two elements that share the middle
position.
2023-01-07 12:40:47 +01:00
Liav A 0cede94c39 Kernel/Net: Introduce a new mechanism to initialize a PCI device
Instead of using a clunky if-statement paradigm, we now have all drivers
being declaring two methods for their adapter class - create and probe.
These methods are linked in each PCINetworkDriverInitializer structure,
in a new s_initializers static list of them.
Then, when we probe for a PCI device, we use each probe method and if
there's a match, then the corresponding create method is called. After
the adapter instance is created, we call the virtual initialize method
on it, because many drivers actually require a sort of post-construction
initialization sequence to ensure the network adapter can properly
function.

As a result of this change, it's much more easy to add more drivers and
the initialization code is more readable and it's easier to understand
when and where things could fail in the whole initialization sequence.
2023-01-07 12:36:57 +01:00
Liav A 90ac9d7253 Kernel/Net: Allocate regions before invoking the RTL8139 constructor
Instead of allocating those regions in the constructor, which makes it
impossible to fail in case of OOM condition, allocate them in the static
factory method so we could propagate errors in case of failure.
2023-01-07 12:36:57 +01:00
Liav A 102186b0f5 Kernel/Net: Allocate regions before invoking Intel driver constructors
Instead of allocating after the construction point ensure that all Intel
drivers are allocating necessary buffer regions and then pass them to
the constructors.
This could let us fail early in case of OOM, so we don't touch a network
adapter before we ensure we have all the appropriate mappings in place.
2023-01-07 12:36:57 +01:00
Karol Kosek 301f9de915 PixelPaint: Port to Core::Stream :^) 2023-01-07 10:53:43 +00:00
Karol Kosek 4f699d0f58 LibCore: Add forward declaration for Core::Stream::File 2023-01-07 10:53:43 +00:00
Karol Kosek 86f6586c6e LibFileSystemAccessClient: Add functions returning FSAC::File
This patch reimplements the now deprecated try_open_file(),
try_request_file() and try_request_file_read_only_approved() functions,
with the difference that the new ones return a FSAC::File object
(currently a wrapper with a Core::Stream and a filename) instead of a
Core::File.

Implemented in a similar manner to 6dd716adf2.
2023-01-07 10:53:43 +00:00
Karol Kosek 2cbe2dd3c0 LibFileSystemAccessClient+CrashReporter: Introduce FSAC::File and use it
The new result returned just a file stream, which wasn't sufficient
enough for most applications because it didn't provide a filename.

This patch will make a new File object that has both a file stream and
a filename.
2023-01-07 10:53:43 +00:00
Karol Kosek 247db3fdd0 LibFileSystemAccessClient: Rename try_* functions to try_*_deprecated
These functions return the deprecated `Core::File` class, so let's mark
it as such to avoid possible confusion between future non try_*
functions which will use Core::Stream family classes and to possibly
grab someone's attention. :^)
2023-01-07 10:53:43 +00:00