Commit Graph

139 Commits

Author SHA1 Message Date
Andreas Kling
9793d69d4f LibWeb: Make HTML::Window::page() return a Page& 2023-12-15 22:04:46 +01:00
Reimar
4299fb604b LibWeb: Add window.status property 2023-12-07 11:02:50 -07:00
Shannon Booth
629f661e3b LibWeb: Port supported property names from DeprecatedString to String 2023-11-28 17:15:27 -05:00
Timothy Flynn
ffdc2d8add LibWeb+LibWebView+WebContent: Add an Inspector IDL object to the Window
This is an internal object that must be explicitly enabled by the chrome
before it is added to the Window. The Inspector object will be used by a
special WebView that will replace all chrome-specific inspector windows.
The IDL defines methods that this WebView will need to inform the chrome
of various events, such as the user clicking a DOM node.
2023-11-24 08:37:19 +01:00
Andreas Kling
bfd354492e LibWeb: Put most LibWeb GC objects in type-specific heap blocks
With this change, we now have ~1200 CellAllocators across both LibJS and
LibWeb in a normal WebContent instance.

This gives us a minimum heap size of 4.7 MiB in the scenario where we
only have one cell allocated per type. Of course, in practice there will
be many more of each type, so the effective overhead is quite a bit
smaller than that in practice.

I left a few types unconverted to this mechanism because I got tired of
doing this. :^)
2023-11-19 22:00:48 +01:00
Luke Wilde
fc42c75a0c LibWeb: Make Window.postMessage closer to the spec
The main issues are using Structured{Serialize,Deserailize} instead of
Structured{Serialize,Deserialize}WithTransfer and the temporary
execution context usage for StructuredDeserialize.

Allows Discord to load once again, as it uses a postMessage scheduler
to render components, including the main App component. The callback
checked the (previously) non-existent source attribute of the
MessageEvent and returned if it was not the main window.

Fixes the Twitch cookie consent banner saying "failed integrity check"
for unknown reasons, but presumably related to the source and origin
attributes.
2023-11-08 09:55:24 +01:00
Shannon Booth
b37aab1277 LibWeb: Port named_item_value from DeprecatedFlyString 2023-10-08 08:11:48 -04:00
Andrew Kaster
5949e3c3e8 LibWeb: Implement named property access AOs on Window
These allow accessing embeds, forms, images and objects with a given
name attribute, and any element with a given id attribute, as top level
properties on the global object.

It also allows accessing NavigableContainers by target name as top level
properties on the global object.

The current implementation feels very expensive. It's likely that
these values will need smarter caching in the future.
2023-09-22 19:55:59 -06:00
Andrew Kaster
247f12d7b0 LibWeb: Insert WindowProperties object into Window's prototype chain
And implement WindowProperties, the "named properties object" for Window
according to the spec.

This involves moving an AO out of LegacyPlatformObject and into a common
place that the WindowProperties class can access.

This doesn't implement the AOs on Window that actually name lookup for
the unenumerable named properties on the window yet, just the
scaffolding.
2023-09-22 19:55:59 -06:00
Andrew Kaster
64899dba44 LibWeb: Implement document-tree child navigable target name property set
This AO allows accessing child navigables by their name as named
properties on the WindowProxy object.
2023-09-22 19:55:59 -06:00
Aliaksandr Kalenik
6665f0db43 LibWeb: Delete unused document_tree_child_browsing_context_count()
The function is no longer needed with navigables.
2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
089a23a1f2 LibWeb: Update Window::length() to use navigables 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
d45f2a4952 LibWeb: Update Location::replace() to use navigables 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
acff244335 LibWeb: Use navigate() instead of did_set_location_href in Location 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik
083e4a3f30 LibWeb: Update Location::reload() to use navigables 2023-09-16 16:53:32 +02:00
Andrew Kaster
7f043e3083 LibWeb: Add window.navigation property 2023-08-24 11:03:57 -06:00
Aliaksandr Kalenik
5f21285337 LibWeb: Add Window::navigable() 2023-08-22 20:30:06 +02:00
Andreas Kling
72c9f56c66 LibJS: Make Heap::allocate<T>() infallible
Stop worrying about tiny OOMs. Work towards #20449.

While going through these, I also changed the function signature in many
places where returning ThrowCompletionOr<T> is no longer necessary.
2023-08-13 15:38:42 +02:00
Andreas Kling
9f6ceff7cf LibWeb: Implement basic version of CSSOM View's VisualViewport
We got some errors while loading https://twinings.co.uk/ about this
interface missing, and it looked fairly simple so I sketched it out.
Note that I did leave some FIXMEs where it's not clear exactly which
metrics we should be returning.
2023-08-06 16:29:24 +02:00
Andreas Kling
ec24d7555a LibWeb: Add a simple internals objects only available during testing
This object is available as `window.internals` (or just `internals`) and
is only accessible while running in "test mode".

This first version only has one API: gc(), which triggers a garbage
collection immediately.

In the future, we can add more APIs here to help us test parts of the
engine that are hard or impossible to reach via public web APIs.
2023-08-06 15:26:34 +02:00
Shannon Booth
a975fca42e LibWeb: Implement size attribute of ByteLengthQueuingStrategy
Co-authored-by: Matthew Olsson <mattco@serenityos.org>
2023-06-23 13:27:29 +02:00
Shannon Booth
49689e5d8e LibWeb: Implement size attribute of CountQueuingStrategy
Co-authored-by: Matthew Olsson <mattco@serenityos.org>
2023-06-23 13:27:29 +02:00
stelar7
29029de839 LibWeb: Set last activation timestamp on the window 2023-06-01 14:28:52 +02:00
Andreas Kling
e43027091d LibWeb: Don't include HTML/Window.h from DOM/Element.h
This required moving HTML::ScrollOptions to its own header file.
2023-05-08 09:29:44 +02:00
Kenneth Myhra
cbefab21be LibWeb: Port fire_a_page_transition_event() to new FlyString 2023-04-09 17:27:27 +02:00
Kenneth Myhra
4d87072201 LibWeb: Port {HTML,UIEvents,XHR}::EventNames to new String 2023-04-06 23:49:08 +02:00
Luke Wilde
034aaf3f51 LibWeb: Introduce CustomElementRegistry and creating custom elements
The main missing feature here is form associated custom elements.
2023-04-06 11:36:56 +02:00
Timothy Flynn
9c569e8a0f LibWeb: Implement the [PutForwards] IDL extended attribute
For example, consider the attribute:

    interface Element {
        [PutForwards=value] readonly attribute DOMTokenList classList;
    }

When `classList` is set, we should instead set the attribute `value` on
the `classList` attribute of the Element interface.
2023-03-14 16:30:19 -04:00
Timothy Flynn
0aa4466ce9 LibWeb: Port {set,clear}{Timeout,Interval} to IDL 2023-03-14 09:07:40 -04:00
Timothy Flynn
dd992e7dad LibWeb: Move timer implementations to WindowOrWorkerGlobalScopeMixin
This is where it belongs according to the spec, and where these methods'
IDL will be placed.

This forces us to implement a few steps closer to the spec as well.
2023-03-14 09:07:40 -04:00
Linus Groh
41b8d81d49 LibWeb/HTML: Remove redundant namespace qualifiers from Window.{cpp,h} 2023-03-11 18:26:40 +00:00
Linus Groh
324dacbc5d LibWeb/HTML: Propagate OOM errors from Window::{local,session}_storage()
This requires a bit of error type conversion glue as HashMap::try_ensure
expects the callback to return ErrorOr<T> like the function itself does.
2023-03-11 18:26:40 +00:00
Linus Groh
4da68384e6 LibWeb/HTML: Make Window::m{location,navigator} lazily allocated
This now matches the other window-owned objects, which already do this:
m_crypto, m_performance, m_screen.
2023-03-11 17:53:50 +00:00
Linus Groh
b6a69f5f03 LibWeb/HTML: Consolidate duplicate public/private sections in Window.h 2023-03-11 17:09:01 +00:00
Linus Groh
351e5ca917 LibWeb/HTML: Port Window.queueMicrotask() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
129ab02470 LibWeb/HTML: Port Window.structuredClone() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
a31c561a5a LibWeb/HTML: Port Window.sessionStorage to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
37e9302dd9 LibWeb/HTML: Port Window.localStorage to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
5cc6b1c4db LibWeb/HTML: Port Window.fetch() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
a2fb3a1653 LibWeb/HTML: Port Window.cancelAnimationFrame() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
211e6c1fbc LibWeb/HTML: Port Window.requestAnimationFrame() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
86589f09dc LibWeb/HTML: Port Window.cancelIdleCallback() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
b410804f54 LibWeb/HTML: Port Window.requestIdleCallback() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
606b9ff6f3 LibWeb/HTML: Port Window.getSelection() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
56550b6ec0 LibWeb/HTML: Port Window.focus() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
b59505aba5 LibWeb/HTML: Port Window.getComputedStyle() to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
8454eb874f LibWeb/HTML: Port Window.devicePixelRatio to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
46e547d774 LibWeb/HTML: Port Window.outer{Width,Height} to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
80acf03278 LibWeb/HTML: Port Window.screen{X,Y} / Window.screen{Left,Top} to IDL 2023-03-07 23:33:34 +00:00
Linus Groh
3d075e55f5 LibWeb/HTML: Port Window.scrollBy() to IDL 2023-03-07 23:33:34 +00:00