Commit Graph

20 Commits

Author SHA1 Message Date
AnotherTest
9c201767a0 LibWeb: Fix some FIXMEs related to ExceptionOr<T>
This fixes a few FIXMEs mentioned in 5beacf08a2,
which depended on #6075 being fixed.
2021-04-13 22:31:06 +02:00
Timothy Flynn
1ef48d50ff LibWeb+WebContent: Hook document.cookie to the backend cookie storage 2021-04-11 18:24:34 +02:00
Linus Groh
d8d16dea95 LibWeb: Add a basic implementation of Document.createEvent()
This is a legacy function providing a way of constructing events without
using their constructors exposed on the global object.
We don't have many of the events it supports yet, nor can we throw a
DOMException from it, so that's two FIXMEs for later.
2021-04-10 21:00:04 +02:00
Luke
5beacf08a2 LibWeb: Make the node mutation algorithms more spec compliant
The mutation algorithms now more closely follow the spec and
fixes some assertion failures in tests such as Acid3 and Dromaeo.

The main thing that is missing right now is passing exceptions to the
bindings layer. This is because of issue #6075. I spent a while trying
to work it out and got so frustrated I just left it as a FIXME. Besides
that, the algorithms bail at the appropriate points.

This also makes the adopting steps in the document more spec compliant
as it's needed by the insertion algorithm. While I was at it, I added
the adoptNode IDL binding.

This adds a bunch of ancestor/descendant checks to TreeNode as well.
I moved the "remove_all_children" function to Node as it needs to use
the full remove algorithm instead of simply removing it from
the child list.
2021-04-06 21:42:00 +02:00
Timothy Flynn
5de0e0068c LibWeb: Support two-value background-repeat
The background-repeat value may be specified as either one- or two-value
identifiers (to be interpreted as horizontal and vertical repeat). This
adds two pseudo-properties, background-repeat-x and background-repeat-y,
to handle this. One-value identifiers are mapped to two-value in
accordance with the spec.
2021-04-05 18:49:04 +02:00
Timothy Flynn
fa9ba8bce5 LibWeb: Support rendering background images with 'background-repeat'
Update the painting of background images for both <body> nodes and other
non-initial nodes. Currently, only the following values are supported:
    repeat, repeat-x, repeat-y, no-repeat

This also doesn't support the two-value syntax which allows for setting
horizontal and vertical repetition separately.
2021-04-03 11:24:33 +02:00
Andreas Kling
36ea9fbd9e LibWeb: Stub out Document.cookie
We don't get/set anything, but at least scripts that access document
cookies can now progress further. :^)
2021-03-15 21:20:33 +01:00
Andreas Kling
a9830d9a55 LibWeb: Start exposing CSS style sheets to JavaScript :^)
This patch adds bindings for the following objects:

- StyleSheet
- StyleSheetList
- CSSStyleSheet

You can get to a document's style sheets via Document.styleSheets
and iterate through them using StyleSheetList's item() and length().

That's it in terms of functionality at this point, but still neat. :^)
2021-03-08 11:50:36 +01:00
Andreas Kling
fefb05f6f3 LibWeb: Split CSS::StyleSheet into StyleSheet and CSSStyleSheet
This is a little convoluted but matches the CSSOM specification.
2021-03-07 17:45:15 +01:00
Jean-Baptiste Boric
8dca96fb61 LibWeb: Provide file name to JavaScript interpreter 2021-03-01 11:14:36 +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
Andreas Kling
b126ead34e LibWeb: Support assigning to document.body when it is null 2021-02-22 14:00:47 +01:00
Andreas Kling
9194a97cbe LibWeb: Add Document.createRange()
Also tidy up DOM::Range a little bit while we're here, and unify the
way we create them to use a delegating constructors.
2021-02-21 23:48:01 +01:00
Andreas Kling
15cfde7233 LibWeb: Expose the Window object as Document.defaultView
This should really be a WindowProxy? but since we don't have anything
representing that concept yet, let's just expose the Window object
directly so document.defaultView.foo works. :^)
2021-02-21 21:32:16 +01:00
Linus Groh
dd621cc650 LibWeb: Use DOMException in Document::set_body() 2021-02-20 09:14:19 +01:00
Linus Groh
0f1da7d40c LibWeb: Add constructor to Document IDL interface 2021-02-17 23:45:07 +01:00
Andreas Kling
a59b1825ce LibWeb: Basic implementation of global event handlers :^)
Document and HTMLElement now inherit from HTML::GlobalEventHandlers
which allows them to support "onfoo" event handler attributes.

These are assignable both via IDL attributes and content attributes.

Event listeners constructed this way get a special "attribute" flag
on them so we know which one to replace if you reassign them.
This also allows them to coexist with EventTarget.addEventListener().

This is all a bit sloppy, but it works decently for a first cut.
The Window object should also inherit GlobalEventHandlers, but since
we don't generate it from IDL, I haven't taken that step here.

Also this would be a lot nicer if we supported IDL mixins.
2021-02-03 23:03:05 +01:00
Luke
3f5532d43e LibWeb: Flesh out prepare_script and execute_script
This fills in a bunch of the FIXMEs that was in prepare_script.

execute_script is almost finished, it's just missing the module side.

As an aside, let's not assert when inserting a script element with
innerHTML.
2021-01-29 08:49:50 +01:00
Luke
449c6c5604 LibWeb: Add simple implementation of Document.createElementNS 2021-01-28 22:18:46 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00