Commit graph

22011 commits

Author SHA1 Message Date
Andreas Kling cd12b182ca AK: Add FlyString::from_fly_impl()
This allows you to create a FlyString directly from a known-fly
StringImpl instance.
2021-06-13 19:11:29 +02:00
Andreas Kling 240d2f88d3 LibJS: Convert PropertyName and StringOrSymbol to east-const style 2021-06-13 19:11:29 +02:00
Andreas Kling b458090d14 LibJS: Don't generate unused HeapBlock names on non-SerenityOS systems
These are just ignored by the BlockAllocator anyway.
2021-06-13 19:11:29 +02:00
Andreas Kling 095accd2b2 LibJS: Add a bunch of fast_is<T> to avoid slow RTTI in hot code 2021-06-13 19:11:29 +02:00
Andreas Kling 39ad705c13 LibJS: Use the new is_ascii_foo() helpers from AK
These constexpr helpers generate nicer code than the LibC ctype.h
variants, so let's make use of them. :^)
2021-06-13 19:11:29 +02:00
Gunnar Beutner d476144565 Userland: Allow building SerenityOS with -funsigned-char
Some of the code assumed that chars were always signed while that is
not the case on ARM hosts.

Also, some of the code tried to use EOF (-1) in a way similar to what
fgetc() does, however instead of storing the characters in an int
variable a char was used.

While this seemed to work it also meant that character 0xFF would be
incorrectly seen as an end-of-file.

Careful reading of fgetc() reveals that fgetc() stores character
data in an int where valid characters are in the range of 0-255 and
the EOF value is explicitly outside of that range (usually -1).
2021-06-13 18:52:58 +02:00
Adam Hodgen 6ab48d612a Documentation: Move Ubuntu/Debian specific build instructions
Ubuntu/Debian specific instructions should live under the
Ubuntu/Debian header
2021-06-13 17:16:03 +01:00
Adam Hodgen 9bc0017499 Documentation: Fix QEMU 5 Ubuntu version confusion
PR #7970 added a line clarifying the requirement for QEMU 5.
Unfortunately, this location this line was added changed the meaning
of the following line, referencing the availability of GCC in Ubuntu
20.04.

QEMU 5 is not available in Ubuntu 20.04, so this change is incorrect,
as well as misleading.
2021-06-13 17:16:03 +01:00
Jelle Raaijmakers ba7e025320 Ports: Add Composer 2021-06-13 17:06:45 +01:00
Jelle Raaijmakers 3fa5b27931 Utilites: Implement unzip -q 2021-06-13 17:05:48 +01:00
Jelle Raaijmakers c247d7a662 Utilities: Change unzip -o option to -d
Other `unzip` implementations universally use `-d` to indicate the
output directory, so let's follow this convention.
2021-06-13 17:05:48 +01:00
Jelle Raaijmakers ed62fc9a43 Ports: Update diffutils to version 3.7 2021-06-13 17:05:03 +01:00
Jelle Raaijmakers 10e8b99038 LibC: Make getopt modify argv again
A POSIX-compatibility fix was introduced in 64740a0214 to make the
compilation of the `diffutils` port work, which expected a
`char* const* argv` signature.

And indeed, the POSIX spec does not mention permutation of `argv`:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html

However, most implementations do modify `argv` as evidenced by
documentation such as:
https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic
    /LSB-Core-generic/libutil-getopt-3.html

  "The function prototype was aligned with POSIX 1003.1-2008 (ISO/IEC
   9945-2009) despite the fact that it modifies argv, and the library
   maintainers are unwilling to change this."

Change the behavior back to permutate `argc` to allow for the following
command line argument order to work again:

  unzip ./file.zip -o target-dir

Without this change, `./file.zip` in the example above would have been
ignored completely.
2021-06-13 17:05:03 +01:00
Luke d72aeb2e1a LibJS: Rewrite Array.prototype.slice to be spec compliant
This makes it generic in the process (which is required by jQuery)
This fixes 19 test262 test cases :^)
2021-06-13 16:21:34 +01:00
sinmineryt 2e1a01a499
TextEditor: Don't allow opening directories
Previously it was possible to open a directory in the TextEditor
application. Like device files, these are now rejected with an error
message.
2021-06-13 12:38:07 +01:00
Dmitrii Ubskii d5828dbecb HackStudio: Indicate git changes in the editor's gutter
"+" for added lines, "!" for changed, "-" for removed.
2021-06-13 12:33:15 +01:00
Dmitrii Ubskii 8501617fcb LibGUI+HackStudio: Make gutter a first class element
Gutter -- a space left of the text, before the ruler -- is not a part of
the ruler, nor should it be treated as such. This commit implements
gutter handling in LibGUI::TextEditor as part of mild cleaning up of the
gutter handling (breakpoint icons) in HackStudio's Editor.

This commit also enables separate theming of the gutter.
2021-06-13 12:33:15 +01:00
Linus Groh 920b4d730e
LibJS: Add missing ECMA-262 section/title/URL comments to Map 2021-06-13 12:20:21 +01:00
Apoorv Mishra f32ab73acc
Meta: Fix QEMU version check in run.sh
The QEMU version check in `Meta/run.sh` fails on macOS because the BSD
version of `grep` does not support the `-P` option. Using `sed` instead.
2021-06-13 12:05:48 +01:00
Gunnar Beutner 1fd547bf0b IPCCompiler: Avoid copies for IPC method return values
Fixes #8017.
2021-06-13 10:33:09 +02:00
Linus Groh 33eea1f722 LibJS: Fix Object.prototype.valueOf() behavior
No idea why it was implemented like this, but a value_of() call on the
coerced object is not part of the spec. Also added some tests.
2021-06-13 01:06:36 +01:00
Linus Groh 1253a3d038 LibJS: VERIFY() that to_object() succeeds in Object.prototype.toString()
As null and undefined are already handled separately, this must not
fail.
2021-06-13 01:03:41 +01:00
Linus Groh 4794e6b0da LibJS: Fix Promise.length attributes
This was missing an 'Attribute::Configurable' and falling back to the
default attributes.
2021-06-13 01:01:27 +01:00
Linus Groh a40e5b579a LibJS: Fix Number.parseFloat() attributes
This was missing an 'attr' and falling back to the default attributes.
2021-06-13 00:59:33 +01:00
Linus Groh 8d1e6e9175 LibJS: Don't repeat attributes in {Date,Symbol}Constructor 2021-06-13 00:58:25 +01:00
Linus Groh 7327a28ccc LibJS: Add ECMA-262 section/title/URL comments almost everywhere
As mentioned on Discord earlier, we'll add these to all new functions
going forward - this is the backfill. Reasons:

- It makes you look at the spec, implementing based on MDN or V8
  behavior is a no-go
- It makes finding the various functions that are non-compliant easier,
  in the future everything should either have such a comment or, if it's
  not from the spec at all, a comment explaining why that is the case
- It makes it easier to check whether a certain abstract operation is
  implemented in LibJS, not all of them use the same name as the spec.
  E.g. RejectPromise() is Promise::reject()
- It makes it easier to reason about vm.arguments(), e.g. when the
  function has a rest parameter
- It makes it easier to see whether a certain function is from a
  proposal or Annex B

Also:

- Add arguments to all functions and abstract operations that already
  had a comment
- Fix some outdated section numbers
- Replace some ecma-international.org URLs with tc39.es
2021-06-13 00:33:28 +01:00
Idan Horowitz 322c8a3995 LibJS: Add the MapIterator built-in and the key/values/entries methods
While this implementation should be complete it is based on HashMap's
iterator, which currently follows bucket-order instead of the required
insertion order. This can be simply fixed by replacing the underlying
HashMap member in Map with an enhanced one that maintains a linked
list in insertion order.
2021-06-13 00:33:18 +01:00
Idan Horowitz 6c0d5163a1 LibJS: Add most of the Map.prototype methods
Specifically all aside from "keys", "values" and "entries" which
require an implementation of the MapIterator object.
2021-06-13 00:33:18 +01:00
Idan Horowitz a96ac8bd56 LibJS: Add the Map built-in object 2021-06-13 00:33:18 +01:00
Idan Horowitz f9d58ec0b4 LibJS: Move ValueTraits to Value.h and add special case for -0.0
This will allow us to use these traits for other hash-based containers
(like Map). This commit also adds a special case for negative zero
values, because while the equality check used same_value_zero which is
negative/positive zero insensitive, the hash was not.
2021-06-13 00:33:18 +01:00
Idan Horowitz 3c83298a26 LibJS: Use undefined as the fallback value for iterable entry key/value
As defined in OdinaryGet in the specification.
2021-06-12 22:34:28 +01:00
Gal Horowitz c0e04768e0
Base: Change incorrect "See Also" links in module_load(2) and modunload(8) (#8006) 2021-06-12 23:08:29 +02:00
Sreelakshmi aa68c12cfc WindowManager: Close tooltip child_windows of previously active window
This closes the autocomplete_box used in applications like GML
Playground and HackStudio when the user switches focus to a new window.
2021-06-12 23:54:08 +04:30
Sreelakshmi a471af4ae1 TextEditor: Don't close autocomplete box or stop timer on leave_event
The autocomplete box closes on its own when the user tries to hover
over it because text_editor consideres hovering over the box to be
a leave_event. This commit stops that from happening.
2021-06-12 23:54:08 +04:30
Sahan Fernando 6fb08f20e3 LibC: Expose PAGE_ROUND_UP in mallocdefs.h 2021-06-12 22:50:40 +04:30
NonStdModel c93f73c617 HackStudio: Remove unnecessary unveil in ShellLanguageServer
Remove unveil on / with only browse permissions. Unveil will be sealed
later when the root path of project is known.
2021-06-12 22:49:20 +04:30
FalseHonesty fa101d6bf6 VideoPlayer: Create application to parse (and eventually play) videos
This application will eventually be able to actually play videos, but
for now it is used to parse and dump decoded data from the VP9 decoder.
2021-06-12 22:48:28 +04:30
FalseHonesty baff94e44d LibVideo/VP9: Add Decoder and begin parsing uncompressed header data
This patch brings all of the previous work together and starts to
actually parse and decode frame information. Currently it only parses
the uncompressed header data (section 6.2 of the spec).
2021-06-12 22:48:28 +04:30
FalseHonesty 2e31b9cf7c LibVideo/VP9: Implement a bit stream to decode VP9 data
The VP9 specification requires a special decoding process to parse a
lot of the data read from a frame, so this BitStream wrapper implements
that behavior. These processes are defined in section 9 of the
VP9 spec.
2021-06-12 22:48:28 +04:30
FalseHonesty 18759ff56d LibVideo/VP9: Implement syntax element counter 2021-06-12 22:48:28 +04:30
FalseHonesty 8dd9d1bbdb LibVideo/VP9: Add probability table constants
This patch adds VP9's probability tables and the functions needed
to load/clear them.
2021-06-12 22:48:28 +04:30
FalseHonesty ff3a2a703f LibVideo/VP9: Define all VP9 symbols and enum constants 2021-06-12 22:48:28 +04:30
Matthew Olsson 612b183703 LibPDF: Convert to east-const to comply with the recent style changes 2021-06-12 22:45:01 +04:30
Matthew Olsson 0a4d8ef98d LibPDF: Bake the flipped y-axis directly into the CTM matrix 2021-06-12 22:45:01 +04:30
Matthew Olsson 449ef14895 LibPDF: Avoid calculating rendering matrix for every glyph 2021-06-12 22:45:01 +04:30
Matthew Olsson c142dadbe8 LibPDF: Handle the TJ graphical operator 2021-06-12 22:45:01 +04:30
Matthew Olsson 47531619e3 LibPDF: Handle the gs graphical operator 2021-06-12 22:45:01 +04:30
Matthew Olsson 006f5498de LibPDF: Add support for the CalRGB ColorSpace
This isn't tested all that well, as the PDF I am testing with only uses
it for black (which is trivial). It can be tested further when LibPDF
is able to process more complex PDFs that actually use this color space
non-trivially.
2021-06-12 22:45:01 +04:30
Matthew Olsson 7b4e36bf88 LibPDF: Split ColorSpace into a different class for each color space
While unnecessary at the moment, this will allow for more fine-grained
control when complex color spaces get added.
2021-06-12 22:45:01 +04:30
Matthew Olsson ea3abb14fe LibPDF: Parse hint tables
This code isn't _actually_ used as of right now, but I wrote it at the
same time as all of the code in the previous commit. I realized after
I wrote it that these hint tables aren't super useful if the parser
already has access to the full file. However, this will be useful if
we ever want to stream PDFs from the web (and possibly view them in
the browser).
2021-06-12 22:45:01 +04:30