Commit Graph

128 Commits

Author SHA1 Message Date
Andreas Kling
4559faf8d8 LibWeb: Support named CSS properties on CSSStyleDeclaration wrapper
Use the new CustomGet/CustomPut wrapper mechansim to intercept gets and
puts on CSSStyleDeclaration objects. This allows content to get and set
individual CSS properties from JavaScript. :^)
2021-03-15 21:20:33 +01:00
Andreas Kling
33e3f0c71f LibWeb: Expose barebones CSSStyleDeclaration to JavaScript
You can now access an element's inline style via Element.style.
The interface is not very capable yet though. :^)
2021-03-13 22:41:32 +01:00
Andreas Kling
0759f54bd3 LibWeb: Rename StyleDeclaration => CSSStyleDeclaration to match CSSOM 2021-03-13 22:41:32 +01:00
Andreas Kling
ad152bfa59 LibWeb: Add a whole bunch of rule classes for the new CSS parser
Original work by @stelar7.
2021-03-09 17:36:21 +01:00
Andreas Kling
16cde3f14a LibWeb: Rename CSSParser => DeprecatedCSSParser 2021-03-09 17:35:57 +01:00
Andreas Kling
078f0a5c67 LibWeb: Add specification-based CSS tokenizer
Original work by @stelar7 for #2628.
2021-03-09 17:35:38 +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
Andreas Kling
0af4762662 LibWeb: Rename StyleRule => CSSStyleRule
This matches the CSSOM specification.
2021-03-07 17:45:15 +01:00
Sviatoslav Peleshko
183ebaee91 LibWeb: Add actual document loading for the CSS (at)import rule 2021-02-28 10:27:32 +01:00
Sviatoslav Peleshko
54617e1a91 LibWeb: Added simple parsing for (at)import rules
For now, the parsing is very crude, and parses only the document url.
The meta queries for the import are ignored.
2021-02-28 10:27:32 +01:00
Sviatoslav Peleshko
04d67d0239 LibWeb: Create base class CSSRule for all CSS rules
This is a foundation for handling other ("at") CSS rules.
2021-02-28 10:27:32 +01:00
Linus Groh
ada71dc71b LibWeb: Add DOM::DOMException class and bindings 2021-02-20 00:09:11 +01:00
Andreas Kling
5e91e61900 LibWeb: Remove WidgetBox layout node
The approach of attaching sub-widgets to the web view widget was only
ever going to work in single-process mode, and that's not what we're
about anymore, so let's just get rid of WidgetBox so we don't have the
dead-end architecture hanging over us.

The next step here is to re-implement <input type=text> using LibWeb
primitives.
2021-02-10 09:13:30 +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
Andreas Kling
342b787d1c LibWeb: Move main thread JavaScript VM to its own file
Instead of being a weird little global function in DOM/Document.cpp,
you can now get the main thread JS VM via Bindings::main_thread_vm().
2021-02-03 10:45:39 +01:00
Luke
0a1226344a LibWeb: Add XHREventTarget and have XHR inherit from it 2021-01-23 22:29:21 +01:00
Luke
4f2e154dbe LibWeb: Flesh out existing XHR methods a bit more
This makes open, send and setRequestHeader a bit more spec compliant and
adds a bunch of FIXMEs for unimplemented parts.
2021-01-23 22:29:21 +01:00
Andreas Kling
cfa2fb2eb3 LibWeb: Generate JS bindings for Range from IDL :^) 2021-01-23 17:59:42 +01:00
Andreas Kling
8363b3ae99 LibWeb: Generate JS bindings for XMLHttpRequest from IDL :^)
Remove the hand-written XHR bindings in favor of generated ones.
2021-01-23 15:06:09 +01:00
Andreas Kling
5b91362d4e LibWeb: Move XMLHttpRequest to separate XHR directory
In keeping with the one-directory-per-web-spec layout, let's move XHR
into its own clubhouse.
2021-01-23 11:51:36 +01:00
Emanuele Torre
68c8b52612 Build: Use cmake's make_directory utility instead of env(1) and mkdir(1)
..in CMake files.

Also, the `-S`s were unnecessary here since "mkdir" doesn't have any
spaces and these are not shebangs.
2021-01-22 22:14:42 +01:00
Jonathan Turner
0bf5669ba3
Meta: Get building on NixOS (#5005) 2021-01-22 17:44:05 +01:00
Andreas Kling
fd7920fa8f LibWeb: Add a very naive Layout::FlexFormattingContext :^)
This is very dumb and only lays out its child boxes on a horizontal
line with their shrink-to-fit widths.

You have to start somewhere! :^)
2021-01-18 20:20:13 +01:00
Andreas Kling
9e45594dc8 LibWeb: Stub out the PerformanceTiming object from Navigation Timing
Just have all the timing functions return 0 for now.

We can now run the Shynet JS on https://linus.dev/ although the XHR
is rejected by our same-origin policy.
2021-01-18 15:11:20 +01:00
Andreas Kling
252a98042d LibWeb: Generate constructor and prototype classes for IDL interfaces
This patch adds a FooPrototype and FooConstructor class for each IDL
interface we generate JS bindings for.

These classes are very primitive and don't do everything they should
yet, but we have to start somewhere. :^)

Work towards #4789
2021-01-18 12:18:29 +01:00
Andreas Kling
0db6835e73 LibWeb: Move HTML::SubmitEvent functions out of line 2021-01-18 12:18:29 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00