Commit graph

11736 commits

Author SHA1 Message Date
Timothy Flynn 26f9666191 LibJS: Do not override hour, minute, and second format field lengths
This was an oversight in e42d954743.

These fields should always follow the locale preference in the CLDR.
Overriding these fields would permit formats like "h:mm:ss" to result in
strings like "1:2:3" instead of "1:02:03".
2021-12-08 11:29:36 +00:00
Timothy Flynn 9f7c727720 LibJS+LibUnicode: Generate missing patterns with fractionalSecondDigits
TR-35's Matching Skeleton algorithm dictates how user requests including
fractional second digits should be handled when the CLDR format pattern
does not include that field. When the format pattern contains {second},
but does not contain {fractionalSecondDigits}, generate a second pattern
which appends "{decimal}{fractionalSecondDigits}" to the {second} field.
2021-12-08 11:29:36 +00:00
Timothy Flynn 6ace4000bf LibJS+LibUnicode: Supply field type in CalendarPattern's for-each method
Some callers will want different behavior depending on what field is
being provided to the callback.
2021-12-08 11:29:36 +00:00
Andreas Kling fa879168f5 LibJS: Mark Function object's private environment during GC 2021-12-08 10:29:54 +01:00
Andreas Kling f25899ca34 LibJS: Mark entire private environment chains during GC 2021-12-08 10:29:54 +01:00
Andreas Kling 4790f9a628 LibJS: Make sure private environments are marked during GC 2021-12-08 10:29:54 +01:00
Andreas Kling 212319b25e LibJS: Only allocate space for Object private elements if needed
Most JavaScript objects don't have private elements, so this reduces the
size of typical JS::Object instances by two pointers.
2021-12-08 10:29:54 +01:00
Hendiadyoin1 67a1a9db1d WebContent: Add missing TRY on client initialization 2021-12-07 00:44:57 +01:00
Andreas Kling 971b3645ef LibIPC: Add IPC::take_over_accepted_client_from_system_server<Client>()
This is an encapsulation of the common work done by all of our
single-client IPC servers on startup:

    1. Create a Core::LocalSocket, taking over an accepted fd.
    2. Create an application-specific ClientConnection object,
       wrapping the socket.

It's not a huge change in terms of lines saved, but I do feel that it
improves expressiveness. :^)
2021-12-06 19:22:16 +01:00
Andreas Kling 6d0f504822 LibIPC: Add IPC::MultiServer convenience class
This encapsulates what our multi-client IPC servers typically do on
startup:

    1. Create a Core::LocalServer
    2. Take over a listening socket file descriptor from SystemServer
    3. Set up an accept handler for incoming connections

IPC::MultiServer does all this for you! All you have to do is provide
the relevant client connection type as a template argument.
2021-12-06 19:22:16 +01:00
Andreas Kling 81047d8f9c LibCore: Make LocalServer::take_over_from_system_server() return ErrorOr
This allows us to use TRY() or MUST() when calling it.
2021-12-06 19:22:16 +01:00
Andreas Kling 229a45ab14 SQLServer: Port to LibMain :^) 2021-12-06 19:22:16 +01:00
Andreas Kling 69ea1ff743 LaunchServer: Port to LibMain :^) 2021-12-06 19:22:16 +01:00
Andreas Kling 58b99df16d LibWeb: Make StyleSheet::m_parent_style_sheet a WeakPtr
It's not safe for this to be a raw pointer, as the child can outlive the
parent.
2021-12-06 19:22:16 +01:00
Andreas Kling e8b85b13e2 LibWeb: Make CSSStyleSheet::m_owner_css_rule a WeakPtr
It's not safe for this to be a raw pointer, as the imported style sheet
can outlive the rule.
2021-12-06 19:22:16 +01:00
Andreas Kling f47c658275 LibWeb: Make CSSImportRule::m_document a WeakPtr
It's not safe for this to be a raw reference, as CSSImportRule can
outlive the document.
2021-12-06 19:22:16 +01:00
Timothy Flynn 20b6ffef4f LibJS: Add tests for calendar fields of DateTimeFormat's resolvedOptions
These are (mostly) testable now that LibUnicode parses format patterns.
2021-12-06 15:46:34 +01:00
Timothy Flynn e42d954743 LibJS: Always respect user-provided format field lengths
ECMA-402 doesn't explicitly handle a note in the TR-35 spec related to
expanding field lengths based on user-provided options. Instead, it
assumes the "implementation defined" locale data includes the possible
values.

LibUnicode does not generate every possible combination of field lengths
in its implementation of TR-35's "Missing Skeleton Fields", because the
number of generated patterns would grow out of control. Instead, it's
much simpler to handle this difference at runtime.
2021-12-06 15:46:34 +01:00
Timothy Flynn 9dc9700e3b LibJS: Fallback to [[pattern]] when [[pattern12]] is unavailable
Other implementations unconditionally initialize [[pattern12]] from
[[pattern]] regardless of whether [[pattern]] has an hour pattern of h11
or h12. LibUnicode does not do this. So when InitializeDateTimeFormat
defaults the hour cycle to the locale's preferred hour cycle, if the
best format didn't have an equivalent hour pattern, [[pattern12]] will
be empty.
2021-12-06 15:46:34 +01:00
Ben Wiederhake 152d455143 strace: Handle strings more gracefully
In particular, strace can now stomach memory errors while copying
invalid strings.

Example with a valid string:
    dbgputstr("95.976 traceme(38:38) Well, Hello Friends!") = 55
Example with an invalid string:
    dbgputstr(Error(errno=14){0x00012345, 678b}) = -14 EFAULT
(ANSI escapes removed for readability.)
2021-12-05 22:59:09 +01:00
Ben Wiederhake 49adebf0fc strace: Use new PT_PEEKBUF function
This necessarily introduces some usages (and benefits!) of the new
ErrorOr<> pattern. To keep commits atomic, I do not yet rewrite the
entire program to use ErrorOr<> correctly.
2021-12-05 22:59:09 +01:00
Ben Wiederhake 70e96fb917 LibCore: Implement new ptrace_peekbuf wrapper for PT_PEEKBUF syscall 2021-12-05 22:59:09 +01:00
Ben Wiederhake 3e223185b3 Kernel+strace: Remove unnecessary indirection for PEEK
Also, remove incomplete, superfluous check.
Incomplete, because only the byte at the provided address was checked;
this misses the last bytes of the "jerk page".
Superfluous, because it is already correctly checked by peek_user_data
(which calls copy_from_user).

The caller/tracer should not typically attempt to read non-userspace
addresses, we don't need to "hot-path" it either.
2021-12-05 22:59:09 +01:00
Sam Atkins 3ca2aee054 Applications: Cast unused smart-pointer TRY return values to void 2021-12-05 15:31:03 +01:00
Sam Atkins 7e05ccaa70 Demos: Cast unused smart-pointer return values to void 2021-12-05 15:31:03 +01:00
Sam Atkins 7196570f9b LibWeb: Cast unused smart-pointer return values to void 2021-12-05 15:31:03 +01:00
Sam Atkins 31ea222f97 LibVT: Cast unused smart-pointer return value to void 2021-12-05 15:31:03 +01:00
Sam Atkins 0e2fa09f52 Games: Cast unused smart-pointer return values to void 2021-12-05 15:31:03 +01:00
Sam Atkins d95e50643e LibGUI: Cast unused smart-pointer return values to void 2021-12-05 15:31:03 +01:00
Sam Atkins 2aa0885220 DHCP4Client: Cast unused Timer return values to void
Timers attach themselves to the provided parent, so they are safely kept
alive.
2021-12-05 15:31:03 +01:00
Sam Atkins d2024f04bd Userland: Cast unused BackgroundAction::construct() results to void
User code does not need to keep this alive, so casting to void is safe.
But maybe a bit weird.
2021-12-05 15:31:03 +01:00
Sam Atkins 92f8514a85 Services: Cast unused IPC::new_client_connection() results to void
These ones all manage their storage internally, whereas the WebContent
and ImageDecoder ones require the caller to manage their lifetime. This
distinction is not obvious to the user without looking through the code,
so an API that makes this clearer would be nice.
2021-12-05 15:31:03 +01:00
Sam Atkins c67c1b583a LibELF: Cast unused smart-pointer return value to void 2021-12-05 15:31:03 +01:00
Sam Atkins a0f6da7ceb LibDSP: Cast unused smart-pointer return value to void 2021-12-05 15:31:03 +01:00
Sam Atkins 081d9bd010 LibCpp: Cast unused smart-pointer return values to void 2021-12-05 15:31:03 +01:00
Sam Atkins b138070da9 Shell: Cast unused smart-pointer return values to void 2021-12-05 15:31:03 +01:00
Idan Horowitz 13dec3cdde LibC: Add a couple of missing errno codes
These are required to compile a port.
2021-12-05 12:53:29 +01:00
Idan Horowitz d68242ba2f LibC: Stub out the rest of the getnameinfo flags
These are required for the compilation of some ports.
2021-12-05 12:53:29 +01:00
Idan Horowitz e521ffd156 Kernel: Add support for the MSG_WAITALL sys$recvmsg flag 2021-12-05 12:53:29 +01:00
Idan Horowitz 5514d60d8d Kernel: Add support for the MSG_DONTROUTE sys$sendmsg flag 2021-12-05 12:53:29 +01:00
Idan Horowitz 1f16250de9 Kernel: Add the SIOCATMARK ioctl request macro
This is not actually implemented at the moment, as we do not support
sending or receiving out-of-band data at all currently, but it is
required for some ports to compile.
2021-12-05 12:53:29 +01:00
Elyse 8595fd585d SoundPlayer: Port to LibMain :^) 2021-12-04 15:07:18 -08:00
Kenneth Myhra d465d3a457 chmod: Port to LibMain :^)
This ports chmod to LibMain + changes input parameters on several
functions from raw C strings to StringView.
2021-12-04 15:05:46 -08:00
Kenneth Myhra 0d76d15f9d LibCore: Add syscall wrapper for chmod() 2021-12-04 15:05:46 -08:00
Jan de Visser c369626ac1 LibSQL: Gracefully react to unimplemented valid SQL
Fixes a crash that was caused by a syntax error which is difficult to
catch by the parser: usually identifiers are accepted in column lists,
but they are not in a list of column values to be inserted in an INSERT.

Fixed this by putting in a heuristic check; we probably need a better
way to do this.

Included tests for this case.

Also introduced a new SQL Error code, `NotYetImplemented`, and return
that instead of crashing when encountering unimplemented SQL.
2021-12-04 20:49:22 +03:30
Jan de Visser 001949d77a LibSQL: Improve error handling
The handling of filesystem level errors was basically non-existing or
consisting of `VERIFY_NOT_REACHED` assertions. Addressed this by
* Adding `open` methods to `Heap` and `Database` which return errors.
* Changing the interface of methods of these classes and clients
downstream to propagate these errors.

The constructors of `Heap` and `Database` don't open the underlying
filesystem file anymore.

The SQL statement handlers return an `SQLErrorCode::InternalError`
error code if an error comes back from the lower levels. Note that some
of these errors are things like duplicate index entry errors that should
be caught before the SQL layer attempts to actually update the database.

Added tests to catch attempts to open weird or non-existent files as
databases.

Finally, in between me writing this patch and submitting the PR the
AK::Result<Foo, Bar> template got deprecated in favour of ErrorOr<Foo>.
This resulted in more busywork.
2021-12-04 20:49:22 +03:30
Andreas Kling 108de5dea0 LibWeb: Stop sending "load" event twice to iframes
The "completely finish loading" algorithm (from the HTML spec) is
responsible for sending a "load" event to nested browsing context
containers (iframes).

This patch removes the old mechanism for sending "load" events, which we
had mistakenly kept around, causing two events to be sent instead of
one. :^)
2021-12-04 14:47:24 +01:00
Andreas Kling 58309444d7 LibWeb: Fix DOMImplementation changing content type of wrong document
DOMImplementation.createDocument() should set the content type of the
newly created document, not replace the content type of the
DOMImplementation's own host document.
2021-12-04 14:38:16 +01:00
Andreas Kling d7a116bb0e groups: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Andreas Kling 96e4077c38 SystemMonitor: Port to LibMain :^)
There's a lot more work to do on this application to take full advantage
of TRY() etc. This patch just scratches the surface.
2021-12-04 14:24:04 +01:00
Andreas Kling 01228bf4ef CrashReporter: Port to LibMain and use TRY() while building the UI :^) 2021-12-04 14:24:04 +01:00
Andreas Kling 2511da1f57 gron: Use StringView literals more (instead of raw C strings) 2021-12-04 14:24:04 +01:00
Andreas Kling 855c425719 gron: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Andreas Kling b0659b50dc jp: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Andreas Kling c3733bea92 Applets/ClipboardHistory: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Andreas Kling de182d4b46 stat: Modernize slightly :^)
- Port to LibMain
- Use AK::Format instead of printf()
2021-12-04 14:24:04 +01:00
Andreas Kling 0de575ec11 ls: Port to LibMain :^) 2021-12-04 14:24:04 +01:00
Andreas Kling 1640445cb2 LibCore: Add lstat() syscall wrapper 2021-12-04 14:24:04 +01:00
Daniel Bertalan 21acebd372 HackStudio: Fix cursor not jumping to column 1 in the embedded terminal
Normally, it's the TTY layer's job to translate '\n' into the separate
'\r' and '\n' control characters needed by the terminal to move the
cursor to the first column of the next line.
(see 5d80debc1f).

In HackStudio, we directly inject data into the TerminalWidget to
display command status. This means that this automatic translation
doesn't happen, so we need to explicitly give it the '\r' too.
2021-12-04 14:44:00 +03:30
Tim Schumacher 0ca63cfd6e find: Implement support for multiple directories 2021-12-03 15:39:00 +01:00
Tim Schumacher 5a21c3b389 find: Use a Vector for parsing instead of moving optind 2021-12-03 15:39:00 +01:00
Tim Schumacher 4ca35ac1b8 find: Port to LibMain 2021-12-03 15:39:00 +01:00
Itamar c3c2fe153b LibCpp: Add "ignore invalid statements" option to Preprocessor
When we run the Preprocessor from the CppComprehensionEngine of
the language server, we don't want the preprocessor to crash if it
encounters an invalid preprocessor statement (for example, an #endif
statement without an accompanying previous #if statement).

To achieve this, this commit adds an "ignore_invalid_statements" flag
to the preprocessor which is set by the CppComprehensionEngine.

Fixes #11064.
2021-12-03 15:38:21 +01:00
Itamar 408f05bbb9 HackStudio: Decrease the maximal crash frequency of the server to 10 sec
The maximal crash frequency of the language server was previously 3
seconds, but in practice it was too high.
When working with larger projects the language server can get into a
"crash and respawn" loop that takes more than 3 seconds.

10 seconds seems like a reasonable threshold beyond which we no longer
attempt to respawn the server.
2021-12-03 15:38:21 +01:00
Itamar 28ff7d49ad HackStudio: Only send the content of open files to language server
When respawning the language server, we only need to send the content
of opened files to the server.

The on-disk content of files that are not currently open is up to
date, so the server can read them on its own.
2021-12-03 15:38:21 +01:00
Itamar 3e9a96f1d8 HackStudio: Add HackStudio::for_each_open_file 2021-12-03 15:38:21 +01:00
Martin Blicha 8fb52c6962 LibGUI: Make FilteringProxyModel reference-count its parent model
Before this change, the destructor of FilteringProxyModel
would crash if the parent model had been destroyed earlier.

This unifies the behaviour of FilteringProxyModel with
SortingProxyModel in this respect.
2021-12-02 22:43:54 +01:00
Idan Horowitz f415218afe Kernel+LibC: Implement sigaltstack()
This is required for compiling wine for serenity
2021-12-01 21:44:11 +02:00
Timothy Flynn bf79c73158 LibUnicode: Do not generate data for "generic" calendars
This is not a calendar supported by ECMA-402, so let's not waste space
with its data.

Further, don't generate "gregorian" as a valid Unicode locale extension
keyword. It's an invalid type identifier, thus cannot be used in locales
such as "en-u-ca-gregorian".
2021-12-01 16:36:26 +00:00
Timothy Flynn f02ecc1da2 LibUnicode: Fix copy-paste error in calendar_pattern_style_to_string
The string returned must be lowercase.
2021-12-01 16:36:26 +00:00
Timothy Flynn d2588d852b LibJS: Change all [[RelevantExtensionKeys]] to return constexpr arrays
There's no need to allocate a vector for this internal slot. Similar to
commit: bb11437792
2021-12-01 16:36:26 +00:00
Jelle Raaijmakers e27b077c2a LibGL: Add GL::present_context()
This provides a convenience method that performs the virtual resolution
for `::present` on the provided `GLContext`.
2021-12-01 12:35:08 +01:00
Jelle Raaijmakers bed0f3466a LibGL: Remove TextureUnit::unbind_texture() 2021-12-01 10:21:13 +01:00
Jelle Raaijmakers a4603fbc06 3DFileViewer: Add checkbox to disable texture 2021-12-01 10:21:13 +01:00
Jelle Raaijmakers 5788a139d8 LibGL: Implement texture unit texturing states 2021-12-01 10:21:13 +01:00
Hendiadyoin1 713a9ca5f1 LookupServer: Remove unused this capture in a lambda function
this was causing CI to fail
2021-11-30 16:15:52 -08:00
Andreas Kling 2e010db0a5 LibCpp: Update list of well-known C++ types to match current AK 2021-11-30 23:34:40 +01:00
Andreas Kling 9cd89f0085 LibCpp: Use StringView for the known keywords array 2021-11-30 23:34:40 +01:00
Andreas Kling fc0a040e5d CrashReporter: Remove unnecessary button height overrides from GML 2021-11-30 23:34:40 +01:00
Andreas Kling 85eb0eaad0 CrashReporter+HackStudio: Let's call it "Debug in Hack Studio"
"Inspect in Hack Studio" was a bit vague.
2021-11-30 23:34:40 +01:00
Andreas Kling d3bd9f1f0c HackStudio: Scope the "delete file from project" action to tree view
Otherwise it triggers when trying to delete characters in the editor.
2021-11-30 23:34:40 +01:00
Andreas Kling 354c4690d2 LibCore: Use LibCore syscall wrappers in get_password() 2021-11-30 23:34:40 +01:00
Andreas Kling 612eafea2c LibCore: Add syscall wrappers for tcgetattr() and tcsetattr() 2021-11-30 23:34:40 +01:00
Andreas Kling 2b0c2360bb KeyboardPreferenceLoader: Use Core::System::ioctl() 2021-11-30 23:34:40 +01:00
Andreas Kling fd2ea6923c top: Use Core::System::ioctl() 2021-11-30 23:34:40 +01:00
Andreas Kling 90aa1abfed LibCore: Add ioctl() syscall wrapper 2021-11-30 23:34:40 +01:00
Andreas Kling 9815ad556a fortune: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling 8ba9a54310 lspci: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling 74a6fb64b2 DHCPClient: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling 6e7ff8cf1c netstat: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling 2bb27184b4 KeyboardPreferenceLoader: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling fbeebce4e3 whoami: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling a93205199b AudioServer: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling cac3f3c81f top: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling e399835466 ChessEngine: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling 6e2f7a15fb InspectorServer: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
Andreas Kling fe00393941 LibCore: Change Core::LocalServer::on_ready_to_accept => on_accept
Everyone used this hook in the same way: immediately accept() on the
socket and then do something with the newly accepted fd.

This patch simplifies the hook by having LocalServer do the accepting
automatically.
2021-11-30 23:34:40 +01:00
Andreas Kling 6cb3092b42 WebContent: Remove unnecessary client map
WebContent processes only serve a single client, so we don't need to
keep a map of them.
2021-11-30 23:34:40 +01:00
Andreas Kling 314a687eeb ImageDecoder: Remove unnecessary client map
ImageDecoder processes only serve a single client, so we don't need to
keep a map of them.
2021-11-30 23:34:40 +01:00
Andreas Kling 8c8bf9433f LibIPC: Mark ClientConnection::die() as an override 2021-11-30 23:34:40 +01:00
Erik Biederstadt e052d647b7 Spreadsheet: Allow sheet renaming after double clicking on the tabwidget 2021-12-01 00:44:26 +03:30
Erik Biederstadt 0cfe446d3f LibGUI: Allow double clicking on tabwidgets 2021-12-01 00:44:26 +03:30
Linus Groh 5ca242ce30 LibJS/Tests: Fix typo in a test description 2021-11-30 20:42:04 +00:00
davidot 5010d4c20c LibJS: Don't match async \n function as an async function declaration 2021-11-30 17:05:32 +00:00
davidot c2ebaa9d87 LibJS: Replace the verify in private identifier with a syntax error
Since sometimes expressions are parsed without checking we can hit this
expression without it being followed by an 'in'.
2021-11-30 17:05:32 +00:00
davidot b7c7d54167 LibJS: Split parsing program to script and module separately
This allows us to only perform checks like export bindings existing only
for modules. Also this makes it easier to set strict and other state
variables with TemporaryChanges.
2021-11-30 17:05:32 +00:00
davidot 22174d3b7b LibJS: Rename in_async_function_context to await_expression_is_valid
Since await can be valid in module code which is not an async function
the old name is not really representative for the usage.
2021-11-30 17:05:32 +00:00
davidot 045a42cf35 LibJS: Parse dynamic import calls 'import()' and 'import.meta'
For now both just throw when executing but this can be implemented when
modules are implemented :^).
2021-11-30 17:05:32 +00:00
davidot 73eb29dabe LibJS: Lookahead for a period when parsing new.target
This allows us to skip saving and loading the state whenever we parse
'new'.
2021-11-30 17:05:32 +00:00
davidot 4d7e79fb72 LibJS: Stop parsing an expression on comma after a yield 2021-11-30 17:05:32 +00:00
davidot 156dfe3d62 LibJS: Disallow member expression in binding pattern as parameters 2021-11-30 17:05:32 +00:00
davidot 51e23cd043 LibJS: Disallow shorthand properties with reserved names 2021-11-30 17:05:32 +00:00
davidot e491fc0e81 LibJS: Allow defining class fields with "keyword" names 2021-11-30 17:05:32 +00:00
davidot cbbfcd35e7 LibJS: Disallow await keywords in static init blocks
In static init blocks 'await' cannot be used. Note that this does not
cover all the cases since the parser currently cannot distinguish
between expressions within parenthesis and direct expressions.
2021-11-30 17:05:32 +00:00
davidot 7624c3de0e LibJS: Disallow '\8' and '\9' in strict mode due to being octal escapes 2021-11-30 17:05:32 +00:00
davidot c57721cf83 LibJS: Allow escaped 'async' as identifier
Since 'async' is only special if it occurs before a function it can be
used as escaped identifier in all cases.
2021-11-30 17:05:32 +00:00
davidot e751dcea43 LibJS: Treat private identifier as divisible token
And also make sure private identifiers are correctly checked when
synthesizing a binding pattern.
2021-11-30 17:05:32 +00:00
davidot afde1821b5 LibJS: Disallow numerical separators in octal numbers and after '.' 2021-11-30 17:05:32 +00:00
davidot 32016d3924 LibJS: Allow object properties called 'async' 2021-11-30 17:05:32 +00:00
davidot 450dedabd1 LibJS: Add messages to the toEval and toEvalTo tests
This makes it a lot easier to understand what is going wrong when an
eval test fails. As an example instead of just getting:
`ExpectationError`
You would now get:
`ExpectationError: Expected _1_2E+0_1_ to eval to _12_ but got _120_`.
2021-11-30 17:05:32 +00:00
Timothy Flynn 7e6ad172a4 LibUnicode: Support code point names that apply to ranges of code points
For example, consider the following adjacent entries in UnicodeData.txt:

    3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
    4DBF;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;

Our current implementation would assign the display name "CJK Ideograph
Extension A" to code points U+3400 & U+4DBF, but not to the code points
in between. Not only should those code points be assigned a name, but
the Unicode spec also has formatting rules on what the names should be
(the names for these ranged code points are not as they appear in
UnicodeData.txt).

The spec also defines names for code point ranges that actually are
listed individually in UnicodeData.txt. For example:

    2F800;CJK COMPATIBILITY IDEOGRAPH-2F800;Lo;0;L;4E3D;;;;N;;;;;
    2F801;CJK COMPATIBILITY IDEOGRAPH-2F801;Lo;0;L;4E38;;;;N;;;;;
    2F802;CJK COMPATIBILITY IDEOGRAPH-2F802;Lo;0;L;4E41;;;;N;;;;;

Code points are only coalesced into a range if all fields after the name
are equivalent. Our parser will insert the range and its name formatting
pattern when it comes across the first code point in that range, then
ignore other code points in that range. This reduces the number of names
we generated by nearly 2,000.
2021-11-30 11:24:02 +01:00
scwfri dbd40e4c2a LibGUI: Implement vim motions for LeftBrace and RightBrace
In VimEditingEngine, implemented vim motions for Key_LeftBrace and
Key_RightBrace
2021-11-30 10:55:19 +01:00
Jelle Raaijmakers e187207610 Kernel: Register Virtio console ports with device management
Previously, Virtio console ports would not show up in `/sys/dev/char/`.
Also adds support to `SystemServer` to create more than one console
port device in `/dev/` in the multiport case.
2021-11-30 10:53:41 +01:00
Jelle Raaijmakers 2565f458d1 ClipboardHistory: Add debug dump action
This allows for easy dumping of clipboard data to the debug console.
2021-11-30 10:52:18 +01:00
thankyouverycool 298a6b9937 LibGUI+FontEditor: Allow ComboBox on_change callback to be toggled
When calling set_selected_index() on ComboBox, allow its on_change
callback to be disabled. Fixes FontEditor window state erroneously
switching to modified when initializing between different slopes
and weights.
2021-11-30 10:51:51 +01:00
thankyouverycool ca062d83db FontEditor: Convert to east const 2021-11-30 10:51:51 +01:00
thankyouverycool de77e28360 FontEditor: Correct member type and initialization in UndoGlyph
Makes code_point type u32, consistent with the rest of the system,
and properly initializes it.
2021-11-30 10:51:51 +01:00
thankyouverycool e3e3c03dca FontEditor: Remove unused Vector<String> 2021-11-30 10:51:51 +01:00
thankyouverycool ca77aea099 FontEditor: Correct NewFontDialog layout issues
Fixes incorrect scale initialization and inconsistent margins, sets
minimum values for glyph width and height to 1, and labels page 1
more precisely as "Typeface" properties.
2021-11-30 10:51:51 +01:00
thankyouverycool 9b184fc1cb FontEditor: Clean up GlyphMapWidget header
Fixes minor organizational inconsistency and zeroes initializations
for rows and columns as the previous values haven't been meaningful
since the map was converted to a scrollable widget. No functional
changes.
2021-11-30 10:51:51 +01:00
thankyouverycool 7d73d2dfc8 FontEditor: Remove superfluous 'this' pointers 2021-11-30 10:51:51 +01:00
thankyouverycool e29abc5395 LibGfx+FontEditor: Consolidate BitmapFont width and height limits
And make them more self-documenting. Previously these constraints
were duplicated across multiple files.
2021-11-30 10:51:51 +01:00
thankyouverycool 541f1de3a8 FontEditor: Add scaled offset members to GlyphEditor
Previously these were undescriptive globals making them a bit cryptic.
2021-11-30 10:51:51 +01:00
thankyouverycool aa09e40eb2 FontEditor: Update status bar on initialization
Fixes incorrect glyph status immediately after loading a new font.
2021-11-30 10:51:51 +01:00
thankyouverycool ae922c67fd FontEditor: Remove code duplication when resizing GlyphEditor
The left column now also enforces a minimum width to prevent especially
small fonts from hiding the glyph toolbars and width widgets.
2021-11-30 10:51:51 +01:00
thankyouverycool c1744822a1 FontEditor: Account for glyph width when pasting
Fixes glyphs not expanding up to their maximum width if necessary
when pasting larger glyphs into smaller ones.
2021-11-30 10:51:51 +01:00
thankyouverycool 281805696b FontEditor: Don't allow cutting and copying absent glyphs
And update status bar on cut. Fixes placing these effectless actions
on the undo stack.
2021-11-30 10:51:51 +01:00
thankyouverycool d2b211f14a FontEditor: Don't null check newly created NonnullRefPtr fonts 2021-11-30 10:51:51 +01:00
thankyouverycool 74938e6f42 FontEditor: Factor out redundant code for a request to close 2021-11-30 10:51:51 +01:00
thankyouverycool 1e052f5a91 FontEditor: Convert mode and transform buttons into toolbar actions
This will let us more easily organize and assign shortcuts to new
modes and transformations as they are built, and it generally looks
more polished as a uniform interface. Also adds a counterclockwise
option to the rotate action, moves Copy as Character to the edit
menu as it doesn't directly impact GlyphEditor, and makes the paint
and move modes exclusive checkables to make the editor's state more
visually obvious.
2021-11-30 10:51:51 +01:00
thankyouverycool 922e80e72b FontEditor: Simplify start-up
Previusly a cloned or newly loaded font was moved twice from main to
the constructor and then from constructor to an init routine where it
was finally used. The unmasked font is now moved only once, directly
to initialization, and redundant error checking is discarded.
2021-11-30 10:51:51 +01:00
thankyouverycool 56a8a2b493 FontEditor: Use LibUnicode to convert character case
Fixes characters beyond the Basic Latin code block not showing
their upper-case form in the preview window.
2021-11-30 10:51:51 +01:00
thankyouverycool edf86af4f4 LibGfx+FontEditor: Add helper to determine raw glyph presence
GlyphBitmaps are considered present if they have a width greater
than zero. This adds a counterpart method for raw (unmasked) glyphs
and makes intent more explicit throughout FontEditor.
2021-11-30 10:51:51 +01:00
Arne Elster cdaa179eeb LibCore: Fix relative seeking in IODevice
The recently introduced read buffer in IODevice broke relative seeking.
The amount of data in the buffer wouldn't get taken into account.
2021-11-30 10:51:10 +01:00
Timothy Flynn 1039159a6c LibJS: Change LargerOfTwoTemporalUnits AO to return a StringView 2021-11-30 00:01:07 +00:00
Luke Wilde 2cea4ad508 LibJS: Implement Temporal.Duration.prototype.subtract 2021-11-29 22:56:35 +00:00
Luke Wilde ac8c3919cb LibJS: Implement Temporal.Duration.prototype.add 2021-11-29 22:56:35 +00:00
Luke Wilde acf8729a81 LibJS: Implement Temporal.Duration.prototype.round 2021-11-29 22:56:35 +00:00
Timothy Flynn 4a08fd2be2 LibJS: Implement Intl.DateTimeFormat.prototype.resolvedOptions 2021-11-29 22:48:46 +00:00
Timothy Flynn d0e1997e07 LibJS: Implement Intl.DateTimeFormat.supportedLocalesOf 2021-11-29 22:48:46 +00:00
Timothy Flynn 6ad00088c0 js: Implement pretty-printing of Intl.DateTimeFormat 2021-11-29 22:48:46 +00:00
Timothy Flynn 16151aa7d5 LibJS+LibUnicode: Implement the Intl.DateTimeFormat constructor 2021-11-29 22:48:46 +00:00
Timothy Flynn 75b2a09a2f LibJS: Implement a nearly empty Intl.DateTimeFormat object
This adds plumbing for the Intl.DateTimeFormat object, constructor, and
prototype.

Note that unlike other Intl objects, the Intl.DateTimeFormat object has
a LibUnicode structure as a base. This is to prevent wild amounts of
code duplication between LibUnicode, Intl.DateTimeFormat, and other
not-yet-defined Intl structures, because there's 12 fields shared
between them.
2021-11-29 22:48:46 +00:00
Timothy Flynn 6dbdfb6ba1 LibUnicode: Add special handling of hour cycle (hc) Unicode keywords
For other keywords, allowed values per locale are generated at compile
time. But since the CLDR doesn't present hour cycles on a per-locale
basis, and hour cycles lookups depend on runtime data, we must handle
hour cycle keyword lookups differently than other keywords.
2021-11-29 22:48:46 +00:00
Timothy Flynn 48ce72e472 LibUnicode: Parse and generate regional hour cycles
Unlike most data in the CLDR, hour cycles are not stored on a per-locale
basis. Instead, they are keyed by a string that is usually a region, but
sometimes is a locale. Therefore, given a locale, to determine the hour
cycles for that locale, we:

    1. Check if the locale itself is assigned hour cycles.
    2. If the locale has a region, check if that region is assigned hour
       cycles.
    3. Otherwise, maximize that locale, and if the maximized locale has
       a region, check if that region is assigned hour cycles.
    4. If the above all fail, fallback to the "001" region.

Further, each locale's default hour cycle is the first assigned hour
cycle.
2021-11-29 22:48:46 +00:00
Timothy Flynn 7872934861 LibUnicode: Parse and generate available candidate format patterns
These formats are used by ECMA-402 when neither a date nor time style is
specified. In that case, these patterns are searched for a best match.
2021-11-29 22:48:46 +00:00
Timothy Flynn f471ecdbe9 LibUnicode: Parse and generate date, time, and date-time format patterns 2021-11-29 22:48:46 +00:00
Timothy Flynn 914675e826 LibJS+LibUnicode: Separate number formatting methods from Locale.h
Currently, we generate separate data files for locale and number format
related tables/methods, but provide public accessors for all of the data
in one Locale.h file. Rather than continuing this trend for date-time,
relative time, etc. formatting, it's a bit easier to reason about if the
public accessors are also in separate files.
2021-11-29 22:48:46 +00:00
Timothy Flynn bb11437792 LibJS: Change Intl's GetOption AO to accept a Span rather than a Vector
Allocating a Vector for each of these invocations is a bit silly when
the values are basically all compile-time arrays. This AO is used even
more heavily by Intl.DateTimeFormat, so change it to accept a Span to
reduce its cost.

This also adds an overload to accept a fixed-size C-array so callers do
not have to be prefixed with AK::Array, i.e. this:

    get_option(..., AK::Array { "a"sv, "b"sv }, ...);

Reduces to:

    get_option(..., { "a"sv, "b"sv }, ...);

(Which is how all call sites were already written to construct a Vector
in place).
2021-11-29 22:48:46 +00:00
Brian Gianforcaro 55aecf5381 LibDSP: Fix potential slicing issue in volume_from_envelope
Use pointer or reference to avoid slicing from "PitchedEnvelope"
to "Envelope". This was found by SonarCloud.
2021-11-29 14:19:31 -08:00
Brian Gianforcaro a225b26d88 LibCpp: Fix copy paste typo in Parser::match_secondary_expression
This was caught by SonarCloud.
2021-11-29 14:19:31 -08:00
Jelle Raaijmakers 61e4c09514 3DFileViewer: Set correct aspect ratio in view frustum 2021-11-29 22:11:41 +00:00
Hendiadyoin1 76e6ed0d75 LibGL: Mark SoftwareGLContext::gl_scissor as override
I do not know how this did not trigger CI up until now...
2021-11-29 23:17:05 +03:30
Hendiadyoin1 51cf35988b LibGfx: Link against LibIPC
Gfx::Color implements an IPC::[en|de]code function, but we did not
actually link against LibIPC to resolve the needed Symbols for that and
were relying on LibGui or others to link against it for us.

Having this linkage is unfortunate, but static inlining the functions in
question is sadly not possible, due needed includes leading the IPC
pipeline to initialize multiple times then, which leads to a compilation
error.
2021-11-29 23:17:05 +03:30
Hendiadyoin1 9e7c16d0a4 LibGfx: Load default font lazily
This is required when trying to use a Painter from lagom, due to
/res/font not being present
2021-11-29 23:17:05 +03:30
davidot e69276e704 LibJS: Implement parsing and executing for-await-of loops 2021-11-29 15:20:07 +00:00
davidot b3699029e2 LibJS: Implement the async versions of iterator operations
Since AsyncIteratorClose and IteratorClose differ only in that the async
version awaits the inner value we just implement them with an enum flag
to switch just that behavior.
2021-11-29 15:20:07 +00:00
davidot 064c8be627 LibJS: Add AsyncFromSyncIteratorPrototype and Async-From-Sync instances
Until we have actual iterator records we have to store the sync iterator
as the raw object.
2021-11-29 15:20:07 +00:00
davidot 0535c1abbd LibJS: Move the TRY_OR_REJECT macro to PromiseReaction
Also fixes that we ignored the result of the Call which we shouldn't
according to the spec.
2021-11-29 15:20:07 +00:00
davidot 7fd38eac98 LibJS: Add AsyncIteratorPrototype 2021-11-29 15:20:07 +00:00
Andreas Kling da42c1552c ImageDecoder: Fix assertion after failed decode
We were calling value() on an ErrorOr containing an error when trying
to extract the frame duration after a failed decode.

This fixes ImageDecoder crashing on various websites.
2021-11-29 13:21:27 +01:00
Jelle Raaijmakers dcc7d7d566 3DFileViewer: Improve FPS display
We only showed frame times down to the millisecond. Our FPS counter was
based off of that, allowing for a limited set of possible FPS values.

Convert these calculations to floating point so we get more useful FPS
and frame time values.
2021-11-29 11:44:01 +00:00
davidot f151a0d720 LibIPC: Mark m_sockfd as maybe_unused on non Serenity platforms 2021-11-29 01:46:28 -08:00
Andreas Kling ddce053f6c LibIPC: Replace u32/u64 value coders with u/ul/ull value coders
We can and should do more cleanups of this kind, but this is a quick fix
to unbreak the 32-bit HackStudio build.
2021-11-29 02:45:27 +01:00
Andreas Kling 16746efcf8 SpiceAgent: Port to LibMain :^) 2021-11-28 23:14:19 +01:00
Andreas Kling 83056efc1a LibCore: Add syscall wrapper for dup() 2021-11-28 23:14:19 +01:00
Andreas Kling cb9cac4e40 LibIPC+IPCCompiler+AK: Make IPC value decoders return ErrorOr<void>
This allows us to use TRY() in decoding helpers, leading to a nice
reduction in line count.
2021-11-28 23:14:19 +01:00
Andreas Kling 8d76eb773f LibIPC: Make IPC::Connection::post_message() return ErrorOr 2021-11-28 23:14:18 +01:00
Andreas Kling 982ac34437 LibCore: Add syscall wrappers for sendfd() and recvfd() 2021-11-28 23:14:18 +01:00
Andreas Kling 86a3ef2709 LibIPC: Give MessageBuffer::fds some inline capacity (1)
This dodges a heap allocation when sending 0 or 1 fd across the IPC
boundary (which covers every message.)
2021-11-28 23:14:18 +01:00
kleines Filmröllchen 8608cd11e4 LibAudio: Optimize sample moves in FlacLoader
As long as possible, entire decoded frame sample vectors are moved into
the output vector, leading to up to 20% speedups by avoiding memmoves on
take_first.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 9c40311622 Utilites: Add abench utility
abench (audio benchmark) is an audio benchmarking utility that allows
testing decoder performance.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 96d02a3e75 LibAudio: New error propagation API in Loader and Buffer
Previously, a libc-like out-of-line error information was used in the
loader and its plugins. Now, all functions that may fail to do their job
return some sort of Result. The universally-used error type ist the new
LoaderError, which can contain information about the general error
category (such as file format, I/O, unimplemented features), an error
description, and location information, such as file index or sample
index.

Additionally, the loader plugins try to do as little work as possible in
their constructors. Right after being constructed, a user should call
initialize() and check the errors returned from there. (This is done
transparently by Loader itself.) If a constructor caused an error, the
call to initialize should check and return it immediately.

This opportunity was used to rework a lot of the internal error
propagation in both loader classes, especially FlacLoader. Therefore, a
couple of other refactorings may have sneaked in as well.

The adoption of LibAudio users is minimal. Piano's adoption is not
important, as the code will receive major refactoring in the near future
anyways. SoundPlayer's adoption is also less important, as changes to
refactor it are in the works as well. aplay's adoption is the best and
may serve as an example for other users. It also includes new buffering
behavior.

Buffer also gets some attention, making it OOM-safe and thereby also
propagating its errors to the user.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen ec8bd8116d LibAudio: Buffer API improvements
This consists of two changes: First, a utility function create_empty
allows the user to quickly create an empty buffer. Second, most creation
functions now return a NonnullRefPtr, as their failure causes a VERIFY
crash anyways.
2021-11-28 13:33:51 -08:00
kleines Filmröllchen 14d330faba LibAudio: Avoid frequent read() calls in FLAC residual decode
Decoding the residual in FLAC subframes is by far the most I/O-heavy
operation in FLAC decoding, as the residual data makes up the majority
of subframe data in LPC subframes. As the residual consists of many
Rice-encoded numbers with different bit sizes for differently large
numbers, the residual decoder frequently reads only one or two bytes at
a time. As we use a normal FileInputStream, that directly translates to
many calls to the read() syscall. We can see that the I/O overhead while
FLAC decoding is quite large, and much time is spent in the read()
syscall's kernel code.

This is optimized by using a Buffered<FileInputStream> instead, leading
to 4K blocks being read at once and a large reduction in I/O overhead.

Benchmarking with the new abench utility gives a 15-20% speedup on
identical files, usually pushing FLAC decoding to 10-15x realtime speed
on common sample rates.
2021-11-28 13:33:51 -08:00
Marcus Nilsson 5217202737 ThemeEditor: Use LibMain
Use the new serenity_main construct and TRY in ThemeEditor.
2021-11-28 10:10:35 -08:00
Marcus Nilsson c91eebfbaa Magnifier: Use LibMain
Use the new serenity_main construct and TRY in Magnifier.
2021-11-28 10:10:35 -08:00
Stephan Unverwerth cbf93ee687 LibGL: Initialize all GL context matrices with the identity matrix 2021-11-28 10:07:34 -08:00
Daniel Bertalan 87d548c520 LibC: Make SIZE_MAX be understood by the preprocessor
POSIX mandates that the macros contained in `stdint.h` be suitable for
use by the C preprocessor.

If we write `((size_t)-1)`, the C preprocessor will just skip the cast
and treat the value as `-1`. This means that we end up taking the wrong
branch in an `#if` directive like `#if SIZE_MAX > UINT32_MAX`.

This fixes building the LLVM port on i686.
2021-11-28 09:38:57 -08:00
Daniel Bertalan 23adb7449f LibC: Fix stdint.h macros on x86_64
x86_64 is an LP64 platform, so its `uint64_t` type is defined to be
`unsigned long`, not `unsigned long long` like on i686. This means that
the `UL` literal suffix should be used instead of `ULL`.

Furthermore, `uintptr_t` is 64 bits wide on x86_64, so defining
`UINTPTR_MAX` to be `UINT32_MAX` is also not correct.
2021-11-28 09:38:57 -08:00
Daniel Bertalan 4c0d868bb6 LibC: Add definition for ENOTRECOVERABLE
This is used by the LLVM port.
2021-11-28 09:38:57 -08:00
Jelle Raaijmakers bb58f6ccab LibGL: Implement glScissor() 2021-11-28 09:20:58 -08:00
Ali Mohammad Pur ccf713bf23 LibJS: Spin the event loop while waiting for async completion in await 2021-11-28 13:28:01 +00:00
Linus Groh f7ba81ac52 LibJS: Implement parsing of TemporalDurationString 2021-11-28 10:32:28 +00:00
Andreas Kling 60c132d7d3 LibGUI: Move GUI::SettingsWindow setup out of the constructor
In order to propagate errors that occur during UI setup, we have to move
all that logic out of widget/window subclass constructors. This is a
first attempt at doing that, for GUI::SettingsWindow.
2021-11-28 08:54:22 +01:00
Andreas Kling 56c4f0aff5 LibGUI: Add fallible variants of the GUI::Layout add/insert APIs 2021-11-28 08:54:22 +01:00
Andreas Kling acd4cc97fc KeyboardSettings: Remove some unnecessary pledge promises
This program doesn't need to create or write files directly.
2021-11-28 08:54:22 +01:00
Andreas Kling 45844f9338 LibGUI: Make GUI::SettingsWindow::add_tab() return ErrorOr
This allows us to use TRY() when creating settings UI.
2021-11-28 08:10:53 +01:00
Andreas Kling 7c19e86a50 TerminalSettings: Remove unnecessary pledges and unveils 2021-11-28 08:10:53 +01:00
Andreas Kling 6b862d5063 TerminalSettings: Port to LibMain :^) 2021-11-28 08:10:53 +01:00