Commit graph

22107 commits

Author SHA1 Message Date
Idan Horowitz f1f00be691 AK: Add a missing using AK::OrderedHashMap statement 2021-06-15 23:51:20 +01:00
Hediadyoin1 4a81c79909 AK: Add Ordering support to HashTable and HashMap
Adds a IsOrdered flag to Hashtable and HashMap, which allows iteration
in insertion order
2021-06-15 22:16:55 +02:00
Valtteri Koskivuori c69ea44397 Userland: Teach the file utility that empty files also exist
Previously, empty files with no identifiable file type extension would
show up as `text/plain`. This fixes it up to show empty files as what
they really are - full of nothing.
2021-06-15 21:30:55 +02:00
Ali Mohammad Pur 1414c7b049 LibJS: Add a basic pass manager and add some basic passes
This commit adds a bunch of passes, the most interesting of which is a
pass that merges blocks together, and a pass that places blocks that
flow into each other next to each other, and a very simply pass that
removes duplicate basic blocks.
Note that this does not remove the jump at the end of each block in that
pass to avoid scope creep in the passes.
2021-06-15 22:06:33 +04:30
Ali Mohammad Pur e81fd7106b LibJS: Rename the overridden Instruction methods to foo_impl
These are pretty hairy if someone forgets to override one, as the
catchall function in Instruction will keep calling itself over and over
again, leading to really hard-to-debug situations.
2021-06-15 22:06:33 +04:30
Ali Mohammad Pur 4c7c7c38e2 LibJS: Make EnterUnwindContext a terminator op
Otherwise a basic block could have multiple outgoing edges without
having much reason to do so.
2021-06-15 22:06:33 +04:30
Ali Mohammad Pur e73b142a97 LibJS: Make basic block size customizable
And keep the default 4 KiB for the code generator.
2021-06-15 22:06:33 +04:30
Ali Mohammad Pur f7f88adc78 AK: Add a function that casts an enum to its underlying type
This is basically the same thing as `std::to_underlying(Enum)`.
2021-06-15 22:06:33 +04:30
Idan Horowitz dac971b4ae LibJS: Store and return undefined Symbol description
Instead of the current incorrect behaviour of just defaulting to an
empty string.
2021-06-15 18:31:52 +01:00
Mateusz Górzyński 4aff4249aa PixelPaint: Alternate selection outline between black and white 2021-06-15 16:15:09 +02:00
Aatos Majava 7597cca5c6 LibTextCodec: Add ISO-8859-15 (aka Latin-9) encoding 2021-06-15 15:12:09 +01:00
Luke 155f1026ce Kernel/AHCI: Don't set the C command header attribute
This has a quirk with the AMD Hudson-2 SATA controller. [1022:7801]
Having this flag set makes the controller become stuck in a busy loop.

I decided to remove the flag instead of making it a quirk as it still
works with Qemu, VirtualBox, VMware Player and the Intel Wildcat
Point-LP SATA Controller [8086:9c83] without it, thus making it simpler
to just remove it.

Partial fix for #7738 (as it still does not work in IDE mode)
2021-06-15 14:43:22 +02:00
Andreas Kling a1eadc755d LibGUI: Allow tweaking each edge of TabWidget's content margins
Instead of having a single uniform margin around the child content of
a TabWidget, use a GUI::Margins to allow individual per-edge margins.
2021-06-15 14:28:39 +02:00
Andreas Kling 46a7e1b372 LibGUI: Make a macro for registering a GUI::Margins object property
This will allow anyone to register a margins property without having
to duplicate the parsing logic.
2021-06-15 14:27:48 +02:00
Andreas Kling f20c5e1872 LibJS: Use Optional<String> in StringPrototype 2021-06-15 13:54:41 +02:00
Andreas Kling bbf653c425 LibWeb: Use Optional<String> more in WrapperGenerator 2021-06-15 13:38:43 +02:00
Andreas Kling 2052796947 PixelPaint: Clear selection when opening a new image 2021-06-15 13:38:43 +02:00
Andreas Kling 91100f2f94 PixelPaint: Display an error message if exporting to PNG/BMP fails 2021-06-15 13:38:43 +02:00
Idan Horowitz ba807c2d44 LibJS: Call toString on the key, not on the argument in ToPropertyKey
As required by the specification:
https://tc39.es/ecma262/#sec-topropertykey
2021-06-15 12:15:18 +01:00
Idan Horowitz 9a0cbcc3d1 LibJS: Add the Object.fromEntries method 2021-06-15 12:15:18 +01:00
Idan Horowitz 2100b46d02 LibJS: Implement the IteratorClose abstract op and use it where needed 2021-06-15 12:15:12 +01:00
Andreas Kling 3e4b48f68e PixelPaint: Avoid unnecessary temporary layer bitmaps during PP load
When opening a PP file, we were creating a layer first with an empty
bitmap, and then replacing it with the loaded bitmap from the file.

This patch reorders things so we never create the empty bitmap in
between, saving time and avoiding a memory spike.
2021-06-15 10:05:50 +02:00
Andreas Kling 398bf045c6 PixelPaint: Increase default size of new images from 1x1 to 480x360 2021-06-15 10:05:16 +02:00
Andreas Kling eb76b18ee3 PixelPaint: Don't allow creating empty layers or images 2021-06-15 10:05:16 +02:00
Andreas Kling 8731bc9ead PixelPaint: Display an error message if opening a file fails 2021-06-15 10:05:16 +02:00
Andreas Kling c333aec9f3 PixelPaint: Display an error message if saving to PP file fails 2021-06-15 01:16:34 +02:00
Andreas Kling fa7bb98b1e PixelPaint: No need to pass ImageEditor& to Selection::paint()
It already has a reference to the editor in m_editor.
2021-06-15 01:16:34 +02:00
LepkoQQ e6f27cec39 PixelPaint: Add actions to swap colors or reset them to default values 2021-06-15 00:13:03 +02:00
LepkoQQ db99e0917c PixelPaint: Add menu items for Select All and Clear Selection
We also need to update the image editor when clearing selection
otherwise the last state of the selection will be displayed until an
update happens.
2021-06-15 00:13:03 +02:00
networkException 472721b774 Everywhere: Use new discord invite url :^)
Replaces all instances of the previous discord invite link
with a shiny new vanity url.
2021-06-14 22:41:37 +01:00
Andreas Kling 068ca3a394 PixelPaint: Always animate marching ants during interactive selection
The Selection object now tracks whether there is an ongoing interactive
selection (originating from one of the selection tools). If so it makes
sure to pump the marching ants animation.
2021-06-14 18:25:17 +02:00
Andreas Kling f54164e8ae PixelPaint: Make new pasted layer active immediately
Also clear any selection that existed before pasting. This feels a bit
more intuitive. We may also want to consider switching to the "Move"
tool automatically on paste, but I'm less sure about that.
2021-06-14 18:25:17 +02:00
Andreas Kling 765286f691 PixelPaint: Add copy action (copies the selection from active layer)
You can now select a part of a layer, copy it, and then paste it as
a new layer. Very cool :^)
2021-06-14 18:25:17 +02:00
Andreas Kling 4cecd79000 PixelPaint: Draw the current editor selection as marching ants
This patch moves the marching ants painting code to Selection and
unifies the timer mechanism so that all marching ants are synchronized
which looks neat. :^)
2021-06-14 18:25:17 +02:00
Andreas Kling 1b897ec561 PixelPaint: Add a Selection class (ImageEditor has a Selection)
This will represent a complex, region-based selection in the future.
For now though, it's just a simple rectangle. :^)
2021-06-14 18:25:17 +02:00
Andreas Kling 96b52f13e4 PixelPaint: Implement basic rectangular selection (preview only)
Using the rectangle select tool, you can now drag out a selection which
will be drawn in the form of "marching ants" :^)
2021-06-14 18:25:17 +02:00
Andreas Kling 4bd905de0e PixelPaint: Add a new "Rectangle Select" tool :^)
This patch only adds the tool along with a toolbar icon for it.
It doesn't do anything yet.
2021-06-14 18:25:17 +02:00
Jelle Raaijmakers ab840423a8 Kernel: Verify Process coredump threads are empty 2021-06-14 16:27:37 +02:00
Jelle Raaijmakers 5b03b62518 Kernel: Only call Process::die() once on terminating signal
Previously, when e.g. the `SIGABRT` signal was sent to a process,
`Thread::dispatch_signal()` would invoke
`Process::terminate_due_to_signal()` which would then `::die()`. The
result `DispatchSignalResult::Terminate` is then returned to
`Thread::check_dispatch_pending_signal()` which proceeds to invoke
`Process::die()` a second time.

Change the behavior of `::check_dispatch_pending_signal()` to no longer
call `Process::die()` if it receives `::Terminate` as a signal handling
result, since that indicates that the process was already terminated.

This fixes #7289.
2021-06-14 16:27:37 +02:00
Sahan Fernando 7ee73b3721 Userland: Fix double line spacing in grep 2021-06-14 16:27:02 +02:00
Ali Mohammad Pur 3194177dce LibJS: Correctly parse yield-from expressions
This commit implements parsing for `yield *expr`, and the multiple
ways something can or can't be parsed like that.
Also makes yield-from a TODO in the bytecode generator.
Behold, the glory of javascript syntax:
```js
// 'yield' = expression in generators.
function* foo() {
    yield
    *bar; // <- Syntax error here, expression can't start with *
}

// 'yield' = identifier anywhere else.
function foo() {
    yield
    *bar; // Perfectly fine, this is just `yield * bar`
}
```
2021-06-14 13:06:08 +01:00
Ali Mohammad Pur d374295a26 LibJS: Parse generator functions in object literals
Also add some parser tests
2021-06-14 13:06:08 +01:00
Ali Mohammad Pur 2661a88108 LibJS: Add a test file for generator function parsing
Note that the yield-from expression tests are skipped for now since
they're not implemented yet.
2021-06-14 13:06:08 +01:00
Gunnar Beutner 5bfe601152 LibRegex: Remove unused code 2021-06-14 16:09:58 +04:30
Gunnar Beutner a167941852 LibRegex: Use a plain pointer for OpCode::m_state 2021-06-14 16:09:58 +04:30
Gunnar Beutner d3c2a3caea LibRegex: Avoid initialization checks in get_opcode_by_id() 2021-06-14 16:09:58 +04:30
Gunnar Beutner 794dc368f1 LibRegex: Avoid prepending items to vectors 2021-06-14 16:09:58 +04:30
Gunnar Beutner 214410b397 LibRegex: Avoid making unnecessary string copies 2021-06-14 16:09:58 +04:30
Gunnar Beutner 281f39073d LibRegex: Make get_opcode() return a reference
Previously this would return a pointer which could be null if the
requested opcode was invalid. This should never be the case though
so let's VERIFY() that instead.
2021-06-14 16:09:58 +04:30
Gunnar Beutner cd49fb0229 LibRegex: Remove return value for setters 2021-06-14 16:09:58 +04:30