Commit Graph

68 Commits

Author SHA1 Message Date
Luke
9dee140a9f LibWeb: Add empty IDL bindings for current SVG elements
Nothing in them right now as the classes don't contain the IDL
methods.
2020-10-03 00:30:49 +02:00
Andreas Kling
97d0acc5b6 LibWeb: Implement performance.now()
This patch introduces the HighResolutionTime namespace which is home to
the Performance object (exposed via window.performance)

performance.now() is currently the only function, and it returns the
number of milliseconds since the window object was constructed. :^)
2020-09-29 18:19:18 +02:00
Andreas Kling
96fc476107 LibWeb: Add a separate UA style sheet for documents in quirks mode
We need to make some additional tweaks to the default UA style when
displaying documents in quirks mode.
2020-09-24 10:33:33 +02:00
Andreas Kling
c6ae0c41d9 LibWeb: Add Bindings::ScriptExecutionContext
This will be inherited by documents and workers, to provide a common
abstraction for script execution. (We don't have workers yet, but we
might as well make this little space for them now to simplify things
down the road.)
2020-09-20 19:22:44 +02:00
Andreas Kling
cd5570670c LibWeb: Implement <input type=submit> without using LibGUI
Following in the footsteps of <input type=checkbox>, this patch adds
LayoutButton which implements a basic push button using LibGfx styling
primitives.
2020-09-12 18:18:20 +02:00
Andreas Kling
f2431adf47 LibWeb: Add basic support for <input type=checkbox>
This is implemented entirely inside LibWeb, there is no GUI::CheckBox
widget instantiated, unlike other input types. All input types should
be moved to this new style of implementation.
2020-09-11 18:42:43 +02:00
Andreas Kling
8a6a9a8fb6 LibWeb: Move DOM event dispatch to its own class
For now, the new DOM::EventDispatcher is very simple, it just iterates
over the set of listeners on an EventTarget and invokes the callbacks
as it goes.

This simplifies EventTarget subclasses since they no longer have to
implement the callback mechanism themselves.
2020-09-06 14:48:14 +02:00
Luke
c2a2552e46 LibWeb: Add more document tests, add comment, text and mixin tests
Also adds a TypeScript definition file for the test runner object.
2020-08-17 22:57:05 +02:00
Luke
8b807e65d7 LibWeb: Add Comment and DocumentFragment bindings, move querySelector...
...{All} to ParentNode. Exposes createDocumentFragment and
createComment on Document. Stubs out the document.body setter. 

Also adds ParentNode back :^).
2020-08-17 22:57:05 +02:00
Nico Weber
e9b56b5b9c LibWeb: Add Node.textContent
This requires moving remove_all_children() from ParentNode to
Node, which makes ParentNode.cpp empty, so remove it.

It also co-opts the existing Node::text_content() method and
tweaks it slightly to fit the semantics of Node.textContent.
2020-08-17 21:23:11 +02:00
Andreas Kling
b6e18133ae LibWeb: Rename WebContentView => OutOfProcessWebView 2020-08-17 18:05:35 +02:00
Andreas Kling
56c3748dcc LibWeb: Rename PageView => InProcessWebView 2020-08-17 18:05:35 +02:00
Andreas Kling
a784090b91 LibWeb: Move HTML::AttributeNames file into HTML/ directory 2020-08-12 13:22:59 +02:00
Luke
5724ac8e72 LibWeb: Add HTML elements to factories, add missing tags and attributes
This is mostly to get the grunt work of the way. This is split up into
multiple commits to hopefully make it more manageable to review.

Note that these are not full implementations, and the bindings mostly
get the low hanging fruit.

Also implements some attributes that I kept out because they had
dashes in them. Therefore, this closes #2905.
2020-08-09 21:14:51 +02:00
Nico Weber
d8b6314018 Build: Support make's and ninja's restat optimization
After running a build command, make by default stat()s the command's
output, and if it wasn't touched, then it cancels all build steps
that were scheduled only because this command was expected to change
the output.

Ninja has the same feature, but it's opt-in behind the per-command
"restat = 1" setting. However, CMake enables it by default for all
custom commands.

Use Meta/write-only-on-difference.sh to write the output to a temporary
file, and then copy the temporary file only to the final location if the
contents of the output have changed since last time.
write-only-on-difference.sh automatically creates the output's parent
directory, so stop doing that in CMake.

Reduces the number of build steps that run after touching a file
in LibCore from 522 to 312.

Since we now no longer trigger the CMake special case "If COMMAND
specifies an executable target name (created by the add_executable()
command), it will automatically be replaced by the location of the
executable created at build time", we now need to use qualified paths to
the generators.

Somewhat related to #2877.
2020-08-04 15:58:08 +02:00
Andreas Kling
73645e11c4 LibWeb: Add CharacterData and Text IDL interfaces 2020-08-03 20:50:45 +02:00
Andreas Kling
e496a74bb3 LibWeb: Add a basic DOM::Position class
This will be used for editable content. :^)
2020-08-02 17:34:50 +02:00
Andreas Kling
c95a1fe3a3 LibWeb: Add UIEvent class (base of MouseEvent, and others) 2020-07-28 19:39:17 +02:00
Andreas Kling
ef711f501e LibWeb: Move the Page/Frame/EventHandler classes into Page/ 2020-07-28 19:28:29 +02:00
Andreas Kling
7daeddb9e9 LibWeb: Move the CSS parser into CSS/Parser/ 2020-07-28 19:23:18 +02:00
Andreas Kling
cc4109c03b LibWeb: Move the HTML parser into HTML/Parser/ 2020-07-28 19:23:18 +02:00
Andreas Kling
8b55d3d86e LibWeb: Move MouseEvent into the UIEvents namespace
Named after the UIEvents specification that houses MouseEvent.
2020-07-28 18:55:47 +02:00
Luke
a2b40de0cc LibWeb: Add a whole bunch of HTML DOM bindings
Note that these aren't full implementations of the bindings. This
mostly implements the low hanging fruit (namely, basic reflections)

There are some attributes that should be USVString instead of
DOMString. However, USVString is a slightly different definition
of DOMString, so it should suffice for now.
2020-07-27 19:51:45 +02:00
Andreas Kling
a565121793 LibWeb: Move HTML object model stuff into LibWeb/HTML/
Take a hint from SVG and more all the HTML classes into HTML instead of
mixing them with the DOM classes.
2020-07-26 17:51:00 +02:00
Matthew Olsson
b1299f972c LibWeb: Refactor SVG files into their own directory; follow spec layout 2020-07-26 14:53:43 +02:00
Matthew Olsson
943e4f8bf1 LibWeb: Abstract common operations of graphical SVG elements 2020-07-26 14:53:43 +02:00
Matthew Olsson
22f0953fe2 LibWeb: Begin SVG element support
This commit starts adding a basic SVG element. Currently, svg elements
have support for the width and height properties, as well as the stroke,
stroke-width, and fill properties. The only child element supported
is the path element, as most other graphical elements are just shorthand
for paths.
2020-07-26 14:53:43 +02:00
Luke
19d6884529 LibWeb: Implement quirks mode detection
This allows us to determine which mode to render the page in.

Exposes "doctype" and "compatMode" on Document.
Exposes "name", "publicId" and "systemId" on DocumentType.
2020-07-21 01:08:32 +02:00
Andreas Kling
7a7e39c7af LibWeb: Move WebContentView from Demos/WebView into LibWeb 2020-07-06 20:36:34 +02:00
Andreas Kling
9177eea8fe LibWeb: Add LayoutRange::normalized()
We use this to ensure that we're always working with a selection where
the start() is before the end() in document order. That simplifies all
the logic around this.
2020-06-29 00:39:51 +02:00
Andreas Kling
8d2194bdbd LibWeb: Make DOM timers cancellable and stop leaking them
This patch adds a Web::Timer object that represents a single timer
registration made with window.setTimeout() or window.setInterval().
All live timers are owned by the DOM Window object.

The timers can be stopped via clearTimeout() or clearInterval().
Note that those API's are actually interchangeable, but we have to
support both.
2020-06-27 20:02:04 +02:00
Andreas Kling
6293d1a13c LibWeb+Browser: Remove old HTML parser :^)
The new parser is now used everywhere and it's working pretty well!
2020-06-26 00:53:25 +02:00
Andreas Kling
10255bc5c6 LibWeb+Browser: Decode non-animated images out-of-process :^)
We now use the ImageDecoder service in LibWeb for everything except
GIF images (we'll have to deal with them later, ofc.)

This has a little bit of overhead but we should be able to optimize
it until it becomes negligible.
2020-06-22 21:47:01 +02:00
Andreas Kling
9ce25bbf1d LibWeb: Generate CanvasRenderingContext2D bindings from IDL :^)
We're still missing optional argument support, so this implementation
doesn't support fill(), only fill(fill_rule).

Still it's really nice to get rid of so much hand-written wrapper code.
2020-06-22 19:07:25 +02:00
Andreas Kling
e1bd815a6a LibWeb: Generate Event and MouseEvent bindings from IDL :^)
We still have to hand-write a function to turn an Event& into a wrapper
but this is still a hue improvement. Eventually we'll find a way to
auto-generate that function as well.
2020-06-21 16:12:28 +02:00
Andreas Kling
dd29ff884f LibWeb: Generate ImageData bindings from IDL :^) 2020-06-21 15:57:10 +02:00
Andreas Kling
b959d06ace LibWeb: Generate HTMLCanvasElement bindings from IDL :^) 2020-06-21 15:37:13 +02:00
Andreas Kling
119dd2c541 LibWeb: Generate HTMLImageElement bindings from IDL :^) 2020-06-21 15:26:09 +02:00
Andreas Kling
1914f52371 LibWeb: Add HTMLElement wrapper
Expose the "title" attribute just to expose something. :^)
2020-06-21 14:39:15 +02:00
Andreas Kling
d724a12732 LibWeb: Generate EventTarget bindings from IDL :^) 2020-06-21 12:31:42 +02:00
Andreas Kling
a64033e581 LibWeb: Generate Element bindings from IDL :^)
Had to do a bunch more hacking on WrapperGenerator to support this.
We now support attribute setters as well.
2020-06-21 11:39:32 +02:00
Andreas Kling
1ffffa0053 LibWeb: Start generating JS wrappers from (simplified) WebIDL :^)
This patch introduces a hackish but functional IDL parser and uses it
to generate the JS bindings for Node and Document.

We'll see how far this simple parser takes us. The important thing
right now is generating code, not being a perfect IDL parser. :^)
2020-06-21 00:58:55 +02:00
Andreas Kling
995d93c9d9 LibWeb: Move StackingContext from Layout/ to Painting/
The stacking context tree doesn't affect layout at all, so let's move
it into the Painting/ directory. I'm not sure yet if it's worth going
for a fullly separate painting tree. So far I'm thinking a stacking
context tree with pointers into the layout tree might be enough.
2020-06-18 21:42:19 +02:00
Andreas Kling
96da15a8a4 LibWeb: Respect CSS z-index property while painting
To support z-ordering when painting, the layout tree now has a parallel
sparse tree of stacking contexts. The rules for which layout boxes
establish a stacking context are a bit complex, but the intent is to
encapsulate the decision making into establishes_stacking_context().

When we paint, we start from the ICB (LayoutDocument) who always has a
StackingContext and then paint the tree of StackingContexts where each
node has its children sorted by z-index.

This is pretty crude, but gets the basic job done. Note that this does
not yet support hit testing; hit testing is still done using a naive
treewalk from the root.
2020-06-15 17:56:00 +02:00
Andreas Kling
3cc0c477db LibWeb: Add basic <object> element support
This patch implements a simple <object> element with fallback content.
If the URL from the data attribute fails to load (including 404),
we render the DOM tree inside the <object> as fallback content.

This works by generating a different layout tree for the <object>
depending on the state and success of the data load. Since we cannot
currently do incremental layout tree updates, we have to force a
complete layout tree rebuild when the resource load finishes/fails.
2020-06-13 22:24:49 +02:00
Andreas Kling
6f19067c9a LibWeb+Browser: Add a barebones LayoutTreeModel to the inspector window
This allows you to inspect the layout tree, along side the DOM tree.
It will need more functionality to be truly useful, but it's a start.
2020-06-12 22:30:11 +02:00
Andreas Kling
28dcef4757 LibWeb: Add LayoutTableRowGroup to implement display: table-row-group 2020-06-09 21:53:16 +02:00
Andreas Kling
92392398a2 LibWeb: Add Page abstraction between PageView and main Frame
* A PageView is a view onto a Page object.
* A Page always has a main Frame (root of Frame tree.)
* Page has a PageClient. PageView is a PageClient.

The goal here is to allow building another kind of view onto
a Page while keeping the rest of LibWeb intact.
2020-06-08 21:12:20 +02:00
Andreas Kling
992697d99f LibWeb: Add HTML::TagNames namespace for global tag name FlyStrings
Instead of "iframe", we can now say HTML::TagNames::iframe and avoid
a FlyString lookup.
2020-06-07 23:27:03 +02:00
Andreas Kling
10851d87a2 LibWeb: Add (stub) HTMLTable{,Cell,Row}Element C++ classes
We'll need a place to implement the various presentational attributes
for table parts, and more stuff.
2020-06-07 23:10:45 +02:00