summaryrefslogtreecommitdiff
path: root/Meta/Lagom
AgeCommit message (Collapse)Author
2022-07-12Meta+Userland: Simplify some formatterssin-ack
These are mostly minor mistakes I've encountered while working on the removal of StringView(char const*). The usage of builder.put_string over Format<FormatString>::format is preferrable as it will avoid the indirection altogether when there's no formatting to be done. Similarly, there is no need to do format(builder, "{}", number) when builder.put_u64(number) works equally well. Additionally a few Strings where only constant strings were used are replaced with StringViews.
2022-07-12LibUnicode: Parse and generate per-locale plural rangesTimothy Flynn
2022-07-11LibWeb/IDL: Add support for optional sequencesLuke Wilde
2022-07-08LibUnicode: Replace NumberFormat::Plurality with Unicode::PluralCategoryTimothy Flynn
To prepare for using plural rules within number & duration format, this removes the NumberFormat::Plurality enumeration. This also adds PluralCategory::ExactlyZero & PluralCategory::ExactlyOne. These are used in locales like French, where PluralCategory::One really means any value from 0.00 to 1.99. PluralCategory::ExactlyOne means only the value 1, as the name implies. These exact rules are not known by the general plural rules, they are explicitly for number / currency format.
2022-07-08LibJS+LibUnicode: Do not generate the PluralCategory enumTimothy Flynn
The PluralCategory enum is currently generated for plural rules. Instead of generating it, this moves the enum to the public LibUnicode header. While it was nice to auto-discover these values, they are well defined by TR-35, and we will need their values from within the number format code generator (which can't rely on the plural rules generator having run yet). Further, number format will require additional values in the enum that plural rules doesn't know about.
2022-07-08LibWeb: Add URLSearchParams as part of union type for XHR::send()Kenneth Myhra
This patch adds support for URLSearchParams to XHR::send() and introduces the union type XMLHttpRequestBodyInit. XHR::send() now has support for String and URLSearchParams.
2022-07-08LibJS: Use Intl.PluralRules within Intl.RelativeFormatTimothy Flynn
The Polish test cases added here cover previous failures from test262, due to the way that 0 is specified to be "many" in Polish.
2022-07-08LibUnicode: Generate a list of available plural categories per localeTimothy Flynn
Separate lists are generated for cardinal and ordinal form.
2022-07-08LibUnicode: Parse and generate per-locale plural rules from the CLDRTimothy Flynn
Plural rules in the CLDR are of the form: "cs": { "pluralRule-count-one": "i = 1 and v = 0 @integer 1", "pluralRule-count-few": "i = 2..4 and v = 0 @integer 2~4", "pluralRule-count-many": "v != 0 @decimal 0.0~1.5, 10.0, 100.0 ...", "pluralRule-count-other": "@integer 0, 5~19, 100, 1000, 10000 ..." } The syntax is described here: https://unicode.org/reports/tr35/tr35-numbers.html#Plural_rules_syntax There are up to 2 sets of rules for each locale, a cardinal set and an ordinal set. The approach here is to generate a C++ function for each set of rules. Each condition in the rules (e.g. "i = 1 and v = 0") is transpiled to a C++ if-statement within its function. Then lookup tables are generated to match locales to their generated functions. NOTE: -Wno-parentheses-equality is added to the LibUnicodeData compile flags because the generated plural rules have lots of extra parentheses (because e.g. we need to selectively negate and combine rules). The code to generate only exactly the right number of parentheses is quite hairy, so this just tells the compiler to ignore the extras.
2022-07-06LibUnicode: Generate per-region week dataTimothy Flynn
This includes: * The minimum number of days in a week for that week to count as the first week of a new year. * The day to be shown as the first day of the week in a calendar. * The start/end days of the weekend. Like the existing hour cycle data, week data is presented per-region in the CLDR, rather than per-locale. The method to add likely subtags to a locale to perform region lookups is the same. The list of regions in the CLDR for hour cycle, minimum days, first day, and weekend days are quite different. So rather than changing the existing HourCycleRegion enum to a generic Region enum, we generate separate enums for each of the week data fields. This allows each lookup into these fields to remain simple array-based index access, without any "jumps" for regions that don't have CLDR data for a field.
2022-07-06LibUnicode: Generate per-locale text layout informationTimothy Flynn
Currently contains just each locale's character order, but is set up to easily add other text layout fields from the CLDR if ECMA-402 eventually requires them.
2022-07-06LibTimeZone: Parse and generate a list of time zones used by regionTimothy Flynn
The zone1970.tab file in the TZDB contains regional time zone data, some of which we already parse for the system time zone settings map. This parses the region names from that file and generates a list of time zones which are used in each of those regions.
2022-07-06Meta: Build select Services in LagomAndrew Kaster
Add overrides for serenity_bin and serenity_lib to allow the actual CMakeLists.txt from Userland to be used to build as many services as possible without adding more clutter to Meta/Lagom/CMakeLists.txt
2022-07-06Meta: Rename Lagom library target names from LagomFoo to LibFooAndrew Kaster
This matches the target names for the main serenity build, and will make simplifying the Lagom build much easier going forward. The LagomFoo name came from a time when we had both library builds in the same CMake generated project and needed to deconflict the names.
2022-07-06LibWeb: Replace all uses of -'s and ::'s when running the IDL generatorDexesTTP
These were obvious wrong uses of the old default "only first occurence" parameter that was used in String::replace.
2022-07-06AK: Use an enum instead of a bool for String::replace(all_occurences)DexesTTP
This commit has no behavior changes. In particular, this does not fix any of the wrong uses of the previous default parameter (which used to be 'false', meaning "only replace the first occurence in the string"). It simply replaces the default uses by String::replace(..., ReplaceMode::FirstOnly), leaving them incorrect.
2022-07-05LibWeb: Implement XMLSerializerLuke Wilde
The main thing that is missing is validating certain pieces of data against XML productions in well-formed mode, but nothing uses well-formed mode right now. Required by Closure Library for sanitising HTML. https://github.com/google/closure-library/blob/e687b3d8ab014787b9f10b08b3f597b637392480/closure/goog/html/sanitizer/safedomtreeprocessor.js#L117
2022-07-01LibUnicode: Generate data about DurationFormat-required units as wellIdan Horowitz
2022-07-01LibUnicode: Extract the timeSeparator numeric symbol from CLDRIdan Horowitz
This will be used by Intl.DurationFormat
2022-06-29LibWeb: Return instead of throwing on unknown enums in attribute settersLuke Wilde
I saw one site relying on this, where they are trying to set XHR.responseType to "text/plain", which is not a valid responseType. However, they also don't expect it to throw. The IDL spec special cases enumerations to make it return instead of throwing in this case.
2022-06-13LibWeb: Add the ability to retrieve a WebGL context from getContextLuke Wilde
2022-06-13LibWeb: Introduce the WebGL namespace and add WebGLContextEventLuke Wilde
2022-06-13LibWeb/IDL: Add support for returning JS::Object from IDL functionsLuke Wilde
2022-06-13LibWeb/IDL: Make inner type of typedef inherit nullable attributeLuke Wilde
2022-06-13LibWeb/IDL: Add support for returning nullable sequence typesLuke Wilde
2022-06-13LibWeb/IDL: Add support for optional enumsLuke Wilde
2022-06-13LibWeb/IDL: Add support for returning dictionariesLuke Wilde
2022-06-13LibWeb/IDL: Always throw an error if string does not match an enum valueLuke Wilde
Previously we only threw an error if the enum was used as a function argument. However, we are supposed to throw an error no matter the context it is used in.
2022-06-13LibWeb/IDL: Respect type of IDL constantsLuke Wilde
Previously we ignored the type and cast the value to i32 and then put it into a JS::Value.
2022-06-13LibWeb/IDL: Implement returning union types from IDL functionsLuke Wilde
2022-06-06LibWeb: Teach IDLParser about `long long`stelar7
2022-05-30Lagom/Fuzzers: Add CSS parser fuzzerLuke Wilde
2022-05-30Lagom/Fuzzers: Add XML parser fuzzerLuke Wilde
2022-05-29Lagom: Compile headless-browser on Lagom :^)DexesTTP
2022-05-29Lagom: Build LibWeb on LagomDexesTTP
2022-05-29Lagom: Disable the unused-private-field warning on Lagom's clang buildsDexesTTP
With the compilation of LibWeb, there's now quite a few cases where this warning gets triggered. Rather than trying to fix them all right away, we simply disable the warning for now. This workaround was proposed by Andrew Kaster and BertalanD who promised to open an issue about it!
2022-05-29Lagom: Compile LibWebSocket on LagomDexesTTP
2022-05-29Lagom: Compile all sources of LibGfxDexesTTP
The filters were missing from the compiled sources.
2022-05-25Lagom: Fix leaks in the IDL Wrapper generatorDexesTTP
By using RefPtrs to handle interfaces, the IDL parser could store cyclic references to interfaces that import each other. One main example is the "EventTarget.idl" and the "AbortSignal.idl" files, which both reference each other. This caused huge amounts of memory not to be freed on exit. To fix this, the parsed IDL interfaces are now stored in a HashTable of NonnullOwnPtr<Interface>, which serves as the sole reference for every parsed interface. All other usages of the Interface are changed to use references instead of RefPtrs, or occasionally as raw pointers where references don't fit inside the data structures. This new HashTable is static, and as such will automatically be freed prior to exiting the generator. This ensures that the code generator properly cleans up after itself. With this change, The IDL code generators can properly run on Lagom when compiled with the -DENABLE_ADDRESS_SANITIZER=ON flag, and gets compiled properly on the CI :^)
2022-05-23Meta+Userland: Add jakt as an optional Lagom ToolAndrew Kaster
We can now use ENABLE_JAKT to pull jakt as a host tool and use it to pre-process .jakt files into .cpp files for use in serenity applications
2022-05-21Meta: Add Brotli fuzzerMichiel Visser
2022-05-21LibCompress: Implement Brotli decompressorMichiel Visser
This implements the BrotliDecompressionStream, which is a Core::Stream that can decompress another Core::Stream.
2022-05-14Meta: Move compiler flags into standalone CMake filesLinus Groh
This way we can have all of them in a single place, similar to how we structure options added via the serenity_option() macro.
2022-04-21LibAudio+Userland: Use new audio queue in client-server communicationkleines Filmröllchen
Previously, we were sending Buffers to the server whenever we had new audio data for it. This meant that for every audio enqueue action, we needed to create a new shared memory anonymous buffer, send that buffer's file descriptor over IPC (+recfd on the other side) and then map the buffer into the audio server's memory to be able to play it. This was fine for sending large chunks of audio data, like when playing existing audio files. However, in the future we want to move to real-time audio in some applications like Piano. This means that the size of buffers that are sent need to be very small, as just the size of a buffer itself is part of the audio latency. If we were to try real-time audio with the existing system, we would run into problems really quickly. Dealing with a continuous stream of new anonymous files like the current audio system is rather expensive, as we need Kernel help in multiple places. Additionally, every enqueue incurs an IPC call, which are not optimized for >1000 calls/second (which would be needed for real-time audio with buffer sizes of ~40 samples). So a fundamental change in how we handle audio sending in userspace is necessary. This commit moves the audio sending system onto a shared single producer circular queue (SSPCQ) (introduced with one of the previous commits). This queue is intended to live in shared memory and be accessed by multiple processes at the same time. It was specifically written to support the audio sending case, so e.g. it only supports a single producer (the audio client). Now, audio sending follows these general steps: - The audio client connects to the audio server. - The audio client creates a SSPCQ in shared memory. - The audio client sends the SSPCQ's file descriptor to the audio server with the set_buffer() IPC call. - The audio server receives the SSPCQ and maps it. - The audio client signals start of playback with start_playback(). - At the same time: - The audio client writes its audio data into the shared-memory queue. - The audio server reads audio data from the shared-memory queue(s). Both sides have additional before-queue/after-queue buffers, depending on the exact application. - Pausing playback is just an IPC call, nothing happens to the buffer except that the server stops reading from it until playback is resumed. - Muting has nothing to do with whether audio data is read or not. - When the connection closes, the queues are unmapped on both sides. This should already improve audio playback performance in a bunch of places. Implementation & commit notes: - Audio loaders don't create LegacyBuffers anymore. LegacyBuffer is kept for WavLoader, see previous commit message. - Most intra-process audio data passing is done with FixedArray<Sample> or Vector<Sample>. - Improvements to most audio-enqueuing applications. (If necessary I can try to extract some of the aplay improvements.) - New APIs on LibAudio/ClientConnection which allows non-realtime applications to enqueue audio in big chunks like before. - Removal of status APIs from the audio server connection for information that can be directly obtained from the shared queue. - Split the pause playback API into two APIs with more intuitive names. I know this is a large commit, and you can kinda tell from the commit message. It's basically impossible to break this up without hacks, so please forgive me. These are some of the best changes to the audio subsystem and I hope that that makes up for this :yaktangle: commit. :yakring:
2022-04-18LibWeb: Generate some metadata about transform functionsSam Atkins
This will be used to parse and validate their parameters.
2022-04-18LibWeb: Generate TransformFunction to/from string functionsSam Atkins
2022-04-18LibWeb: Add code generator for CSS transform functionsSam Atkins
This first step just generates the TransformFunction enum, but more will follow.
2022-04-17Tests: Implement reference image testing for LibGLJelle Raaijmakers
Each LibGL test can now be tested against a reference QOI image. Initially, these images can be generated by setting `SAVE_OUTPUT` to `true`, which will save a bunch of QOI images to `/home/anon`.
2022-04-16LibCore+Everywhere: Make Core::Stream read_line() return StringViewSam Atkins
Similar reasoning to making Core::Stream::read() return Bytes, except that every user of read_line() creates a StringView from the result, so let's just return one right away.
2022-04-16LibCore+Everywhere: Make Core::Stream::read() return BytesSam Atkins
A mistake I've repeatedly made is along these lines: ```c++ auto nread = TRY(source_file->read(buffer)); TRY(destination_file->write(buffer)); ``` It's a little clunky to have to create a Bytes or StringView from the buffer's data pointer and the nread, and easy to forget and just use the buffer. So, this patch changes the read() function to return a Bytes of the data that were just read. The other read_foo() methods will be modified in the same way in subsequent commits. Fixes #13687