Commit Graph

9 Commits

Author SHA1 Message Date
Linus Groh
340e1f4b28 LibWeb: Implement the Screen interface
https://drafts.csswg.org/cssom-view/#the-screen-interface
2021-04-04 00:37:54 +02:00
Linus Groh
ade3adcc7a LibWeb: Run queued promise jobs after callbacks
We now run queued promise jobs after calling event handler, timer, and
requestAnimationFrame() callbacks - this is a bit ad-hoc, but I don't
want to switch LibWeb to use an event loop right now - this works just
fine, too.
We might want to revisit this at a later point and do tasks and
microtasks properly.
2021-04-02 10:47:40 +02:00
Linus Groh
056ffa4abb LibWeb: Call requestAnimationFrame() callback with undefined this value
We were leaking an empty value via the callback's this value:

    requestAnimationFrame(function () {
        this; // <-- empty value
    });
2021-03-26 22:59:47 +01:00
Andreas Kling
906cccbf7f LibWeb: Add Window.innerWidth and Window.innerHeight 2021-03-16 17:22:59 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
Linus Groh
5e07c27e25 LibWeb: Implement Window.prompt() 2021-02-20 12:19:46 +01:00
Andreas Kling
abf7c02acb LibWeb: Move window.confirm() to using a PageClient callback
This allows us to move the GUI::MessageBox out of DOM::Window and up to
the widget layer.
2021-02-10 09:13:30 +01:00
Andreas Kling
0639e77898 LibWeb: Make the Window object "inherit" from EventTarget :^)
Since Web::Bindings::WindowObject inherits from JS::GlobalObject, it
cannot also inherit from Web::Bindings::EventTargetWrapper.

However, that's not actually necessary. Instead, we simply set the
Window object's prototype to the EventTargetPrototype, and add a little
extra branch in the impl_from() function that turns the JS "this" value
into a DOM::EventTarget*.

With this, you can now call window.addEventListener()! Very cool :^)

Fixes #4758.
2021-01-18 12:18:29 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00