Commit Graph

32886 Commits

Author SHA1 Message Date
Sam Atkins
21a24c36a8 LibGUI: Make GlyphMapWidget work with vector fonts
This basically just meant replacing the `m_font` field with the one
inherited from Widget.
2022-01-16 11:17:03 +01:00
Sam Atkins
8175cd0a28 LibGUI+FontEditor: Move GlyphMapWidget to LibGUI
This will allow us to use this in other apps, such as the upcoming
Character Map. :^)
2022-01-16 11:17:03 +01:00
Sam Atkins
dd17df76e9 LibGUI: Make button icons settable in GML
`Widget::load_from_gml()` doesn't yet return `ErrorOr`, so we log a
warning message if loading the icon fails.
2022-01-16 11:17:03 +01:00
kleines Filmröllchen
49011e2030 Documentation: Explain the array-like types and their differences
It's not at all obvious how we need three different array-like types.
This change to the Patterns documentation attempts to explain why they
exist, how they differ (mostly in allocation behavior) and what their
use cases are. This builds on #11844 which fixates and tests the
hereby-described allocation behavior of FixedArray.
2022-01-16 11:14:26 +01:00
Matt Jacobson
47e8d58553 AK: Fix logic in String::operator>(const String&)
Null strings should not compare greater than non-null strings.

Add tests for >, <, >=, and <= comparison involving null strings.
2022-01-16 11:08:23 +01:00
Timothy Flynn
c74f75b910 LibJS: Implement Date.prototype.setUTCDate 2022-01-16 11:07:02 +01:00
Timothy Flynn
0d73da0328 LibJS: Implement Date.prototype.setUTCFullYear 2022-01-16 11:07:02 +01:00
Timothy Flynn
51bc973ecc LibJS: Implement Date.prototype.setUTCHours 2022-01-16 11:07:02 +01:00
Timothy Flynn
6998c0a796 LibJS: Implement Date.prototype.setUTCMilliseconds 2022-01-16 11:07:02 +01:00
Timothy Flynn
2f202e8ef4 LibJS: Implement Date.prototype.setUTCMinutes 2022-01-16 11:07:02 +01:00
Timothy Flynn
f2ffe3bf90 LibJS: Implement Date.prototype.setUTCMonth 2022-01-16 11:07:02 +01:00
Timothy Flynn
c71877b0a6 LibJS: Implement Date.prototype.setUTCSeconds 2022-01-16 11:07:02 +01:00
Timothy Flynn
efda1724e8 LibJS: Protect [TimeValue]FromTime from non-finite times
Includes HourFromTime, MinFromTime, SecFromTime, msFromTime.
2022-01-16 11:07:02 +01:00
Timothy Flynn
4848f587cd LibJS: Protect DayWithinYear against non-finite times 2022-01-16 11:07:02 +01:00
Timothy Flynn
9be0a0fd28 LibJS: Protect YearFromTime against non-finite times 2022-01-16 11:07:02 +01:00
Timothy Flynn
8ad043fe5e LibJS: Ensure final computation in DayFromYear is performed on a double
When we multiple by 365, ensure the result is a double (not an i32) to
prevent overflow.
2022-01-16 11:07:02 +01:00
Ali Mohammad Pur
8d30e14d28 Meta: Ensure that all port patches are documented in the linter
This adds a list of ports without descriptions to filter out the
existing ports with unexplained ports, this list should *not* be
appended to!

It also adds a (for now) disabled check that ensures all ports have
patches made with (or compatible with) git.
2022-01-16 10:32:50 +03:30
Linus Groh
fc02370dc7 Ports: Regenerate patches for python3 2022-01-16 10:32:50 +03:30
Ali Mohammad Pur
bbd4343b31 Ports: Regenerate patches for bash 2022-01-16 10:32:50 +03:30
Ali Mohammad Pur
ae94825cf6 Ports: Regenerate patches for pcre 2022-01-16 10:32:50 +03:30
Ali Mohammad Pur
dd9049f6cb Ports: Regenerate the patch readme file for mc 2022-01-16 10:32:50 +03:30
Ali Mohammad Pur
ed87bd7fe1 Ports: Regenerate stress-ng patches
And autogenerate a readme.
This fixes the one patch that wasn't made with git.
2022-01-16 10:32:50 +03:30
Ali Mohammad Pur
f81e28039b Ports: Regenerate the CMake port patches 2022-01-16 10:32:50 +03:30
Ali Mohammad Pur
a906ff5884 Ports: Add ReadMe files explaining port patches that have explanations 2022-01-16 10:32:50 +03:30
Ali Mohammad Pur
d543db0286 Ports: Add a 'dev' mode that uses git to autogenerate patches for ports 2022-01-16 10:32:50 +03:30
Ali Mohammad Pur
cdd6d68b2a Ports: Remove some config.sub patches and download a fresh one if needed
All of these patches did the same thing, which is already in upstream
config.sub.
With this change, we need only add `use_fresh_config_sub=true` to
the package.sh file.
Note that this is not done automatically in case the port has a modified
config.sub file.
2022-01-16 10:32:50 +03:30
Matt Jacobson
87630c5fd5 LibVT: Don't clip TerminalWidget's drawing to avoid scroller
The scroller might be hidden or (in theory) non-opaque.
2022-01-15 19:47:53 -08:00
Linus Groh
e8519156bc LibJS: Implement create_dynamic_function() according to the spec
The three major changes are:

- Parsing parameters, the function body, and then the full assembled
  function source all separately. This is required by the spec, as
  function parameters and body must be valid each on their own, which
  cannot be guaranteed if we only ever parse the full function.
- Returning an ECMAScriptFunctionObject instead of a FunctionExpression
  that needs to be evaluated separately. This vastly simplifies the
  {Async,AsyncGenerator,Generator,}Function constructor implementations.
  Drop '_node' from the function name accordingly.
- The prototype is now determined via GetPrototypeFromConstructor and
  passed to OrdinaryFunctionCreate.
2022-01-16 01:54:48 +01:00
Linus Groh
13fe4e8c64 LibJS: Allow passing prototype to ECMAScriptFunctionObject::create()
This should have been the default as it roughly represents the
OrdinaryFunctionCreate AO.
For now, keep two overloads and continue to guess the required prototype
from the function kind in most cases. The prototype needs to be passed
in explicitly when it may be derived from user code, such as in the
CreateDynamicFunction AO.
2022-01-16 01:54:48 +01:00
Linus Groh
f0b2179bd7 LibJS: Don't require ParenClose in Parser::parse_formal_parameters()
The parentheses are dealt with outside this function, so we shouldn't
use the (non)existence of one as the condition for consuming another
comma and then parameter. Just check for a comma instead. This becomes
relevant when parsing standalone function parameters as per the spec in
the CreateDynamicFunction AO.
2022-01-16 01:54:48 +01:00
Linus Groh
e730ada07d LibJS: Consume curly braces outside of Parser::parse_function_body()
The curly braces are not part of the FunctionBody production. This
becomes relevant when parsing a standalone function body as per the spec
in the CreateDynamicFunction AO.
2022-01-16 01:54:48 +01:00
Linus Groh
710de821e7 LibJS: Add VM::active_function_object() 2022-01-16 01:54:48 +01:00
Linus Groh
0c73fbbba5 LibJS: Rename FunctionKind::{Regular => Normal}
This is what CreateDynamicFunction calls it.
2022-01-16 01:54:48 +01:00
Tom
0d65af5e0f Kernel: Wait for NVMe controller to change enabled state
We need to wait up to CAP.TO units of 500ms when changing CC.EN to
enable or disable the controller.
2022-01-15 16:45:56 -08:00
Idan Horowitz
8a879e205b AK: Mark the error branch of the TRY() macro as unlikely
This results in a measurable (and free!) 2% improvement in test-js
run time.
2022-01-16 02:01:23 +02:00
Idan Horowitz
309d71a66b Kernel: Use kernelputstr instead of dbgln when printing backtraces
This will allow us to eventually switch dbgln in the kernel to an
allocation-free (although length-bounded) formatter.
2022-01-16 01:01:08 +02:00
Idan Horowitz
0142f33ddc Kernel: Make Processor::capture_stack_trace fallible using ErrorOr 2022-01-16 01:01:08 +02:00
Idan Horowitz
03b7352286 Kernel: Specify inline capacity of return type in capture_stack_trace
Since the inline capacity of the Vector return type was not specified
explicitly, the vector was automatically copied to a 0-length inline
capacity one, essentially eliminating the optimization.
2022-01-16 01:01:08 +02:00
Olivier De Cannière
d3dfb957a6 PixelPaint: Add delete selection behavior
The delete key can now be used to erase the pixels on the active layer
contained within the selection rectangle.

Closes #11861
2022-01-15 23:38:00 +01:00
Idan Horowitz
d3e7ec5a56 Kernel: Remove useless return value from procfs_get_thread_stack 2022-01-16 00:04:24 +02:00
creator1creeper1
4869dda79f AK: Explicitly name types in Iterator.h
In this particular case, auto is a footgun, because we are very
certain about the type that we want to return. const-correctness
could have been violated (as Vector did), because Iterator did not
enforce that the returned pointer was actually const if the Iterator
was an Iterator over a const container.
2022-01-16 00:38:21 +03:30
creator1creeper1
6484d42933 AK: Make Vector more const-correct by using RemoveReference<T>
Methods marked as const should always only return Foo const&, never
Foo&. Previously, this only worked correctly with Foo, but not with
Foo&: If someone fetched a T const&, this would have been expanded
to Foo& const& which is just Foo&. Therefore, they were able to modify
the elements of the Vector, even though it was marked as const.
This commit fixes that by introducing VisibleType as an alias for
RemoveReference<T> and using it throughout Vector.

There are also other cases where we don't require a mutable reference
to the underlying type, only a const reference (for example in a find
operation). In these cases, we now also correctly expand the type
to Foo const&.
2022-01-16 00:38:21 +03:30
creator1creeper1
19d9d5bfe1 Everywhere: Mark Vector of mutable references as mutable
The point of a reference type is to behave just like the referred-to
type. So, a Foo& should behave just like a Foo.

In these cases, we had a const Vector. If it was a const Vector of Foo,
iterating over the Vector would only permit taking const references to
the individual Foos.

However, we had a const Vector of Foo&. The behavior should not
change. We should still only be permitted to take const references to
the individual Foos. Otherwise, we would be allowed to mutate the
individual Foos, which would mutate the elements of the const Vector.
This wouldn't modify the stored pointers, but it would modify the
objects that the references refer to. Since references should be
transparent, this should not be legal.

So it should be impossible to get mutable references into a const
Vector. Since we need mutable references in these cases to call the
mutating member functions, we need to mark the Vector as mutable as
well.
2022-01-16 00:38:21 +03:30
Kenneth Myhra
294cbb7108 nc: Port to LibMain 2022-01-15 22:01:07 +01:00
Mateusz Krajewski
ae71d2b70e PixelPaint: Restrict "crop to selection" to image boundaries 2022-01-15 21:55:41 +01:00
Rummskartoffel
a610d9a3d1 Assistant: Fix crash in FileProvider background thread upon exit
If the Threading::BackgroundAction for filesystem indexing in
FileProvider hadn't finished by the time the main thread exited, it
would still try to access the FileProvider object that lived in the main
thread, thereby causing a segfault and crashing. This commit prevents
FileProvider from being destroyed while the background thread is still
running by giving the background thread a strong reference to its
FileProvider.
2022-01-15 21:45:03 +01:00
Rummskartoffel
ada1d4906e Assistant: Make Provider ref-counted 2022-01-15 21:45:03 +01:00
Rummskartoffel
5fe619de99 Documentation: Update names of RefPtr helper functions
This seems to have been missed when these functions were renamed.
2022-01-15 21:33:04 +01:00
Rummskartoffel
4aaab80649 unzip: Don't fail from mmap when trying to decompress empty files
Given an empty file, unzip would try to create a zero-size memory
mapping of that file, which would fail with EINVAL. With this commit,
attempting to unzip an empty file of course still fails, since that's
not a valid PKZIP file, but it now fails for the correct reason and with
the correct error message.
2022-01-15 22:24:19 +02:00
creator1creeper1
1a2f71581b Kernel: Remove infallible VMObject resource factory functions
These infallible resource factory functions were only there to ease the
conversion to the new factory functions. Since all child classes of
VMObject now use the fallible resource factory functions, we don't
need the infallible versions anymore.
2022-01-15 22:16:00 +02:00