Commit graph

1879 commits

Author SHA1 Message Date
Liav A a60ea79a41 Kernel & Userland: Allow to mount image files formatted with Ext2FS 2020-04-02 12:03:08 +02:00
Andreas Kling c683665ca9 LibJS: Fix bad cast in Interpreter::run()
We were casting to BlockStatement when we should cast to ScopeNode.
2020-04-02 09:56:13 +02:00
Jack Karamanian bb15b37228 LibJS: Evaluate CallExpression arguments before pushing a CallFrame 2020-04-02 08:50:28 +02:00
AnotherTest 8f08ec5038 LibLine: Restore previous state only if initialized
This makes the library safe to construct/destruct without actually using
it.
2020-04-02 08:49:11 +02:00
Andreas Kling cd1d369cdd LibJS: Add argument(i) and argument_count() to Interpreter
Add some convenience accessors for retrieving arguments from the
current call frame.
2020-04-01 22:38:59 +02:00
Andreas Kling 1549c5c48b LibJS: Make Value::as_object() return Object&
Let's move towards using references over pointers in LibJS as well.
I had originally steered away from it because that's how I've seen
things done in other engines. But this is not the other engines. :^)
2020-04-01 22:18:47 +02:00
Linus Groh a0da97cb5a LibJS: Add NaN to global object 2020-04-01 22:09:37 +02:00
Andreas Kling 9d5d0261e1 LibJS: Add Interpreter::create<GlobalObjectType>()
Force Interpreter construction to go via a create() helper that takes
the global object type as a template parameter.
2020-04-01 21:05:35 +02:00
Andreas Kling aee4c1f583 LibJS: Add GlobalObject to the forwarding header 2020-04-01 21:05:35 +02:00
Linus Groh ee6472fef2 LibJS: Implement Error function/constructor 2020-04-01 20:47:37 +02:00
Linus Groh 849e2c77e4 LibJS: Implement constructor/non-constructor function calls
This adds Function::construct() for constructor function calls via `new`
keyword. NativeFunction doesn't have constructor behaviour by default,
ScriptFunction simply calls call() in construct()
2020-04-01 20:18:36 +02:00
Andreas Kling a27884e4be LibWeb: Remove debug spam in WindowObject 2020-04-01 19:09:37 +02:00
Andreas Kling d062d7baa7 LibWeb+LibJS: Move DOM Window object to dedicated classes
LibWeb now creates a WindowObject which inherits from GlobalObject.
Allocation of the global object is moved out of the Interpreter ctor
to allow for specialized construction.

The existing Window interfaces are moved to WindowObject with their
implementation code in the new Window class.
2020-04-01 18:57:00 +02:00
Andreas Kling cd9379dca9 LibJS: Reorganize computing of |this| for CallExpressions
This avoids executing the LHS of the object expression twice when doing
a call on the result of an object expression.
2020-04-01 18:57:00 +02:00
Linus Groh 021d78f8f7 Browser: Add error page
Add a simple HTML error page that gets loaded into the HtmlView when
loading the page fails.

Closes #1210 and #1516
2020-04-01 18:49:48 +02:00
Andreas Kling 296f87fa7f LibLine: Fix Shell crashing (due to write() EFAULT) on <tab><tab>
Use a StringBuilder instead of blindly passing a bunch of potentially
empty/null strings to the kernel. StringBuilder is more lenient and
generally more pleasant to use anyway.
2020-04-01 11:25:53 +02:00
Linus Groh 632231cc0c js: Implement print function for Date objects 2020-03-31 21:19:21 +02:00
Andreas Kling a8dc6501de LibJS: Use "%d" to stringify numeric values that are whole integers
This unbreaks a bunch of the JS tests since they were now printing all
the numbers as "1.000000" instead of "1".
2020-03-31 19:06:10 +02:00
Andreas Kling 28edafbfa6 LibLine: Fix build in Linux environment
My host compiler was complaining about "%b" in format strings and about
ignoring the return value from a bunch of write() calls.
2020-03-31 18:59:15 +02:00
Andreas Kling c7257ed827 LibLine: Rename on_char_input() => register_character_input_callback()
The "on_foo" format is our convention for public callback members.
2020-03-31 13:37:01 +02:00
Andreas Kling 8ab576308f LibLine: Rename LineEditor.{cpp,h} => Editor.{cpp,h} 2020-03-31 13:34:57 +02:00
Andreas Kling 6595469de1 LibLine: Rename LineEditor to Line::Editor 2020-03-31 13:34:06 +02:00
Andreas Kling a30a3277a3 LibLine: Rename from LibLineEdit 2020-03-31 13:32:11 +02:00
AnotherTest 6f407fff32 LibLineEdit + Shell: Handle Termios internally and give a copy if asked
This moves the Termios logic inside LibLineEdit and allows users to
simply forget about the existence of termios if they so choose to :^)
2020-03-31 13:21:46 +02:00
AnotherTest 5062a7d4cd LibLinEdit + Shell: handle signals
This allows the LineEditor to get notified about signals, since we
cannot set signal handlers in a clean way within the LineEditor
instance.
2020-03-31 13:21:46 +02:00
AnotherTest 305b1a6248 LibLineEdit: Add a new Line Editor library
This library is moved over from Shell/LineEdit and has all its
Shell-specific functionalities stripped off.
Currently it exposes some internal things, for instance
cut_mismatching_chars() and insert(); This behaviour is not the most
acceptable, however, let's just roll with it for now :^)
2020-03-31 13:21:46 +02:00
Sergey Bugaev 7bd077a3ae LibGUI: Fix index invalidation
When the model gets updated, we have to let go of the old indexes,
because they're invalid from that moment on.

Fixes https://github.com/SerenityOS/serenity/issues/1541
2020-03-30 23:05:14 +02:00
Linus Groh 3fcea71538 LibJS: Implement Date.prototype.to{Date,Time}String() 2020-03-30 21:43:35 +02:00
Linus Groh dc9b1226ac LibJS: Implement Date.prototype.toString() 2020-03-30 20:36:18 +02:00
Andreas Kling b4fde72013 LibGUI: Brighten icons when hovering items in item views
View classes now track their hovered item and paint them in a slightly
brighter shade to liven up the user interface. :^)
2020-03-30 19:57:44 +02:00
Andreas Kling add93bf593 LibGUI: Brighten buttons when hovering over them :^) 2020-03-30 19:40:44 +02:00
Andreas Kling 7976ef7a79 LibGfx: Add Painter::blit_filtered() and blit_brightened()
blit_filtered() can be used to easily implement per-pixel filtered blit
functions. All you need to do is provide a callback that can compute
the Color for each pixel based on the original Color.
2020-03-30 19:39:37 +02:00
Andreas Kling 012a4eb0b5 WindowServer+NotificationServer: Vertical title bar for notifications
This patch adds a specialized window type for notifications. They now
have a title bar on the right-hand side, with a close button.

This removes the need for the "Done" button in notifications, giving us
a bit more horizontal space overall.

Design based on a mock-up from @xTibor :^)
2020-03-30 17:03:15 +02:00
Andreas Kling cbd7effd3b LibGfx: Support vertical gradient fill (not just horizontal) :^) 2020-03-30 17:00:12 +02:00
Jack Karamanian 098f1cd0ca LibJS: Add support for arrow functions 2020-03-30 15:41:36 +02:00
Jack Karamanian f90da71d28 LibJS: Add Parser save_state() and load_state() functions
These functions allow us to try to parse ambiguous expressions (such as
arrow function arguments in parentheses), and
rewind the state of the Parser if an expression candidate failed to
parse.
2020-03-30 15:41:36 +02:00
Linus Groh fb0401871c LibJS: Throw TypeError when calling non-function object
We now have "undefined is not a function" :^)
2020-03-30 14:43:58 +02:00
Linus Groh d4e3688f4f LibJS: Start implementing Date :^)
This adds:

- A global Date object (with `length` property and `now` function)
- The Date constructor (no arguments yet)
- The Date prototype (with `get*` functions)
2020-03-30 14:11:54 +02:00
Andreas Kling 5c779c124b LibVT: Don't scroll-to-bottom when pressing the Logo key
Let's treat the Logo key like all the other modifiers and not scroll to
the bottom of the buffer.
2020-03-30 13:15:47 +02:00
Andreas Kling a1c718e387 LibJS: Use some macro magic to avoid duplicating all the token types 2020-03-30 13:11:07 +02:00
Andreas Kling 0df15823b5 LibCore: Add a static Core::File::open() convenience function
This helper opens a file with a given name, mode and permissions and
returns it in a RefPtr<File>. I think this will be a bit nicer to use
than having to go through Core::File::construct() every time.
2020-03-30 12:08:25 +02:00
Andreas Kling 06aec9667e LibWeb: Support more advanced selectors in document.querySelectorAll()
I made some mistakes in the selector parsing code. It's now able to
parse selectors composed of multiple complex selectors, instead of just
one complex selector.
2020-03-30 11:35:39 +02:00
Andreas Kling c1c56b1131 LibWeb: Add Element.id property to the bindings 2020-03-30 11:35:39 +02:00
Andreas Kling 0f7bcd4111 LibWeb: Add naive support for document.querySelectorAll()
This currently returns a JS::Array of elements matching a selector.
The more correct behavior would be to return a static NodeList, but as
we don't have NodeLists right now, that'll be a task for the future.
2020-03-30 11:35:39 +02:00
Tibor Nagy 317a0d666b LibGUI: AboutDialog now inherits the icon of its parent window 2020-03-30 10:52:09 +02:00
Andreas Kling 8c5fa05c39 WindowServer: Use Gfx::ShareableBitmap for SetWindowIconBitmap 2020-03-29 19:37:23 +02:00
Andreas Kling 7cfe712f4d LibGfx+LibIPC: Add Gfx::ShareableBitmap, a bitmap for easy IPC usage
With this patch, it's now possible to pass a Gfx::ShareableBitmap in an
IPC message. As long as the message itself is synchronous, the bitmap
will be adopted by the receiving end, and disowned by the sender nicely
without any accounting effort like we've had to do in the past.

Use this in NotificationServer to allow sending arbitrary bitmaps as
icons instead of paths-to-icons.
2020-03-29 19:37:23 +02:00
Andreas Kling 24a0354ce8 LibIPC+LibGfx: Pass the IPC::Decoder to decoding helpers
Instead of passing the BufferStream, pass the Decoder. I'd like to stop
using BufferStream eventually anyway, so it's good to get it out of any
API's where it's in currently.
2020-03-29 19:37:23 +02:00
Andreas Kling 01ff36a2f4 LibIPC: Add forwarding header for LibIPC 2020-03-29 19:37:23 +02:00
Andreas Kling ae9fe60412 LibGUI: Make Label::set_icon() take a const Gfx::Bitmap* 2020-03-29 19:37:23 +02:00