Commit graph

8861 commits

Author SHA1 Message Date
Linus Groh
a1b820b11c LibJS: Improve UpdateExpression::execute()
- Let undefined variables throw a ReferenceError by using
  Identifier::execute() rather than doing variable lookup manually and
  ASSERT()ing
- Coerce value to number rather than ASSERT()ing
- Make code DRY
- Add tests
2020-04-22 13:09:59 +02:00
Kesse Jones
b2305cb67d LibJS: Add Array.prototype.lastIndexOf 2020-04-22 13:08:00 +02:00
AnotherTest
1a7af4d677 LibLine: Do not ignore ^C and do not finish() after interrupt 2020-04-22 12:12:41 +02:00
angel
451b3fa73c LibGUI: Added error events to FileSystemModel
This will allow us to catch errors early on FileManager
2020-04-22 12:12:32 +02:00
Linus Groh
038051d205 LibJS: Parse while statements 2020-04-22 11:48:14 +02:00
Nick Tiberi
d12f27b58e LibWeb: support confirm() with no arguments 2020-04-22 11:37:33 +02:00
AnotherTest
730ca98698 LibLine: Avoid OOB access when one of the suggestions is the prefix 2020-04-22 11:35:53 +02:00
Andreas Kling
ef69f900c7 LibWeb: Invalidate the canvas element after put_image_data()
This makes sure we repaint it right away so we can see the changes.
2020-04-22 00:09:23 +02:00
Andreas Kling
5326eebb1b WindowServer+LibGUI: Notify DisplayLinks at 60 fps no matter what
The original implementation only sent out notifications when there was
something being drawn on screen. If nothing was going on, we'd get too
lazy and just not notify display links.

This obviously break requestAnimationFrame(), so now we just drive the
DisplayLinks at 60 fps no matter what. :^)
2020-04-22 00:07:48 +02:00
Andreas Kling
2d4c91df8e LibWeb: Add ImageData objects and implement 2D context putImageData()
An ImageData is a wrapper around a Bitmap wrapper around a
JS::Uint8ClampedArray.
2020-04-21 23:49:51 +02:00
Andreas Kling
54133c683d LibWeb: Hack requestAnimationFrame() to provide a (very fake) timestamp 2020-04-21 23:49:09 +02:00
Andreas Kling
627fd6374b LibJS: Add Uint8ClampedArray :^)
This is a special kind of byte array that clamps its values to 0...255
It will be used for HTML ImageData objects.

I made Object::put_by_index() and get_by_index() virtual for this.
We'll probably need to make non-numeric property name lookups virtual
as well, but this solves my current problem well enough.
2020-04-21 23:47:39 +02:00
Andreas Kling
705cee528a LibGUI: Make it easier to create checkable GUI::Actions
This patch adds GUI::Action::create_checkable() helpers that work just
like the existing create() helpers, but the actions become checkable(!)

Clients are no longer required to manage the checked state of their
actions manually, but instead they will be checked/unchecked as needed
by GUI::Action itself before the activation hook is fired.
2020-04-21 17:21:28 +02:00
Andreas Kling
52a250cb61 LibGUI: Make MenuBar a Core::Object
This makes it show up in Inspector with all the menus inside it. :^)
2020-04-21 16:19:18 +02:00
Andreas Kling
a19690170f LibCore: Make Core::File::open() return a Result<NNRP<File>, String>
It was impractical to return a RefPtr<File> since that left us no way
to extract the error string. This is usually needed for the UI, so the
old static open() got basically no use.
2020-04-21 16:19:18 +02:00
Jack Karamanian
1fa0c7304d LibJS: Implement Function.prototype.bind() 2020-04-21 12:23:07 +02:00
Jack Karamanian
b3800829da LibJS: Prepend callee's bound arguments to the CallFrame and set the
this_value to the callee's bound |this| in CallExpression::execute()
2020-04-21 12:23:07 +02:00
Jack Karamanian
5750edd859 LibJS: Allow Function objects to be constructed with a bound |this|
value and bound arguments

This allows Function objects produced by Function.prototype.bind, as well
as arrow functions to track their |this| values and bound arguments.
2020-04-21 12:23:07 +02:00
Hüseyin ASLITÜRK
2abf2a2db1 LibGUI: MessageBox change height to icon cropping 2020-04-21 12:03:35 +02:00
Valtteri Koskivuori
3339a77f6c
LibGUI: Don't accelerate TextEditor autoscroll on wiggle (#1897)
This little tweak fixes the issue where the scrolling speeds up
significantly if the user wiggles their cursor. Just something obvious
I spotted while watching the video :^)
2020-04-21 09:54:46 +02:00
Linus Groh
13f806b1b0 LibJS: Rename global_call_fram to global_call_frame
Seems to be a typo.
2020-04-21 09:43:56 +02:00
Linus Groh
9722cac9fe LibJS: Let run-tests return 1 when not all tests pass 2020-04-20 22:44:13 +02:00
angel
441c2715bb LibGUI: Add Select all action to TextEditor
Previously, TextEditor processed the Select all command directly on the
keydown event handler. For this reason, WindowManager would not process
it as an action for the focused control and an action with the same
keyboard shortcut from the parent could override the TextEditor's one
even when it is focused.

For instance, when pressing Ctrl+A on the FileManager's path bar, all
files were selected instead, which is not the expected behavior.

Now the Select all command is an actual action on TextEditor, so that
WindowManager can process it correctly before any other actions. I also
added an icon for it!
2020-04-20 22:43:40 +02:00
Andreas Kling
563a377f6b LibGUI: Fix unpleasant selection behavior when dragging far to the left
If you select some text and drag the cursor outside the widget on the
left hand side, we would previously suddenly snap the selection cursor
to the end of the line instead of keeping it at the start of the line
as you would expect. This patch fixes that. :^)
2020-04-20 21:39:07 +02:00
Andreas Kling
5c15c24976 LibGUI: Keep scrolling while drag-selecting outside a TextEditor
If you start selecting text and move the cursor outside the TextEditor
widget area without letting go of the mouse button, we will now keep
scrolling a little bit every 100ms.
2020-04-20 21:31:49 +02:00
Andreas Kling
f78a92c5a9 LibJS: Remove default parameter from assertThrowsError() for now
We don't support these yet, and it broke all the tests. :^)
2020-04-20 20:33:21 +02:00
AnotherTest
364ca1f476 LibLine: Autocomplete already-complete suggestions
Suggesting whatever the user has input is not quite sane :^)
2020-04-20 20:23:26 +02:00
AnotherTest
f9b0490383 LibLine: Handle ctrl-{left,right}_arrow by jumping between words
Words are delimited by spaces.
Perhaps this should be a configurable behaviour?
2020-04-20 20:23:26 +02:00
AnotherTest
54d400c685 LibVT: Handle ctrl+arrow keys
Prior to this commit, we would treat them the same.
2020-04-20 20:23:26 +02:00
Linus Groh
cff68af965 LibJS: Add JSDoc to test-common.js 2020-04-20 17:31:49 +02:00
AnotherTest
e578b7884b LibLine: Properly handle ^C and do not return after being interrupted
this commit fixes a...surprisingly long-standing ^C bug, where it would
return the buffer instead of voiding it and starting over :^)
2020-04-20 17:27:30 +02:00
AnotherTest
42f06fc305 LibLine: Implement searching via up/down arrow keys 2020-04-20 17:27:30 +02:00
AnotherTest
58912994ab LibLine: Implement ^R searching
This commit adds searching in the editor history with ^R.
It does so by instantiating...another Line::Editor inside the current
Line::Editor :^)
2020-04-20 17:27:30 +02:00
Kesse Jones
df6696f576 LibJS: Add Array.prototype.reverse 2020-04-20 17:26:46 +02:00
Itamar
e35219b5ce Debugger: Add source-level operations
- Print current source location, if available
- Add a breakpoint at a source location
- "sl" command - step to the next line in source
2020-04-20 17:25:50 +02:00
Itamar
8a886e0e96 LibDebug: Parse line number information from DWARF format
DWARF line number information, if generated, is stored  in the
.debug_line section of an object file.

The information is encoded as instructions for a VM that is defined in
the DWARF specification.
By executing these instructions, we can extract the encoded line number
information.
2020-04-20 17:25:50 +02:00
Itamar
edaa9c06d9 LibELF: Make ELF::Loader RefCounted 2020-04-20 17:25:50 +02:00
angel
e0a16f8752 FileManager+LibGUI: Allow drop on entire DirectoryView
Previously, drag and drop would only work when dragging between node
items on a DirectoryView. This commit makes it possible to drag files to
the empty area of the DirectoryView and copy files more easily between
windows.
2020-04-20 12:15:26 +02:00
Kesse Jones
579975fd1e LibJS: Add Array.prototype.indexOf 2020-04-20 11:55:18 +02:00
Linus Groh
d3e3f5b421 LibJS: Add tests for String.prototype.repeat() 2020-04-20 11:41:25 +02:00
Linus Groh
a893c6ff0d LibJS: Throw RangeError in String.prototype.repeat() if count is invalid 2020-04-20 11:41:25 +02:00
Linus Groh
0718f216af LibJS: Add assertThrowsError() test function 2020-04-20 11:38:01 +02:00
Andreas Kling
c45e16f605 LibCore: Add StandardPaths thing to retrieve various standard locations
Fixes #1853.
2020-04-19 19:57:05 +02:00
AnotherTest
c97ca2fecc LibLine: Clear trailing trivia when cycling if the suggestion has any 2020-04-19 19:39:50 +02:00
Andreas Kling
4393a2a96d LibGfx: Let the PNG decoder fail if the header is missing or too short 2020-04-19 17:48:43 +02:00
AnotherTest
992467cca3 LibJS: Do not assume that a call frame exists in {get,set}_variable 2020-04-19 17:36:37 +02:00
Andreas Kling
69566bd4d6 LibJS: Allow passing "js" flags to run-tests
This allows us to run "run-tests -g" for testing with GC after every
heap allocation. This may flush out bugs that would otherwise not
occur if GC'ing only occasionally.
2020-04-19 17:34:33 +02:00
Andreas Kling
f7a1696087 LibJS: Add MarkedValueList and use it for argument passing
A MarkedValueList is basically a Vector<JS::Value> that registers with
the Heap and makes sure that the stored values don't get GC'd.

Before this change, we were unsafely keeping Vector<JS::Value> in some
places, which is out-of-reach for the live reference finding logic
since Vector puts its elements on the heap by default.

We now pass all the JavaScript tests even when running with "js -g",
which does a GC on every heap allocation.
2020-04-19 17:34:33 +02:00
AnotherTest
cb3cf589ed LibLine: Allow suggestions to have trailing trivia strings
These strings would be applied when inserted into the buffer, but are
not shown as part of the suggestion.

This commit also patches up Userland/js and Shell to use this
functionality
2020-04-19 17:21:55 +02:00
AnotherTest
7ef48171ce LibLine: Complete only common prefixes, and tweak suggestion logic
On the first tab, only complete the token without suggesting extra
stuff, and on further tabs, show suggestions.
Except in one case where the completion is all in the buffer, then
we show the suggestions, but do no completion.
2020-04-19 17:21:55 +02:00