Commit Graph

4860 Commits

Author SHA1 Message Date
Karol Kosek
1c65ee6edf LibAudio: Implement decoding verbatim blocks in FLAC
They're mostly used in literal random data, so it isn't like
there is a high demand for it, but it's cool to have more complete
implementation anyway. :^)
2021-08-31 16:35:37 +02:00
sin-ack
a086be993b LibGUI: Bias text towards bottom when tabs at top have uneven spacing
This makes the text on inactive tabs in Browser look a lil' bit nicer.
:^)
2021-08-31 16:34:55 +02:00
sin-ack
4959fa4f1e LibGUI: Adjust content area and focus rect of tab buttons
This improves the look of tabs and their focus rects. In particular, the
concept of a "text rect" is removed, and whatever tab content area is
left over after the icon and close button are added is used as the area
to draw the text into. This approach is simpler than having a separate
text rect.
2021-08-31 16:34:55 +02:00
kleines Filmröllchen
a749b16674 Libraries: Add LibDSP
LibDSP is a library for digital signal processing, and is primarily
intended to support the future DAW version of Piano.
2021-08-31 17:03:55 +04:30
Nicholas Hollett
4fe380f6da LibGfx: Add color helper for getting shades and tints
Shades are colors darker than the color, tints are colors lighter.
This is helpful in places where we need a bunch of similar colors
with some small differences.
2021-08-31 12:40:51 +02:00
Andreas Kling
af9d4281eb LibC: Run clang-format on setjmp.h 2021-08-31 01:37:30 +02:00
Andreas Kling
887ab3cc9a LibGUI: Rename FileSystemModel's "Owner" column to "User"
A file is owned by a User+Group, not an Owner+Group.
2021-08-31 01:35:08 +02:00
Andreas Kling
34f186e1e6 LibGUI: Tweak scrollbar arrows
Remove the base, leaving only the pointy triangle part. :^)
2021-08-31 01:35:08 +02:00
Andreas Kling
b8416df173 LibGUI+LibGfx: Make scrollbar buttons a little bit thicker
The common thin-cap button look (1px highlight, 2px shadow) looks nice
on regular buttons, but the scrollbar didn't feel quite right.
This patch adds 1px of offset to the highlight, giving it a thick-cap
look (which I have named Gfx::ButtonStyle::ThickCap) :^)
2021-08-31 01:35:08 +02:00
Andreas Kling
087bd7f767 Userland: Use Rect::centered_within() where useful 2021-08-31 01:35:08 +02:00
Andreas Kling
43220568b0 LibGfx: Add Rect::centered_within(Rect)
I've wanted this API a number of times but never added it.
2021-08-31 01:35:08 +02:00
Dimenus
de0861581e Userland: Guard set_jmp.h static_assert check to cpp impls only 2021-08-31 00:47:18 +02:00
Linus Groh
e3254bf4c5 LibJS: Implement Temporal.Calendar.prototype.dateAdd() 2021-08-30 22:33:10 +01:00
Ali Mohammad Pur
f492e98f19 LibWasm: Make the Truncate operator trap on undefined results 2021-08-30 22:47:02 +02:00
Ali Mohammad Pur
2c7e2e351a LibWasm: Implement fx.nearest using nearbyint() instead of round()
This instruction wants RoundingMode::ToEven, so let's use the correct
function.
2021-08-30 22:47:02 +02:00
Timothy Flynn
a2f0eeff7a LibJS: Canonicalize Unicode locale extension attributes and keywords 2021-08-30 19:42:40 +01:00
Timothy Flynn
94e66f500c LibJS: Reject structurally invalid Unicode locale extensions 2021-08-30 19:42:40 +01:00
Timothy Flynn
f897c2edb3 LibUnicode: Canonicalize locale private use extensions 2021-08-30 19:42:40 +01:00
Timothy Flynn
6f0cb52dc4 LibUnicode: Canonicalize locale extensions 2021-08-30 19:42:40 +01:00
Timothy Flynn
671eaa0c59 LibUnicode: Add helper lambda for appending canonicalized strings
Once canonical extensions are implemented, the number of:

    if (optional_string.has_value() {
        builder.append('-');
        builder.append(optional_string->to_lowercase_string());
    }

Will be quite large. This commit just adds a helper lambda to handle
this pattern to prevent this function from becoming even more enormous.
2021-08-30 19:42:40 +01:00
Timothy Flynn
30855e6663 LibUnicode: Parse locale private use extensions 2021-08-30 19:42:40 +01:00
Timothy Flynn
29f76ef7c8 LibUnicode: Parse locale extensions of the other extension form 2021-08-30 19:42:40 +01:00
Timothy Flynn
d2d304fcf8 LibUnicode: Parse locale extensions of the transformed extension form 2021-08-30 19:42:40 +01:00
Timothy Flynn
eda92d15e4 LibUnicode: Parse locale extensions of the Unicode locale extension form 2021-08-30 19:42:40 +01:00
Timothy Flynn
dd89901b07 LibUnicode: Use GenericLexer to parse Unicode language IDs
This is preparatory work to read locale extensions. The parser currently
enforces that the entire string is consumed. But to parse extensions,
parse_unicode_locale_id() will need parse_unicode_language_id() to just
stop parsing on the first segment that does not match the language ID
grammar. It will also need to know where the parsing stopped. Both of
these needs are fulfilled by GenericLexer.

The caveat is that we can no longer simply split the parsed string on
separator characters. So parse_unicode_language_id() now operates as a
small state machine.
2021-08-30 19:42:40 +01:00
Ali Mohammad Pur
206bc01f81 LibRegex: Allow null bytes in pattern
That check was rather pointless as the input is a StringView which knows
its own bounds.
Fixes #9686.
2021-08-30 18:43:09 +02:00
Andreas Kling
eaf904000f LibJS: Always use AK::get_random() in Math.random()
Let AK deal with the underlying platform instead of having __serenity__
specific code in LibJS.
2021-08-30 18:35:36 +02:00
Brian Gianforcaro
619200774b CMake: Add custom target to build only the generated sources
This is needed so all headers and files exist on disk, so that
the sonar cloud analyzer can find them when executing the compilation
commands contained in compile_commands.json, without actually building.

Co-authored-by: Andrew Kaster <akaster@serenityos.org>
2021-08-30 16:44:16 +02:00
sin-ack
d9900ece2f LibWeb: Preprocess the CSS stream in the Tokenizer
This commit implements the input preprocessing algorithm that CSS Syntax
Module Level 3 defines.
2021-08-30 00:08:40 +02:00
sin-ack
e6818388e4 LibTextCodec: Add "process" API for allocation-free code point iteration
This commit adds a new process method to all Decoder subclasses which
do what to_utf8 used to do, and allows callers to customize the handling
of individiual UTF-8 code points through a callback. Decoder::to_utf8
now uses this API to generate a string via StringBuilder, preserving the
original behavior.
2021-08-30 00:08:40 +02:00
sin-ack
fa4eeca0ac LibWeb: Properly handle newlines at the end of LineBoxes
This always subtracted the glyph width of a space, despite isspace
also accepting newlines and a few other characters. It now also uses
AK/CharacterTypes.h. :^)
2021-08-29 01:43:09 +02:00
sin-ack
b08bb0bdc3 LibGfx: Return 0 width for non-printable ASCII characters
Non-printable characters should always have a width of 0. This is not
true for some characters like tab, but those can be exempted as the need
arises. Doing this here saves us from a bunch of checks in any place
that needs to figure out glyph widths for text which can contain
non-printable characters.
2021-08-29 01:43:09 +02:00
sin-ack
27c5eb66f1 LibWeb: Rename wrap_breaks to respect_linebreaks
This more clearly expresses the purpose of this flag. Since only
CSS::WhiteSpace::Nowrap sets this value to false and it does not respect
linebreaks, this made the most sense as a flag name.
2021-08-29 01:43:09 +02:00
sin-ack
0342fe4e0c LibWeb: Refactor TextNode::ChunkIterator
This commit refactors the text chunking algorithm used in
TextNode::ChunkIterator. The m_start_of_chunk member parameter has been
replaced with a local variable that's anchored to the current iterator
at the start of every next() call, and the algorithm is made a little
more clear by explicitly separating what can and cannot peek into the
next character during iteration.
2021-08-29 01:43:09 +02:00
Linus Groh
31bc9565f8 LibJS: Avoid transitions for name/length of native functions/accessors 2021-08-28 23:17:01 +01:00
Linus Groh
8bcda353a2 LibJS: Avoid transitions for more object properties in global object 2021-08-28 23:17:01 +01:00
Linus Groh
45eef97906 LibJS: Avoid transitions in GlobalObject::initialize_constructor()
We don't need transitions for either of these:

- Adding the 'name' property to a constructor object
- Adding the 'constructor' property to its prototype object
2021-08-28 23:17:01 +01:00
Linus Groh
47ab84ffd9 LibJS: Add define_direct_{property,accessor}_without_transition() 2021-08-28 23:17:01 +01:00
Linus Groh
222e518a53 LibJS: Avoid pointless transitions and metadata lookups in storage_set()
- Replace the misleading abuse of the m_transitions_enabled flag for the
  fast path without lookup with a new m_initialized boolean that's set
  either by Heap::allocate() after calling the Object's initialize(), or
  by the GlobalObject in its special initialize_global_object(). This
  makes it work regardless of the shape's uniqueness.
- When we're adding a new property past the initialization phase,
  there's no need to do a second metadata lookup to retrieve the storage
  value offset - it's known to always be the shape's property count
  minus one. Also, instead of doing manual storage resizing and
  assignment via indexing, just use Vector::append().
- When we didn't add a new property but are overwriting an existing one,
  the property count and therefore storage value offset doesn't change,
  so we don't have to retrieve it either.

As a result, Object::set_shape() is now solely responsible for updating
the m_shape pointer and is not resizing storage anymore, so I moved it
into the header.
2021-08-28 23:17:01 +01:00
Andrew Kaster
d6de0613f5 LibCore: Store ObjectRegistration names as StringViews
We don't need to be allocating Strings for these names during static
initialization. The C-string literals will be stored in the .rodata ELF
section, so they're not going anywhere. We can just wrap the .rodata
storage for the class names in StringViews and use those in Object
registration and lookup APIs.
2021-08-28 23:34:30 +02:00
Brian Gianforcaro
2038d2c49e LibELF: Apply some minor optimizations to symbol lookup
Optimizations:

- Make sure `DT_SYMTAB` is a string view literal, instead of string.

- DynamicObject::HashSection::lookup_sysv_symbol should be using
  raw_name() from symbol comparison to avoid needlessly calling
  `strlen`, when the StrinView::operator= walks the cstring without
  calling `strlen` first.

- DynamicObject::HashSection::lookup_gnu_symbol shouldn't create a
  symbol unless we know the hashes match first.

In order to test these changes I enabled Undefined behavior sanitizer
which creates a huge amount of relocations, and then ran the browser
with the help argument 100 times. The browser is a fairly big app with
a few different libraries being loaded, so it seemed liked a good
target.

Command: `time -n 100 br --help`

Before:
```
Timing report:
==============
Command:         br --help
Average time:    3897.679931 ms
Excluding first: 3901.242431 ms
```

After:
```
Timing report:
==============
Command:         br --help
Average time:    3612.860107 ms
Excluding first: 3613.54541 ms
```
2021-08-28 20:03:08 +02:00
Nico Weber
bbad4758b2 CMake: Let Meta/serenity.sh run aarch64 make it past cmake
This adds just enough scaffolding to make cmake succeed.
The build falls over immediately.
2021-08-28 14:43:07 +01:00
Nico Weber
a43ad0e706 LibELF: Reindent .S files to be consistent with other .S files
Most .S files don't indent directives, so don't indent them here either.
Also, one file had tabs instead of spaces, `:retab` that file.
2021-08-28 14:43:07 +01:00
Nico Weber
7052f403c8 Toolchain: Enough to make rebuild-toolchain aarch64 work
The gcc patch might not be completely correct, but at least the
toolchain completes building.
2021-08-28 14:43:07 +01:00
Andrew Kaster
63956b36d0 Everywhere: Move all host tools into the Lagom/Tools subdirectory
This allows us to remove all the add_subdirectory calls from the top
level CMakeLists.txt that referred to targets linking LagomCore.

Segregating the host tools and Serenity targets helps us get to a place
where the main Serenity build can simply use a CMake toolchain file
rather than swapping all the compiler/sysroot variables after building
host libraries and tools.
2021-08-28 08:44:17 +01:00
Andrew Kaster
cdfd0bad1f LibWeb: Use foreach to generate wrapper targets and tidy up CMakeLists
Gather the custom commands for each of the 6 bindings generated targets
for libjs_js_wrapper invocations into some lists so that we can foreach
over the lists instead of having 6 copy pasted commands with one or two
things modified for each one.

Additional refactoring, use target_sources command to inform CMake about
additional source files for LibWeb, but only after it's been declared as
a library via add_library. Also avoid use of the write_if_different
script and use cmake -E copy_if_different instead. This lets us express
the actions in rules that CMake understands without going to an external
source file. It exposes a few optimization opportunities for the code
generators to accept an output filename instead of always going to
stdout.
2021-08-28 08:44:17 +01:00
Andrew Kaster
e88761b2b9 Meta+LibUnicode: Move unicode_data helper to Meta/CMake
Moving this helper CMake file to the centralized Meta/CMake folder helps
to get a better grasp on what extra files are required for the build,
and what files are generated.

While we're at it, don't use add_compile_definitions for
ENABLE_UNICODE_DATA, which only needs to be seen by LibUnicode sources.
2021-08-28 08:44:17 +01:00
Simon Danner
16830a60ec LibGUI: Select common location on Filepicker startup 2021-08-28 08:17:00 +01:00
Robert Syring
4f2dc8db26 LibUnicode: Change unzip commands to also extract subdirectories
Changed unzip commands from * to ** in order to also extract subdirectories from cldr.zip.
2021-08-28 08:13:32 +01:00
Linus Groh
a8329272cc LibJS: Implement Temporal.ZonedDateTime.prototype.eraYear 2021-08-27 23:36:52 +01:00
Linus Groh
b59e9260db LibJS: Implement Temporal.ZonedDateTime.prototype.era 2021-08-27 23:36:52 +01:00
Linus Groh
f59e4d6738 LibJS: Implement Temporal.PlainYearMonth.prototype.eraYear 2021-08-27 23:36:52 +01:00
Linus Groh
b11ea98648 LibJS: Implement Temporal.PlainYearMonth.prototype.era 2021-08-27 23:36:52 +01:00
Linus Groh
f2f671f340 LibJS: Implement Temporal.PlainDateTime.prototype.eraYear 2021-08-27 23:36:52 +01:00
Linus Groh
276d3f5089 LibJS: Implement Temporal.PlainDateTime.prototype.era 2021-08-27 23:36:52 +01:00
Linus Groh
418c22f9b3 LibJS: Implement Temporal.PlainDate.prototype.eraYear 2021-08-27 23:36:52 +01:00
Linus Groh
6f7d6d917e LibJS: Implement Temporal.PlainDate.prototype.era 2021-08-27 23:36:52 +01:00
Linus Groh
c3e0d78ba6 LibJS: Implement Temporal.Calendar.prototype.eraYear() 2021-08-27 23:36:52 +01:00
Linus Groh
f746850d1c LibJS: Implement Temporal.Calendar.prototype.era() 2021-08-27 23:36:52 +01:00
Mustafa Quraish
75a706b6eb Everywhere: Use the Optional<T>::operator==(T) operator
In general, I think `opt == x` looks much nicer than
`opt.has_value() && opt.value() == x`, so I'm updating
the remaining few instances I could find with some regex
magic in my search.
2021-08-27 23:13:51 +02:00
kleines Filmröllchen
d049626f40 Userland+LibAudio: Make audio applications support dynamic sample rate
All audio applications (aplay, Piano, Sound Player) respect the ability
of the system to have theoretically any sample rate. Therefore, they
resample their own audio into the system sample rate.

LibAudio previously had its loaders resample their own audio, even
though they expose their sample rate. This is now changed. The loaders
output audio data in their file's sample rate, which the user has to
query and resample appropriately. Resampling code from Buffer, WavLoader
and FlacLoader is removed.

Note that these applications only check the sample rate at startup,
which is reasonable (the user has to restart applications when changing
the sample rate). Fully dynamic adaptation could both lead to errors and
will require another IPC interface. This seems to be enough for now.
2021-08-27 23:35:27 +04:30
kleines Filmröllchen
d0ceaa24a6 Kernel: Implement ioctl for the SB16 to change sample rate
Two new ioctl requests are used to get and set the sample rate of the
sound card. The SB16 device keeps track of the sample rate separately,
because I don't want to figure out how to read the sample rate from the
device; it's easier that way.

The soundcard write doesn't set the sample rate to 44100 Hz every time
anymore, as we want to change it externally.
2021-08-27 23:35:27 +04:30
Idan Horowitz
24dbf18936 LibJS: Implement Temporal.PlainDateTime.prototype.withPlainTime() 2021-08-27 19:01:30 +01:00
Idan Horowitz
0f464f38d3 LibJS: Implement Temporal.PlainTime.prototype.equals() 2021-08-27 19:01:30 +01:00
Idan Horowitz
684e62476b LibJS: Implement Temporal.PlainTime.compare() 2021-08-27 19:01:30 +01:00
Idan Horowitz
a77cdc5f92 LibJS: Implement Temporal.PlainTime.from() 2021-08-27 19:01:30 +01:00
Idan Horowitz
bb857330d2 LibJS: Implement Temporal.PlainDate.prototype.toPlainDateTime() 2021-08-27 19:01:30 +01:00
Idan Horowitz
f6370fe3f7 LibJS: Add the ToTemporalTime AO and stub the ParseTemporalTimeString AO
This AO is required for a bunch of PlainTime related methods.

As part of this change the `TemporalTime` record was renamed to
`UnregulatedTemporalTime` and a new `TemporalTime` record that matches
the other Temporal parse result records was added. This also has the
added benefit of getting rid of a would be round-trip cast from integer
to double and back in `ParseTemporalTimeString`.
2021-08-27 19:01:30 +01:00
Idan Horowitz
32fc81c186 LibJS: Implement Temporal.PlainDateTime.prototype.equals() 2021-08-27 16:40:16 +01:00
Idan Horowitz
9ed877e8e7 LibJS: Implement Temporal.PlainDateTime.compare() 2021-08-27 16:40:16 +01:00
Idan Horowitz
28fa4d1568 LibJS: Add the CompareTemporalTime & CompareISODateTime AOs
These are required for implementing comparisons between `PlainTime`s and
`PlainDateTime`s.
2021-08-27 16:40:16 +01:00
Timothy Flynn
86b99fd9a6 LibJS: Extend Intl.DisplayNames.of to support currency tags 2021-08-27 12:32:24 +01:00
Timothy Flynn
8b93d51212 LibUnicode: Parse Unicode CLDR currencies and generate locale mappings 2021-08-27 12:32:24 +01:00
Timothy Flynn
297db925fc LibUnicode: Extract cldr-numbers dataset from CLDR database
This dataset holds the values needed to handle DisplayNames.prototype.of
with a type option of "currency".
2021-08-27 12:32:24 +01:00
Timothy Flynn
a029e3d38a LibJS: Extend Intl.DisplayNames.of to support script tags 2021-08-27 12:32:24 +01:00
Timothy Flynn
0f02def3c2 LibUnicode: Parse Unicode CLDR scripts and generate locale mappings 2021-08-27 12:32:24 +01:00
Timothy Flynn
ca77a7c573 LibJS: Extend Intl.DisplayNames.of to support language tags 2021-08-27 12:32:24 +01:00
Timothy Flynn
ab7a1dd89e LibUnicode: Parse Unicode CLDR languages and generate locale mappings 2021-08-27 12:32:24 +01:00
Timothy Flynn
6719e5cb17 LibUnicode: Generate locale subtag data as multiple smaller tables
This commit is preemptive to upcoming commits which add more subtags to
the CLDR generator. Rather than generating a giant HashMap containing
all data, generate more (smaller) Array-based tables. This mimics the
UCD generator. This also allows simpler lookups at runtime since we can
generate index-based lookups into the smaller tables rather easily.

Without this change, adding the remaining locale subtags would result
in the generation and compilation of UnicodeLocale.cpp taking about 30s
on my machine. With this change, it takes about half that. Additionally,
the size of the generated file reduces by about 1.5MB.
2021-08-27 12:32:24 +01:00
Timothy Flynn
b8ad4d302e LibUnicode: Move Locale enumeration from generated UCD data to CLDR data
The UCD set of data contained a very small subset of all locales just to
handle some special casing rules. This enumeration will be needed within
the CLDR generator as well. So rather than duplicate the enum, remove it
from the UCD generator in favor of the full list of locales known by the
CLDR generator.
2021-08-27 12:32:24 +01:00
Andreas Kling
edf7843409 ConfigServer+LibConfig: Add way for clients to listen for config changes
This patch adds a Config::Listener abstract class that anyone can
inherit from and receive notifications when configuration values change.

We don't yet monitor file system changes, so these only work for changes
made by ConfigServer itself.

In order to receive these notifications, clients must monitor the domain
by calling monitor_domain(). Only pledged domains can be monitored.

Note that the client initiating the change does not get notified.
2021-08-26 23:41:38 +02:00
Andreas Kling
9509f2ff87 LibWeb: Remove outdated FIXME about ACID2
I should have removed this in 1fa5fba432.
2021-08-26 23:41:37 +02:00
Timothy Flynn
a57615c2b4 Meta: Ensure cmake fails if we are unable to unzip the CLDR database 2021-08-26 23:40:23 +02:00
Timothy Flynn
a061d874c9 LibJS: Implement Intl.DisplayNames.prototype.resolvedOptions 2021-08-26 22:04:09 +01:00
Timothy Flynn
17bb652775 LibJS: Implement Intl.DisplayNames.prototype.of
Note that only option type=region is really implemented. Other types
will resort to the fallback option. This prototype method will be able
to implement other type options once LibUnicode supports more.
2021-08-26 22:04:09 +01:00
Timothy Flynn
38d29a40dc LibJS: Implement Intl.getCanonicalLocales 2021-08-26 22:04:09 +01:00
Timothy Flynn
e8dd2eea74 LibJS: Implement the Intl.DisplayNames constructor
There is notably FIXME notations in this commit regarding Unicode locale
extensions. We are not parsing extensions (or private use extensions) at
all yet.
2021-08-26 22:04:09 +01:00
Timothy Flynn
0fb4e8b749 LibJS: Implement a nearly empty Intl.DisplayNames object
This adds plumbing for the Intl.DisplayNames object, constructor, and
prototype.
2021-08-26 22:04:09 +01:00
Timothy Flynn
137e98cb6f LibUnicode: Add public accessors to generated locale data 2021-08-26 22:04:09 +01:00
Timothy Flynn
b7a95cba65 LibUnicode: Implement grammar validators for Unicode TR-35
ECMA-402 requires validating user input against the EBNF grammar for
Unicode locales described in TR-35: https://www.unicode.org/reports/tr35

This commit adds validators for that grammar, as well as other helper to
e.g. canonicalize a locale string.
2021-08-26 22:04:09 +01:00
Timothy Flynn
ea21573ed8 LibUnicode: Download Unicode's CLDR database and generate locale data
The Unicode standard publishes a database known as the Common Locale
Data Repository (CLDR). This is a massive set of data from which anyone
implementing Unicode's Technical Standard #35 may generate their
implementation: https://www.unicode.org/reports/tr35/

This commit updates LibUnicode to download the compressed database and
extract a small subset. That subset is used to generate a list of
available locales and the territories (AKA regions) associated with each
locale.
2021-08-26 22:04:09 +01:00
Stephan Unverwerth
b54573739c LibGL: Implement glTexEnvf
This controls how fetched texels are combined with the color that was
produced by a preceding texture unit or with the vertex color if it is
the first texture unit.

Currently only a small subset of possible combine modes is implemented
as required by glquake.
2021-08-26 19:54:31 +02:00
Stephan Unverwerth
19a08ff187 LibGL: Implement glPixelStorei
This sets the length of a row for the image to be transferred. This
value is measured in pixels. When a rectangle with a width less than
this value is transferred the remaining pixels of this row are skipped.
2021-08-26 19:53:57 +02:00
Andreas Kling
1fa5fba432 LibWeb: Make the base StyleValue::to_length() return an undefined length
Previously it was returning an "auto" length. This caused all the new
"initial" values to effectively turn into auto values long before layout
had a chance to resolve them.

This broke replaced elements with intrinsic size but no specified width
or height, and is the reason that Mr. ACID2 temporarily lost his eyes.
2021-08-26 13:25:52 +02:00
Andreas Kling
243e9a8b4a LibWeb: Correct CSS initial values for min-width and min-height
The initial value for these is auto, not 0.
2021-08-26 13:25:52 +02:00
Andreas Kling
cf8f1c5a5f LibWeb: Remove unused CSS::StyleProperties::string_or_fallback() 2021-08-26 13:25:52 +02:00
Andreas Kling
eeddaa988a ConfigServer+LibConfig: Add pledge_domains() API
This API lets applications specify which configuration domains they
will be accessing throughout their lifetime. It works similarly in
spirit to the kernel's pledge().

You cannot pledge_domains() more than once, and once you have used it,
it's no longer possible to access any other configuration domain.

This is obviously just a first cut of this mechanism, and we may need
to tweak it further as we go.
2021-08-26 00:54:28 +02:00
Andreas Kling
870ecd5190 LibConfig: VERIFY that a Core::EventLoop exists before connecting
It's not possible to connect to ConfigServer without having an event
loop available. This VERIFY makes it much easier to understand why
things are not working. :^)
2021-08-26 00:54:28 +02:00
Andreas Kling
67a0fa2b78 LibCore: Add Core::EventLoop::has_been_instantiated()
This static bool getter can be used to VERIFY that an event loop exists,
in situations where one is expected.

This is helpful if the absence of an event loop would generate strange
and/or loud errors that don't immediately point to this as a cause.
2021-08-26 00:54:27 +02:00
Andreas Kling
82d8cd2b87 Terminal+LibVT: Use LibConfig instead of Core::ConfigFile 2021-08-26 00:54:27 +02:00
Andreas Kling
bdcd0abf9d Userland: Introduce ConfigServer and LibConfig
ConfigServer is an IPC service that provides access to application
configuration and settings. The idea is to replace all uses of
Core::ConfigFile with IPC requests to ConfigServer.

This first cut of the API is pretty similar to Core::ConfigFile.

The old:

    auto config = Core::ConfigFile::open_for_app("App");
    auto value = config->read_entry("Group", "Key");

The new:

    auto value = Config::read_string("App", "Group", "Key");

ConfigServer uses the ~/.config directory as its backing store
and all the files remain human-editable. :^)
2021-08-26 00:54:27 +02:00
Jean-Baptiste Boric
0248e6ae27 LibC: Check for expected size of struct __jmp_buf
This structure is accessed through assembly code inside setjmp.S, make
some effort to ensure both header and assembly files are in sync.
2021-08-26 00:54:23 +02:00
Jean-Baptiste Boric
295e89af04 LibC: Fix sigsetjmp on x86_64
Registers were clobbered, offset values into __jmp_buf were wrong...
2021-08-26 00:54:23 +02:00
Jean-Baptiste Boric
c87aa6d908 LibC: Fix sigsetjmp on i686
Calling sigprocmask() through the PLT requires setting the ebx register
to the address of the global offset table, otherwise chaos ensues. Also
the value of the ecx register was assumed to be preserved across that
function call despite the fact that it is caller-saved in the x86
calling convention.
2021-08-26 00:54:23 +02:00
Ali Mohammad Pur
04e3965b09 LibWasm: Use Operators::BitShiftRight for i64.shru
Using a left-shift operator for a right shift operation is not exactly
the most correct action :P
2021-08-26 00:51:30 +02:00
Jesse Buhagiar
924d890bfe LibGL: Implement fog effect in Software Rasterizer
We support three of the possible fog modes, EXP, EXP2 and LINEAR.
2021-08-25 23:50:54 +04:30
Jesse Buhagiar
d73cc3d0eb LibGL: Implement glFogi 2021-08-25 23:50:54 +04:30
Jesse Buhagiar
f55d2a22af LibGL: Implement glFogf 2021-08-25 23:50:54 +04:30
Jesse Buhagiar
7f1cd54b80 LibGL: Implement glFogfv
This currently just sets the fog colour in the rasterizer.
2021-08-25 23:50:54 +04:30
Karol Kosek
ffa7da0ca5 LibWeb: Handle CSS "ch" length unit (mostly)
This isn't 100% spec complaint, as it should use glyph_height()
depending on what the value of the writing-mode is, but we haven't
implemented it yet, so I think it'll be good enough for now.

This can be tested in https://wpt.live/css/css-values/ch-unit-008.html
Other css-unit tests fail as:
- 001 shows an issue related to a renderer (looks to me like you can't
  pass a width and height property to a span -- adding `display: block`
  to it passes the test),
- 002-004 and 009-012 use mentioned writing-mode,
- 016-017 loads custom fonts, which we also don't support (yet).
2021-08-25 17:55:53 +02:00
Sam Atkins
b92a6d6542 LibWeb: Implement CSS unset builtin value
This is equivalent to `initial` or `inherit`, depending on if the
property is inherited by default.
2021-08-25 12:14:34 +02:00
Sam Atkins
3296fd70b3 LibWeb: Intercept CSS initial/inherit values in StyleProperties
When property() previously would have returned an InitialStyleValue, we
now look up what the initial value would be, and return that instead.

We also intercep 'inherit', but inheritance is not implemented yet so we
just return nothing.

This does cause a regression on Acid2: The eyes no longer appear, and I
am not sure why. :^(
2021-08-25 12:14:34 +02:00
Sam Atkins
8995839e3f LibWeb: Generate property_initial_value() function from Properties.json
Since we have initial-value data in Properties.json already, it makes
sense to use that instead of needing to duplicate the same information
in ComputedValues.h

However, converting a StyleValue to the kind of types used in
InitialValues is non-trivial. So this may or may not actually be useful.
2021-08-25 12:14:34 +02:00
Sam Atkins
38ee69adfa LibWeb: Add StyleValue to Forward.h 2021-08-25 12:14:34 +02:00
Sam Atkins
543550d1df LibWeb: Quote all initial values in Properties.json
This is in preparation for parsing these into StyleValues automatically.
Having them all be Strings makes the generation code simpler.
2021-08-25 12:14:34 +02:00
Sam Atkins
6d39f4342d LibWeb: Use single shared instance of Inherit/InitialStyleValue
These are always the same, so we can avoid allocating them repeatedly
and just use a single instance of each. :^)
2021-08-25 12:14:34 +02:00
Sam Atkins
d2342caf42 LibWeb: Parse CSS builtins before other values
These are straightforward to parse, so doing them first saves
potentially expensive calculations inside parse_foo_value() functions.
2021-08-25 12:14:34 +02:00
Brian Gianforcaro
77d8a65498 LibJS: Fix incorrect Lexer VERIFY when parsing Unicode characters
This bug was discovered via OSS fuzz, it's possible to fall through
to this assert with a char_size == 1, so we need to account for that
in the VERIFY(..).

Repro test case can be found in the OSS fuzz bug:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37296
2021-08-25 09:21:23 +01:00
Ralf Donau
a501b903b5 LibCore: Set file offset in ConfigFile::sync 2021-08-24 18:17:09 +02:00
Andreas Kling
fd922cf92f LibWeb+WebContent: Add a simple API for running arbitrary JavaScript
This patch adds OutOfProcessWebView::run_javascript(StringView).
This can be used by the OOPWV embedder to execute arbitrary JavaScript
in the top-level browsing context on the WebContent process side.
2021-08-24 16:56:42 +02:00
Andreas Kling
dfa9dcca98 LibWeb+Browser: Remove unnecessary InProcessWebView.h includes 2021-08-24 16:37:28 +02:00
davidot
c108c8ff24 LibJS: Disallow yield expression correctly in formal parameters
And add ZERO WIDTH NO BREAK SPACE to valid whitespace.
2021-08-24 07:42:37 +01:00
davidot
7bcffd1b6a LibJS: Fix some small remaining issues with parsing unicode escapes
Added a test to ensure the behavior stays the same.
We now throw on a direct usage of an escaped keywords with a specific
error to make it more clear to the user.
2021-08-24 07:42:37 +01:00
Linus Groh
6ce05026b4 LibJS: Implement Temporal.ZonedDateTime.prototype.toPlainMonthDay() 2021-08-24 01:53:30 +02:00
Linus Groh
ef581be4ec LibJS: Implement Temporal.ZonedDateTime.prototype.toPlainYearMonth() 2021-08-24 01:53:30 +02:00
Linus Groh
fc58f93734 LibJS: Implement Temporal.PlainDateTime.prototype.toPlainMonthDay() 2021-08-24 01:53:30 +02:00
Linus Groh
5573efa3bd LibJS: Implement Temporal.PlainDateTime.prototype.toPlainYearMonth() 2021-08-24 01:53:30 +02:00
Linus Groh
ad427f85ca LibJS: Implement Temporal.PlainDateTime.from() 2021-08-23 20:54:52 +01:00
Linus Groh
573587b83a LibJS: Fix logic error in RegulateISODate 2021-08-23 20:54:52 +01:00
Sam Atkins
226fe4b57d LibWeb: Paint inspection outline for InlineNodes :^)
This iterates the fragments of the containing block, and paints their
outlines if they are descendants of the InlineNode.

If multiple fragments are adjacent, eg:

```html
<span><b>Well</b> hello <i>friends!</i></span>
```

...then we get a double-thick outline between "Well", " hello " and
"friends!", but we can come back to this after we implement
non-rectangular outlines for the `outline` CSS property.
2021-08-23 15:59:29 +02:00
Sam Atkins
8eef509c1b LibWeb: Add DOMTreeModel::index_for_node()
This is needed for telling the DOM Inspector to select a given Node.
2021-08-23 15:59:29 +02:00
Maciej Zygmanowski
3597b6eb9d WindowServer+LibGfx: Move CursorParams to LibGfx
They will be used by MouseSettings in the next commit.
2021-08-23 01:41:53 +02:00
Timothy Flynn
4f186a9a1f LibJS: Implement Promise.race on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
949f294444 LibJS: Implement Promise.allSettled on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
4dffa40a8d LibJS: Implement Promise.any on the Promise constructor 2021-08-23 00:01:46 +01:00
Timothy Flynn
98d8a858cd LibJS: Set the function names for the resolve, reject, and executor
These should all have a name with an empty string. Not only does test262
verify this, but it also verifies that (for the executor) the name
property is defined after the length property.
2021-08-23 00:01:46 +01:00
Timothy Flynn
5b303721e0 LibJS: Generalize PerformPromiseAll common functionality
PerformPromiseAll, PerformPromiseAny, PerformPromiseAllSettled, etc, all
have very similar iteration loops. To avoid duplicating this rather
large block of code, extract the common functionality into a separate
method.
2021-08-23 00:01:46 +01:00
Timothy Flynn
417523507e LibJS: Generalize PromiseAllResolveElementFunction common functionality
The element-resolving functions on the Promise constructor are all very
similar. To prepare for more of these functions to be implemented, break
out common parts into a base class.
2021-08-23 00:01:46 +01:00
Andreas Kling
bcd2025311 Everywhere: Core dump => Coredump
We all know what a coredump is, and it feels more natural to refer to
it as a coredump (most code already does), so let's be consistent.
2021-08-23 00:02:09 +02:00
Linus Groh
969aee2022 LibJS: Add missing builtin calendar check to ParseTemporalCalendarString
See: https://github.com/tc39/proposal-temporal/commit/48b11d6
2021-08-22 21:20:00 +01:00
Andrew January
9a4c1c019a LibGUI: Make Ctrl+Shift+Right select text
Ctrl+Shift+Left would add the word before the cursor to the selection,
but for some reason Ctrl+Shift+Right didn't add the word after the
cursor to the selection.
2021-08-22 15:31:27 +02:00
Maciej Zygmanowski
7237972022 LibC: Support getsignalbyname() with full signal name
This allows e.g. to use `kill` with names like -SIGKILL, not only -KILL.
2021-08-22 15:23:25 +02:00
Karol Kosek
219206725b LibGUI: Always resize the mapping rows when sorting
Prior this change, creating a file or directory
on Desktop crashed the desktop instance of FileManager.

Closes: #9560
2021-08-22 10:29:17 +02:00
Peter Elliott
ee0c6e1b6d LibC: Add <sys/poll.h> as an alias for <poll.h>
<poll.h> was originally <sys/poll.h> and some old software like X11
still uses the old path.
2021-08-22 10:29:06 +02:00
Peter Elliott
39a77559f1 Kernel+LibC: Implement FIONREAD ioctl
FIONREAD gets the number of bytes availible to read from a file
descriptor without blocking. I only implemented it for regular files and
sockets
2021-08-22 10:29:06 +02:00
Peter Elliott
db92e66902 LibC: Make <netinet/in.h> more POSIX compliant
1. Move htonl() etc. from <arpa/inet.h> to <netinet/in.h> (which
   <arpa/inet.h> includes).

   The htonl(), htons(), ntohl(), and ntohs() functions shall be
   available as described in <arpa/inet.h>.  Inclusion of the
   <netinet/in.h> header may also make visible all symbols from
   <arpa/inet.h>.

   - POSIX

2. Define IN6_IS_ADDR_LOOPBACK() and IN6_IS_ADDR_V4MAPPED()
2021-08-22 10:29:06 +02:00
Peter Elliott
f16aba405f LibC: Add LINK_MAX and _PC_LINK_MAX
LINK_MAX was set arbitrarily to 4096, this is not an actual system
limit.
2021-08-22 10:29:06 +02:00
Peter Elliott
d9ecb3ecfa LibC: Modify fd_set to be compatible with X/OPEN
For some reason X/OPEN requires that fd_set has a field fds_bits. Xproto
requires either fds_bits or _fds_bits to be present, so the field 'bits'
was renamed 'fds_bits'
2021-08-22 10:29:06 +02:00
networkException
acde7d12b0 Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to open
This patch brings the ConfigFile helpers for opening lib, app and system
configs more inline with the regular ConfigFile::open functions.
2021-08-22 01:32:25 +02:00
networkException
938051feb8 Everywhere: Use Core::ConfigFile::AllowWriting::Yes to allow writing 2021-08-22 01:32:25 +02:00
networkException
54bbe52b51 LibCore: Convert ConfigFile to east const 2021-08-22 01:32:25 +02:00
networkException
2ea2d026c2 LibCore: Support using a file descriptor for opening ConfigFile
This patch adds support for opening a ConfigFile using a file
descriptor rather than trying to open a the file by name directly.

In contrast to the previous implementation, ConfigFile now always keeps
a reference to an open File and does not reopen it for writing.

This requires providing an additional argument to open functions if a
file gets opened based on its name and the user of the api intends to
write to the file in the future.
2021-08-22 01:32:25 +02:00
Timothy Flynn
dee3b7b8c9 LibJS: Implement Promise.all on the Promise constructor 2021-08-21 23:08:49 +01:00
Timothy Flynn
cdf2854fdf LibJS: Fix copy-paste mistake in GetCapabilitiesExecutor 2021-08-21 23:08:49 +01:00
Itamar
f91974677c LibCpp: Use lex_iterable() where applicable 2021-08-21 22:09:56 +02:00
Itamar
606e05852f LibCpp: Add lex_iterable() method to the Lexer
This allows us to collect the tokens iteratively instead of having to
lex the whole program and then get a tokens vector.
2021-08-21 22:09:56 +02:00
Itamar
7a4a32b112 LibCpp: Lex before processing the source in the Preprocessor
Previously, the preprocessor first split the source into lines, and then
processed and lexed each line separately.

This patch makes the preprocessor first lex the source, and then do the
processing on the tokenized representation.

This generally simplifies the code, and also fixes an issue we
previously had with multiline comments (we did not recognize them
correctly when processing each line separately).
2021-08-21 22:09:56 +02:00
Itamar
165a0082c4 LibCpp: Allow whitespace between # and preprocessor directive
For example, '#    include <stdio.h>' is now supported by the Lexer.
2021-08-21 22:09:56 +02:00
Jan de Visser
85a84b0794 LibSQL: Introduce Serializer as a mediator between Heap and client code
Classes reading and writing to the data heap would communicate directly
with the Heap object, and transfer ByteBuffers back and forth with it.
This makes things like caching and locking hard. Therefore all data
persistence activity will be funneled through a Serializer object which
in turn submits it to the Heap.

Introducing this unfortunately resulted in a huge amount of churn, in
which a number of smaller refactorings got caught up as well.
2021-08-21 22:03:30 +02:00
Jan de Visser
d074a601df LibSQL+SQLServer: Bare bones INSERT and SELECT statements
This patch provides very basic, bare bones implementations of the
INSERT and SELECT statements. They are *very* limited:
- The only variant of the INSERT statement that currently works is
   SELECT INTO schema.table (column1, column2, ....) VALUES
      (value11, value21, ...), (value12, value22, ...), ...
   where the values are literals.
- The SELECT statement is even more limited, and is only provided to
  allow verification of the INSERT statement. The only form implemented
  is: SELECT * FROM schema.table

These statements required a bit of change in the Statement::execute
API. Originally execute only received a Database object as parameter.
This is not enough; we now pass an ExecutionContext object which
contains the Database, the current result set, and the last Tuple read
from the database. This object will undoubtedly evolve over time.

This API change dragged SQLServer::SQLStatement into the patch.

Another API addition is Expression::evaluate. This method is,
unsurprisingly, used to evaluate expressions, like the values in the
INSERT statement.

Finally, a new test file is added: TestSqlStatementExecution, which
tests the currently implemented statements. As the number and flavour of
implemented statements grows, this test file will probably have to be
restructured.
2021-08-21 22:03:30 +02:00
Jan de Visser
230118c4b2 LibSQL: Added 'nullable' and 'default value' option to ColumnDef
These are standard SQL concepts which columns should be aware of.
2021-08-21 22:03:30 +02:00
Jan de Visser
b74721e604 LibSQL: Redesign Value implementation and add new types
The implemtation of the Value class was based on lambda member variables
implementing type-dependent behaviour. This was done to ensure that
Values can be used as stack-only objects; the simplest alternative,
virtual methods, forces them onto the heap. The problem with the the
lambda approach is that it bloats the Values (which are supposed to be
lightweight objects) quite considerably, because every object contains
more than a dozen function pointers.

The solution to address both problems (we want Values to be able to live
on the stack and be as lightweight as possible) chosen here is to
encapsulate type-dependent behaviour and state in an implementation
class, and let the Value be an AK::Variant of those implementation
classes. All methods of Value are now basically straight delegates to
the implementation object using the Variant::visit method.

One issue complicating matters is the addition of two aggregate types,
Tuple and Array, which each contain a Vector of Values. At this point
Tuples and Arrays (and potential future aggregate types) can't contain
these aggregate types. This is limiting and needs to be addressed.

Another area that needs attention is the nomenclature of things; it's
a bit of a tangle of 'ValueBlahBlah' and 'ImplBlahBlah'. It makes sense
right now I think but admit we probably can do better.

Other things included here:
- Added the Boolean and Null types (and Tuple and Array, see above).
- to_string now always succeeds and returns a String instead of an
  Optional. This had some impact on other sources.
- Added a lot of tests.
- Started moving the serialization mechanism more towards where I want
  it to be, i.e. a 'DataSerializer' object which just takes
  serialization and deserialization requests and knows for example how
  to store long strings out-of-line.

One last remark: There is obviously a naming clash between the Tuple
class and the Tuple Value type. This is intentional; I plan to make the
Tuple class a subclass of Value (and hence Key and Row as well).
2021-08-21 22:03:30 +02:00
Jan de Visser
a5e28f2897 LibSQL: Make TupleDescriptor a shared pointer instead of a stack object
Tuple descriptors are basically the same for for example all rows in
a table. Makes sense to share them instead of copying them for every
single row.
2021-08-21 22:03:30 +02:00
Jesse Buhagiar
0152f1924b LibGL: Use integer comparison for GL_EQUAL and GL_NOTEQUAL
This is an interesting quirk that occurs due to us using the x87 FPU
when Serenity is compiled for the i386 target. When we calculate our
depth value to be stored in the buffer, it is an 80-bit x87
floating point number, however, when stored into the DepthBuffer,
this is truncated to 32 bits. This 38 bit loss of precision means
that when x87 `FCOMP` is eventually used here the comparison fails.

This could be solved by using a `long double` for the depth buffer,
however this would take up significantly more space and is completely
overkill for a depth buffer. As such, comparing the first 32-bits of
this depth value is "good enough" that if we get a hit on it being
equal, we can pretty much guarantee that it's actually equal.
2021-08-21 13:48:59 +04:30
TheFightingCatfish
9721b7b2dd LibCore: Show version and help before parsing positional arguments
This allows `--version` and `--help` to work properly even if we do not
supply the required positional arguments to a command.
2021-08-20 20:13:12 +02:00
Timothy Flynn
6337eb52d8 LibJS: Implement RegExp.prototype.compile
This is an Annex B extension to RegExp.prototype.
2021-08-20 19:16:33 +02:00
Timothy Flynn
562d4e497b LibRegex: Treat pattern string characters as unsigned
For example, consider the following pattern:

    new RegExp('\ud834\udf06', 'u')

With this pattern, the regex parser should insert the UTF-8 encoded
bytes 0xf0, 0x9d, 0x8c, and 0x86. However, because these characters are
currently treated as normal char types, they have a negative value since
they are all > 0x7f. Then, due to sign extension, when these characters
are cast to u64, the sign bit is preserved. The result is that these
bytes are inserted as 0xfffffffffffffff0, 0xffffffffffffff9d, etc.

Fortunately, there are only a few places where we insert bytecode with
the raw characters. In these places, be sure to treat the bytes as u8
before they are cast to u64.
2021-08-20 19:16:33 +02:00
Timothy Flynn
7c54b6bd45 LibJS: Separate RegExpCreate into RegExpAlloc and RegExpInitialize
RegExp.prototype.compile will require invoking RegExpInitialize on an
already-existing RegExpObject. Break up RegExpCreate into RegExpAlloc
and RegExpInitialize to support this.
2021-08-20 19:16:33 +02:00
Sam Atkins
8f2ab524fa LibWeb: Fix inverted-if typo in flex_shrink_factor()
I messed this up when I changed it before, which was causing a crash.
2021-08-20 19:15:32 +02:00
Linus Groh
5d116372a8 LibJS: Implement Temporal.PlainMonthDay.prototype.toJSON() 2021-08-20 18:12:15 +01:00
Linus Groh
5904c6bf18 LibJS: Implement Temporal.PlainMonthDay.prototype.toLocaleString() 2021-08-20 18:12:15 +01:00
Linus Groh
ea44f33d5b LibJS: Implement Temporal.PlainMonthDay.prototype.toString() 2021-08-20 18:12:15 +01:00
Linus Groh
c1c8d7861c LibJS: Implement Temporal.PlainYearMonth.prototype.toJSON() 2021-08-20 18:12:15 +01:00
Linus Groh
70fb7bf57e LibJS: Implement Temporal.PlainYearMonth.prototype.toLocaleString() 2021-08-20 18:12:15 +01:00
Linus Groh
421ad73b4f LibJS: Implement Temporal.PlainYearMonth.prototype.toString() 2021-08-20 18:12:15 +01:00
Jesse Buhagiar
89eddb5bff LibGL: Implement glPolygonMode
Currently just sets the renderer option for what polygon mode we
want the rasterizer to draw in. GLQuake only uses `GL_FRONT_AND_BACK`
with `GL_FILL` )which implies both back and front facing triangles
are to be filled completely by the rasterizer), so keeping this as
a small stub is perfectly fine for now.
2021-08-20 20:04:06 +04:30
Andreas Kling
f58e2350dc LibWeb: Parse the CSS opacity property with strtof() for now
With the new parser, we started interpreting the `opacity` property as a
string value, which made it turn into `auto` and so anything with
opacity ended up not visible (e.g the header on google.com)

This patch restores our old behavior for `opacity` by interpreting it
as a numeric value with optional decimals.
2021-08-20 15:43:01 +02:00
Andreas Kling
ed7a2f21ff LibTextCodec: Remove unused is_standardized_encoding() 2021-08-20 15:31:46 +02:00
Andreas Kling
13f4890c38 LibCore: Make Core::File::open() return OSError in case of failure 2021-08-20 15:31:46 +02:00
Andrew January
ac055554f6 LibGUI: Reduce amount we init for FileIconProvider::filetype_image_icon
Instead of loading every icon, only load the filetype image icon if it
hasn't been already. This icon is used by IconViews that need to lazily
load thumbnails, which don't need any of the other icon types.

Spending the time to load the unneeded images was causing delays to
first paint in BackgroundSettings.
2021-08-20 15:31:22 +02:00
Andreas Kling
8fce5caa49 LibGUI: Pass context menu events through normal event dispatch
Previously we'd synthesize an event and invoke context_menu_event()
directly. This prevented the event from bubbling even if ignored.
2021-08-20 01:27:39 +02:00
Timothy Flynn
1259dc3623 LibJS: Allow Unicode escape sequences in identifiers
For example, "property.br\u{64}wn" should resolve to "property.brown".

To support this behavior, this commit changes the Token class to hold
both the evaluated identifier name and a view into the original source
for the unevaluated name. There are some contexts in which identifiers
are not allowed to contain Unicode escape sequences; for example, export
statements of the form "export {} from foo.js" forbid escapes in the
identifier "from".

The test file is added to .prettierignore because prettier will replace
all escaped Unicode sequences with their unescaped value.
2021-08-19 23:49:25 +02:00
Timothy Flynn
c5b5c779ff LibRegex+LibJS: Change capture group names from a String to a FlyString
The parser now stores this as a FlyString everywhere, so consumers can
also use it as a FlyString.
2021-08-19 23:49:25 +02:00
Timothy Flynn
4f2cbe119b LibRegex: Allow Unicode escape sequences in capture group names
Unfortunately, this requires a slight divergence in the way the capture
group names are stored. Previously, the generated byte code would simply
store a view into the regex pattern string, so no string copying was
required.

Now, the escape sequences are decoded into a new string, and a vector
of all parsed capture group names are stored in a vector in the parser
result structure. The byte code then stores a view into the
corresponding string in that vector.
2021-08-19 23:49:25 +02:00
Timothy Flynn
6131c0485e LibRegex: Use GenericLexer to consume escaped code points 2021-08-19 23:49:25 +02:00
Timothy Flynn
5ff9596678 LibRegex: Convert regex::Lexer to inherit from GenericLexer
This will allow regex::Lexer users to invoke GenericLexer consumption
methods, such as GenericLexer::consume_escaped_codepoint().

This also allows for de-duplicating common methods between the lexers.
2021-08-19 23:49:25 +02:00
Timothy Flynn
dd44a5e948 LibJS: Use GenericLexer to consume escaped code points 2021-08-19 23:49:25 +02:00
Timothy Flynn
02e3633b7f AK: Move FormatParser definition from header to implementation file
This is primarily to be able to remove the GenericLexer include out of
Format.h as well. A subsequent commit will add AK::Result to
GenericLexer, which will cause naming conflicts with other structures
named Result. This can be avoided (for now) by preventing nearly every
file in the system from implicitly including GenericLexer.

Other changes in this commit are to add the GenericLexer include to
files where it is missing.
2021-08-19 23:49:25 +02:00
Kenneth Myhra
3f5a42b3dd LibC: Add FNM_NOMATCH to fnmatch.h
Adding FNM_NOMATCH fixes the currently broken curl port.
2021-08-19 22:27:26 +02:00
fladd
1de104c6c4 LibCore: Fix build error in File.cpp on macOS
struct stat on macOS doesn't have st_atim.tv_sec and therefore broke the
Lagom build. Replacing it with st_atime fixes that.
2021-08-19 19:47:34 +01:00
Idan Horowitz
ee608f58ee LibJS: Add type range checks to the Date make_day AO
As the specification says "but if this is not possible (because some
argument is out of range), return NaN."
2021-08-19 19:15:00 +01:00
Idan Horowitz
95bc8e4641 LibCore: Make DateTime's members signed
Core::DateTime is essentially a C++ wrapper of the tm struct, so we
should support the same signed range as the underlying tm.
2021-08-19 19:15:00 +01:00
Andrew Kaster
332b29c741 LibTest+Utilities: Print a start message before each test in run-tests
It can sometimes be difficult to tell from the debug.log and test stdout
which test was the last to run before the test runner hangs or exits the
QEMU instance unexpectedly.

Print out a start message before each test is executed, along with a
progress message indicating which test out of how many tests we're about
to run.
2021-08-19 18:42:34 +02:00
Jesse Buhagiar
68d895eb7c LibGL: Don't crash on invalid pname value in glGetFloatv
This brings `glGetFloatv` more inline with the other `glGet`
functions. We should prevent crashing in the driver as much as
possible and instead let the application deal with the generated
GL error.
2021-08-19 17:08:04 +02:00
Linus Groh
0e201fbb42 LibJS: Implement Temporal.PlainDate.prototype.toJSON() 2021-08-19 00:26:09 +01:00
Linus Groh
73d888e9e6 LibJS: Implement Temporal.PlainDate.prototype.toLocaleString() 2021-08-19 00:23:48 +01:00
Linus Groh
402f04c2fc LibJS: Implement Temporal.PlainDate.prototype.toString() 2021-08-19 00:14:17 +02:00
Linus Groh
310192f918 LibJS: Make Temporal's get_option() take a PropertyName directly
Instead of constructing a String and converting that to a PropertyName
on the fly, we can just leverage CommonPropertyNames, add a couple more
and directly pass ready-to-use PropertyNames with pre-allocated Strings.
2021-08-19 00:14:17 +02:00
sin-ack
d8fd4eee9b LibGUI: Move common action definitions to CommonActions.cpp
This makes Action.cpp itself only talk about the Action object, and
makes it easier to navigate.
2021-08-19 00:11:42 +02:00
Linus Groh
092f924cfd LibJS: Reflect naming consistency editorial changes in the Temporal spec
See:

- https://github.com/tc39/proposal-temporal/commit/2aa7dce
- https://github.com/tc39/proposal-temporal/commit/13daa33
- https://github.com/tc39/proposal-temporal/commit/8085873
2021-08-18 23:03:22 +01:00