Commit graph

26637 commits

Author SHA1 Message Date
Brian Gianforcaro
f3baa5d8c9 Kernel: Convert random bytes interface to use AK::Bytes 2021-09-01 18:06:14 +02:00
Brian Gianforcaro
0678ac265c Kernel: Pass InodeMetadata by reference in TmpFSInode::create
This struct is non-trivially large, it makes sense to pass it by
reference instead of by value in the factory method.

Found by Sonar Cloud.
2021-09-01 18:06:14 +02:00
Brian Gianforcaro
fee2a03ba9 AK: Pass AK::Format TypeErasedFormatParams by reference in AK::String
This silences a overeager warning in sonar cloud, warning that
slicing could occur with `VariadicFormatParams` which derives from
`TypeErasedFormatParams`.

Reference:
https://sonarcloud.io/project/issues?id=SerenityOS_serenity&issues=AXuVPBW3k92xXUF3qXTE&open=AXuVPBW3k92xXUF3qXTE

This is a continuation of f0b3aa0331.
2021-09-01 18:06:14 +02:00
Linus Groh
8105d3f3d6 LibJS: Change offset in ISODateTimeWithinLimits to actually 24h
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/1d61d6f
2021-09-01 15:11:35 +01:00
Linus Groh
59df50a950 LibJS: Throw RangeError for +/-∞ argument values in Temporal.Duration()
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/ababe1b
2021-09-01 15:11:35 +01:00
Linus Groh
f169ad61a4 LibJS: Make 'options' argument of Calendar prototype functions optional
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/9cc913e
2021-09-01 15:11:35 +01:00
Linus Groh
ed98c1afc7 LibJS: Throw RangeError in PrepareTemporalFields for +/-∞
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/499282a
2021-09-01 15:11:35 +01:00
Linus Groh
e845e7c814 LibJS: Throw TypeError if Instant.prototype.round() options is undefined
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/943018f
2021-09-01 15:11:35 +01:00
Linus Groh
38bef3e28e LibJS: Handle undefined, NaN, and Infinity in ToTemporalDurationRecord
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/d4b9bcf
2021-09-01 15:11:35 +01:00
Timothy Flynn
fd0011989a LibUnicode: Resolve the most likely territory alias when there are many 2021-09-01 14:14:47 +01:00
Timothy Flynn
1fbc5dba08 LibUnicode: Generate Unicode locale likely subtag data
CLDR contains a set of likely subtag data where, given a locale, you can
resolve what is the most likely language, script, or territory of that
locale. This data is needed for resolving territory aliases. These
aliases might contain multiple territories, and we need to resolve which
of those territories is most likely correct for a locale.

Note that the likely subtag data is quite huge (a few thousand entries).
As an optimization encouraged by the spec, we only generate the smallest
subset of this data that we actually need (about 150 entries).
2021-09-01 14:14:47 +01:00
Timothy Flynn
72f49e42b4 LibUnicode: Perform complex Unicode locale alias substitution 2021-09-01 14:14:47 +01:00
Timothy Flynn
9ae7ac4c87 LibUnicode: Generate complex Unicode locale alias matching
Most alias substitutions are "simple", meaning that alias matching is
done by examining a single locale subtag. However, there are a handful
of "complex" aliases where matching is done by examining multiple
subtags. For example, the variant subtag "lojban" causes the locale
"art-lojban" to be canonicalized to "jbo", but only when the language
subtag is "art" (i.e. this should not occur for the locale "en-lojban").

This generates a method to perform complex alias matching.
2021-09-01 14:14:47 +01:00
Timothy Flynn
da89cf9afb LibUnicode: Canonicalize calendar subtags
Calendar subtags are a bit of an odd-man-out in that we must match the
variants "ethiopic-amete-alem" in that order, without any other variant
in the locale. So a separate method is needed for this, and we now defer
sorting the variant list until after other canonicalization is done.
2021-09-01 14:14:47 +01:00
Timothy Flynn
8458f477a4 LibUnicode: Canonicalize timezone subtags 2021-09-01 14:14:47 +01:00
Timothy Flynn
335f985b31 LibUnicode: Canonicalize the subtag "imperial" to "uksystem" 2021-09-01 14:14:47 +01:00
Timothy Flynn
2d90144888 LibUnicode: Canonicalize the subtag "primary" and "tertiary" to "levelN" 2021-09-01 14:14:47 +01:00
Timothy Flynn
409f39b336 LibUnicode: Canonicalize the subtag "names" to "prprname" 2021-09-01 14:14:47 +01:00
Timothy Flynn
f907a7dc38 LibUnicode: Canonicalize the subtag "yes" to "true" 2021-09-01 14:14:47 +01:00
Timothy Flynn
556374a904 LibUnicode: Substitute Unicode locale aliases during canonicalization
Unicode TR35 defines how locale subtag aliases should be emplaced when
converting a locale to canonical form. For most subtags, it is a simple
substitution. Language subtags depend on context; for example, the
language "sh" should become "sr-Latn", but if the original locale has a
script subtag already ("sh-Cyrl"), then only the language subtag of the
alias should be taken ("sr-Latn").

To facilitate this, we now make two passes when canonicalizing a locale.
In the first pass, we convert the LocaleID structure to canonical syntax
(where the conversions all happen in-place). In the second pass, we form
the canonical string based on the canonical syntax.
2021-09-01 14:14:47 +01:00
Timothy Flynn
9b118f1f06 LibUnicode: Generate Unicode locale alias data
CLDR contains a set of aliases for languages, territories, etc. that no
longer are meant to be used (e.g. due to deprecation). For example, the
language "aam" is deprecated and should be canonicalized as "aas".
2021-09-01 14:14:47 +01:00
Timothy Flynn
d13142f015 LibJS+LibUnicode: Store parsed Unicode locale data as full strings
Originally, it was convenient to store the parsed Unicode locale data as
views into the original string being parsed. But to implement locale
aliases will require mutating the data that was parsed. To prepare for
that, store the parsed data as proper strings.
2021-09-01 14:14:47 +01:00
Timothy Flynn
caf5b6fa6f LibUnicode: Extract cldr-core dataset from CLDR database 2021-09-01 14:14:47 +01:00
Timothy Flynn
6f5fb87d3b LibJS: Handle Unicode locale extensions in LookupMatcher AO 2021-09-01 14:14:47 +01:00
davidot
def8b44c40 LibJS: Add support for public fields in classes 2021-09-01 13:39:14 +01:00
davidot
3b6a8d1d53 LibJS: Fix small issues in parser
- Fix some places where escaped keywords are (not) allowed.
- Be more strict about parameters for functions with 'use strict'.
- Fix that expressions statements allowed functions and classes.
- Fix that class expressions were not allowed.
- Added a new next_token() method for checking the look ahead.
- Fix that continue labels could jump to non iterating targets.
- Fix that generator functions cannot be declared in if statements.
2021-09-01 13:39:14 +01:00
Tobias Christiansen
8a7ce4eea3 PixelPaint: Add "Change Offset" to the GuideTool
This opens the EditGuideDialog with the values of the currently
selected Guide and allows the user to change them to the desired values.
:^)
2021-09-01 13:46:44 +02:00
Tobias Christiansen
e9595dcb79 PixelPaint: Add setter for the orientation of a Guide
Also add an additional value to the Orientation enum called "Unset".
2021-09-01 13:46:44 +02:00
Tobias Christiansen
c9e6afe6a8 PixelPaint: Allow initial values for the EditGuideDialog
This way we can feed it the values if we wanted to change an existing
Guide and handle the default as before.
That we have to pass a String here is a bit ugly.
2021-09-01 13:46:44 +02:00
Tobias Christiansen
7e2028a3cd PixelPaint: Move the conversion to pixels into the EditGuideDialog
This seems like the most appropriate location to put this.
2021-09-01 13:46:44 +02:00
Tobias Christiansen
abcb982485 PixelPaint: Rename CreateNewGuideDialog to EditGuideDialog
This doesn't change the behavior at all but sets the naming up be more
descriptive on what it does in the next patches.
2021-09-01 13:46:44 +02:00
Andrew Kaster
b3e3e4d45d Tests: Convert remaining LibC tests to LibTest
Convert them to using outln instead of printf at the same time.
2021-09-01 13:44:24 +02:00
Marcus Nilsson
1d253880e6 PixelPaint: Tweak palette height
The height of the bottom color container was cut off at the bottom.
This adjusts the heights and also the primary/secondary color
widget so that it's in line.
2021-09-01 13:43:55 +02:00
Ali Mohammad Pur
9b2f0613ef LibRegex: Correctly advance string positions in Compare::compare_string
Fixes a bug where backreferences could cause desync between the
code point index and regular index, making comparison off-by-N.
2021-09-01 13:36:53 +02:00
Ali Mohammad Pur
dd82c2e9b4 LibRegex: Correctly handle failing in the middle of explicit repeats
- Make sure that all the Repeat ops are reset (otherwise the operation
  would not be correct when going over the Repeat op a second time)
- Make sure that all matches that are allowed to fail are backed by a
  fork, otherwise the last failing fork would not have anywhere to
  return to.
Fixes #9707.
2021-09-01 13:36:53 +02:00
Andrew Kaster
fcdd7aa990 Kernel: Only unlock Mutex once in execve when PT_TRACE_ME is enabled
Fixes a regression introduced in 70518e6. Fixes #9704.
2021-09-01 13:36:26 +02:00
Peter Elliott
33d7fdca28 Everywhere: Use my cool new @serenityos.org email address 2021-09-01 11:37:25 +04:30
Andreas Kling
9206efaabe LibELF: Don't copy read-only data sections
The dynamic loader was mistakenly assuming that there are only two types
of program load headers: text (RX) and data (RW).

Now that we're linking with `-z separate-code`, we will also get some
read-onlydata (R) segments. These can be memory-mapped directly without
making a private per-process copy.

To solve this, the code now instead separates the headers into map/copy
instead of text/data. Writable segments get copied, while non-writable
segments get memory-mapped. :^)
2021-09-01 01:36:18 +02:00
Brian Gianforcaro
10f5a046c4 AK: Remove dead store from Time:operator+
This is written, but never read again, and is thus useless.
2021-09-01 01:22:14 +02:00
Brian Gianforcaro
271d6f494f RequestServer: Use smart pointers for allocating protocols 2021-09-01 01:22:14 +02:00
Marcus Nilsson
71f345bbb8 LibGUI: Adjust BreadcrumbButtons width on resize
This commit relayouts the BreadcrumbButtons on resize to a shrunken
state if they don't fit. It also caps the button width to 100px to
avoid overflowing the widget.
2021-09-01 01:21:51 +02:00
Andreas Kling
8649996201 Base: Tweak "reload" action icon some more
The top arrow wasn't as sharp as the bottom arrow. Move the top arrow
down to make space for some sharpness. :^)
2021-08-31 18:34:44 +02:00
Andreas Kling
2b1b686338 Base: Redraw the "reload" action icon with top-left light source 2021-08-31 18:21:09 +02:00
savary1
dd912bd351 PixelPaint: Add grayscale filter
Add a new Color category to the Filter menu. Add the Grayscale
filter under Filter->Color to turn the selected layer to grey colors.
Created GrayscaleFilter.h. Modify Filter.h to allow filters
without parameters.
2021-08-31 17:02:27 +02:00
Mustafa Quraish
fdc9ff2ee7 KeyboardSettings: Use LibConfig intead of Core::ConfigFile 2021-08-31 17:00:41 +02:00
Mustafa Quraish
8fdb435d24 DisplaySettings: Use LibConfig where possible
Some places here still need to open `/etc/WindowServer.ini` which
we can't do with th ConfigServer yet.
2021-08-31 17:00:41 +02:00
Mustafa Quraish
d276657f85 LibGUI/Desktop: Use LibConfig instead of Core::ConfigFile 2021-08-31 17:00:41 +02:00
Andreas Kling
5f783492cf Meta: Add Peter Elliott to the contributors list :^) 2021-08-31 16:57:26 +02:00
Peter Elliott
dee84113ab LibMarkdown: Match HTML formatting of Commonmark tests
This patch changes the HTML formatting (where to put newlines, etc...)
to better match commonmark's test cases. This has minimal effect of the
correctness of our markdown implementation, but makes it easier to test.

Changes:
 - Use <em> instead of <i>.
 - Newline before end of code block.
 - <hr /> instead of <hr>.
 - Newline before first list item.
 - Newline between lines of a paragraph.
 - Trim whitespace on lines of paragraphs.

 Tests passed: 33/652 -> 87/652
2021-08-31 16:53:51 +02:00
Peter Elliott
8d2c04821f Tests: Test LibMarkdown against commonmark test suite
TestCommonmark runs the CommonMark test suite
(https://spec.commonmark.org/0.30/spec.json) against LibMarkdown.
Currently 44/652 tests pass.
2021-08-31 16:53:51 +02:00