Commit graph

414 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
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 839beb52f3 Base: Tweak the canvas demo page to stop using fractional RGB values
This is a hack to workaround missing support for fractional values in
"rgb(r,g,b)" color parsing.
2020-03-31 19:10:08 +02:00
Brendan Coles e8b17c42bb Base: Change root user home directory from / to /root 2020-03-31 11:43:46 +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
Tibor Nagy c7f3d72a6a HackStudio: Add an upscaled 32x32 icon to the About dialog 2020-03-30 13:03:53 +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 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
Hüseyin ASLITÜRK db692a807b Base: Add icons for color-chooser 2020-03-29 19:36:37 +02:00
Hüseyin ASLITÜRK 38dd8f28bd Base: Add tile wallpaper 2020-03-29 19:36:37 +02:00
Hüseyin ASLITÜRK 48a7d7c72d Base: Add monitor.png 2020-03-29 19:36:37 +02:00
Emanuel Sprung c9059c12dc Browser: Let the user add/remove bookmarks to the bookmarks bar
This patchset adds a Button to the toolbar (right next to the location field)
with a star icon. The star is white if the currently visited url is not yet
bookmarked and yellow if a bookmark for the url exists.

After adding or removing a bookmark, the bookmark json file is synced to disk.
Therefore, some new pledge/unveil's have been added.
2020-03-27 14:12:18 +01:00
Emanuel Sprung 337ade9e4c Browser: Add bookmarks bar
This patchset adds a bookmark bar that is backed by a json file backend.
The json file is loaded and checked for the format. According to the
format, the bookmarks bar is populated with the bookmark items.

If the bookmarks do not fit into one line, an expader button is shown
that brings up a menu containing the missing bookmark items.

There is currently no way to add or remove bookmarks. A hover over a
bookmark is also not yet showing the url in the statusbar.
2020-03-27 14:12:18 +01:00
Sergey Bugaev db4da68618 Base: Add a man page for js(1)
This also changes --ast-dump to --dump-ast, because I like it better
and that is what the variable is actually called.
2020-03-26 08:18:08 +01:00
Elisée Maurer d01b97b50a
Base: Replace <!DOCTYPE> with <!DOCTYPE html> in a few files (#1511)
<!DOCTYPE> by itself is not a valid document type declaration.
2020-03-26 07:37:12 +01:00
Andreas Kling 68b04d5c78 LibWeb: Implement getting and setting element.innerHTML
Getting the innerHTML property will recurse through the subtree inside
the element and serialize it into a string as it goes.

Setting it will parse the set value as an HTML fragment. It will then
remove all current children of the element and replace them with all
the children inside the parsed fragment.

Setting element.innerHTML will currently force a complete rebuild of
the document's layout tree.

This is pretty neat! :^)
2020-03-25 18:53:20 +01:00
redoste 30649ed93f Keymap: Add FR keymap layout
This adds the standard French "AZERTY" keyboard layout. Some keys are unmapped
because some characters are not supported : ²éèçà°€¨£¤ùµ§
2020-03-25 16:24:38 +01:00
Andreas Kling faddf3a1db LibJS: Implement "throw"
You can now throw an expression to the nearest catcher! :^)

To support throwing arbitrary values, I added an Exception class that
sits as a wrapper around whatever is thrown. In the future it will be
a logical place to store a call stack.
2020-03-24 22:21:58 +01:00
Andreas Kling 343e224aa8 LibJS: Implement basic exception throwing
You can now throw exceptions by calling Interpreter::throw_exception().
Anyone who calls ASTNode::execute() needs to check afterwards if the
Interpreter now has an exception(), and if so, stop what they're doing
and simply return.

When catching an exception, we'll first execute the CatchClause node
if present. After that, we'll execute the finalizer block if present.

This is unlikely to be completely correct, but it's a start! :^)
2020-03-24 16:14:10 +01:00
Andreas Kling c33d4aefc3 LibJS: Parse "try", "catch" and "finally"
This is the first step towards support exceptions. :^)
2020-03-24 16:14:10 +01:00
myphs f42f300ba3 LibWeb: CSS: Add "position: absolute" with top and left
This momentarily handles the CSS property "position: absolute;" in
combination with the properties "top" and "left", so that elements can
be placed anywhere on the page independently from their parents.

Statically positioned elements ignore absolute positioned elements when
calculating their position as they don't take up space.
2020-03-23 20:17:29 +01:00
Andreas Kling 39045bfde8 LibWeb: Add basic support for requestAnimationFrame()
We now support rAF, driven by GUI::DisplayLink callbacks. It's a bit
strange how we keep registering new callbacks over and over.
That's something we can definitely optimize.

This allows you to update animations/whatever without doing it more
often than the browser can display.
2020-03-22 21:18:03 +01:00
Andreas Kling 065db26d7c Base: Add a demo web page for canvas+setInterval+randomness
Click somewhere in the black area and drag for colorful effect! :^)
2020-03-21 19:07:21 +01:00
Andreas Kling a7d458f76a Base: Tidy up the events.html test page a little bit 2020-03-21 14:53:13 +01:00
Andreas Kling 2106dafd62 LibJS: Delete fully-empty HeapBlocks after garbage collection
We now deallocate GC blocks when they are found to have no live cells
inside them.
2020-03-21 11:46:47 +01:00
0xtechnobabble bc002f807a LibJS: Parse object expressions 2020-03-21 10:08:58 +01:00
Andreas Kling bceabd7c4b LibJS: Add ArrayPrototype and implement Array.prototype.push()
This function is ultimately supposed to be generic and allow any |this|
that has a length property, but for now it only works on our own Array
object type.
2020-03-20 21:56:40 +01:00
Andreas Kling 8f7d4f67a4 LibJS: Support reading/writing elements in an Array via Object get/put
I'm not completely thrilled about Object::get() and Object::put() doing
special-case stuff for arrays, and we should probably come up with a
better abstraction for it.

But at least it works for now, which is really nice. :^)
2020-03-20 21:56:40 +01:00
Andreas Kling a82f64d3d6 LibJS: Parse ArrayExpression and start implementing Array objects
Note that property lookup is not functional yet.
2020-03-20 21:56:40 +01:00
myphs 0891f860f7 LibWeb: Add CSS property 'border'
This makes it possible to write shorter CSS. Instead of writing
.foo {
        border-width: 3px;
        border-style: solid;
        border-color: blue;
}
it is now possible to write
.foo {
        border: 3px solid blue;
}
while the order of values is irrelevant.
Currently only the basic values are supported. More values should be
added in the future.

Three more value specific parse functions were added:
parse_line_width, parse_color, and parse_line_style

Additionally a few test cases were added to borders.html.
2020-03-20 21:40:55 +01:00
rhin123 a0bc6a8f37 Base: Add Calendar.af 2020-03-19 22:54:30 +01:00
rhin123 8bc412c80b Calendar: Add a 16x16 app icon 2020-03-19 22:54:30 +01:00
Andreas Kling a37c29e353 LibWeb: Add <canvas> element and start fleshing out CRC2D
This patch adds HTMLCanvasElement along with a LayoutCanvas object.
The DOM and layout parts are very similar to <img> elements.

The <canvas> element holds a Gfx::Bitmap which is sized according to
the "width" and "height" attributes on the element.

Calling .getContext("2d") on a <canvas> element gives you a context
object that draws into the underlying Gfx::Bitmap of the <canvas>.
The context weakly points to the <canvas> which allows it to outlive
the canvas element if needed.

This is really quite cool. :^)
2020-03-19 19:07:56 +01:00
Andreas Kling 73d28a0551 LibJS: Prefer FunctionDeclaration if a statement begins with "function" 2020-03-19 18:07:07 +01:00
Andreas Kling e265058768 LibWeb: Fire "mousedown" and "mousemove" events in the DOM :^) 2020-03-18 17:13:22 +01:00
Andreas Kling f39e5352f0 LibWeb: Start working on DOM event support
This patch adds the EventTarget class and makes Node inherit from it.

You can register event listeners on an EventTarget, and when you call
dispatch_event() on it, the event listeners will get invoked.

An event listener is basically a wrapper around a JS::Function*.

This is pretty far from how DOM events should eventually work, but it's
a place to start and we'll build more on top of this. :^)
2020-03-18 17:13:22 +01:00
Itamar bd9f14e27e SystemServer: Add WorkingDirectory support
Services can now have their initial working directory
configured via `SystemServer.ini`.

This commit also configures Terminal's working directory
to be /home/anon
2020-03-18 08:23:31 +01:00
Conrad Pankoff 46a897b59b LibJS: Implement typeof operator 2020-03-17 21:28:02 +01:00
marprok 666f84b933 Base: Add Joi theme 2020-03-17 09:41:15 +01:00
Andreas Kling 086f68e878 LibJS: Replace the global print() function with console.log() :^) 2020-03-16 14:58:20 +01:00
0xtechnobabble 6780d70fb1 js: Fix simple scopes example
Weirdly enough, the "simple-scopes" test doesn't return undefined
anymore, at first I thought the scoping was somehow broken, turns out
the interpreter doesn't consider the returned y as the last evaluated
value anymore, possibly because it's undefined (?).
2020-03-16 13:42:13 +01:00
0xtechnobabble dfbaa8e543 LibJS: Implement abstract equality and inequality 2020-03-16 13:42:13 +01:00
Oriko 2b162ef794 LibGUI: Use themes for syntax highlighting 2020-03-16 13:39:34 +01:00
Přemysl Janouch 66794d51ef Keymap: Add a US Dvorak keyboard layout
It is yet undecided how to name regional variants.
2020-03-16 07:42:19 +01:00
Andreas Kling 23b1d97b0d LibJS: Add ObjectPrototype and implement hasOwnProperty()
All Objects will now have ObjectPrototype as their prototype, unless
overridden.
2020-03-15 15:25:43 +01:00
Andreas Kling 2c5b9fb8f9 LibJS: Add StringPrototype and make it the prototype of StringObject
This patch adds String.prototype.charAt() to demonstrate that prototype
property lookup works, and that you can call a prototype function on an
object, and it will do what you expect. :^)
2020-03-15 15:02:49 +01:00
myphs 57646e362f Keymap: Add DE keymap layout
This makes it easier to work with the german keyboard layout.

Some keys are left unset because their corresponding letters
aren't supported yet.
2020-03-15 11:49:59 +01:00
Stephan Unverwerth 3389021291 LibJS: Unescape strings in Token::string_value() 2020-03-14 16:00:28 +01:00
Andreas Kling b5a22fc408 LibWeb: Implement Document.getElementById()
This was pleasantly simple! We don't have an ElementWrapper yet, so it
just returns a NodeWrapper, but it still basically works. :^)
2020-03-14 13:25:40 +01:00
Andreas Kling 1c406294fc LibWeb: Start implementing basic JavaScript DOM bindings
This patch introduces the Wrapper and Wrappable classes.

Node now inherits from Wrappable, and can be wrapped in a GC-allocated
Bindings::NodeWrapper object. The only property we expose right now is
the very simple nodeName property.

When a Document's JS::Interpreter is first instantiated, we add a
"document" property with a DocumentWrapper object to the global object.

This is pretty cool! :^)
2020-03-14 13:25:40 +01:00