Commit graph

5433 commits

Author SHA1 Message Date
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
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
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
Gunnar Beutner
1fb4471506 LibRegex: Use a plain array to store opcodes
Using a hash map is unnecessary because the number of opcodes and their
IDs never change.
2021-06-14 16:09:58 +04:30
Andreas Kling
add3d6e9d7 LibGfx: Inline BitmapFont::glyph_or_emoji_width() for fixed-width fonts 2021-06-14 11:26:12 +02:00
Andreas Kling
6e0e8a8242 LibJS: Teach Reference to access call frame arguments directly 2021-06-14 11:26:12 +02:00
Andreas Kling
91fbeeab72 LibJS: Add LoadArgument bytecode instruction for fast argument access
This is generated for Identifier nodes that represent a function
argument variable. It loads a given argument index from the current
call frame into the accumulator.
2021-06-14 11:26:12 +02:00
Andreas Kling
848944113c LibJS: Access function arguments directly in AST interpreter
Instead of doing a generic scoped variable lookup, function arguments
now go directly to the call frame arguments list.

This is a huge speedup on everything that uses arguments. :^)
2021-06-14 11:26:12 +02:00
Andreas Kling
a733a30373 LibJS: Write computed function default arguments into the call frame
Previously, default argument values would only show up when accessing
the argument by parameter name. This patch makes us write them back
into the call frame so they can be accessed via VM::argument() as well.
2021-06-14 11:26:12 +02:00
Andreas Kling
481cef59b6 LibJS: Track which Identifier nodes refer to function arguments
This patch adds an "argument index" field to Identifier AST nodes.
If the Identifier refers to a function parameter in the currently
open function scope, we stash the index of the parameter here.

This will allow us to implement much faster direct access to function
argument variables.
2021-06-14 11:26:12 +02:00
davidot
ae8b55a80a LibJS: Add additional generic Array.prototype.slice tests 2021-06-14 09:57:06 +01:00
davidot
fc1168a3b3 LibJS: Add Array.prototype.@@unscopables 2021-06-14 09:57:06 +01:00
davidot
2d87d5dab9 LibJS: Make Array.prototype.at return undefined on empty slot 2021-06-14 09:57:06 +01:00
davidot
6c13cc67c6 LibJS: Implement Array.prototype.copyWithin generically 2021-06-14 09:57:06 +01:00
davidot
417f752306 LibJS: Implement Array.prototype.entries 2021-06-14 09:57:06 +01:00
davidot
910b803d8d LibJS: Implement Array.prototype.flatMap
Also made recursive_array_flat more compliant with the spec
So renamed it to flatten_into_array
2021-06-14 09:57:06 +01:00
davidot
4152409ac5 LibJS: Make Array.prototype.concat generic 2021-06-14 09:57:06 +01:00
davidot
2ef9df989f LibJS: Make Array.prototype.reverse generic 2021-06-14 09:57:06 +01:00
davidot
516f6240e8 LibJS: Add additional Array.prototype.reverse tests 2021-06-14 09:57:06 +01:00
davidot
d723c01af7 LibJS: Make Array.prototype.unshift generic 2021-06-14 09:57:06 +01:00
davidot
7c1e2adf8a LibJS: Make Array.prototype.shift generic 2021-06-14 09:57:06 +01:00
Idan Horowitz
690eb3bb8a LibJS: Add support for hex, octal & binary big integer literals 2021-06-14 01:45:04 +01:00
Idan Horowitz
2ad2e055e2 LibCrypto: Add {Signed,Unsigned}BigInteger::from_base{2, 8, 16} helpers
These can be used to create BigInteger instances from non-decimal
number strings.
2021-06-14 01:45:04 +01:00
Idan Horowitz
e4e6e03364 LibJS: Add tests for DataView.prototype getters and setters 2021-06-14 01:45:04 +01:00
Idan Horowitz
d7a70eb77c LibJS: Add all of the DataView.prototype.set* methods 2021-06-14 01:45:04 +01:00
Idan Horowitz
c54b9a6920 LibJS: Add all of the DataView.prototype.get* methods 2021-06-14 01:45:04 +01:00
Idan Horowitz
e4d267d4fb LibJS: Add the DataView built-in object 2021-06-14 01:45:04 +01:00
Linus Groh
5b2255291e LibJS: Make a couple of %TypedArray%.prototype properties accessors
Also use JS_DEFINE_NATIVE_GETTER and not JS_DEFINE_NATIVE_FUNCTION for
their function definitions.
2021-06-13 21:33:41 +01:00
Linus Groh
5c1af1d6f7 LibJS: Make Symbol.prototype.description an accessor 2021-06-13 21:33:41 +01:00