Commit graph

10 commits

Author SHA1 Message Date
Andreas Kling
9eec63e471 LibWeb: Protect DOM node while preparing to send mouse events
The Help application was hooking HtmlView::on_link_click, which would
get invoked before DOM event dispatch. Since we were holding on to the
clicked node with a Node*, the DOM node was gone after returning from
the on_link_click callback.

Fix this by keeping DOM nodes in RefPtrs in the event management code.
Also move DOM event dispatch before widget hook invocation, to try and
keep things sane on the LibWeb side of things.

Fixes #1605.
2020-04-03 21:34:57 +02:00
Linus Groh
07049f98ec LibWeb: Handle invalid URL in HtmlView::load() 2020-04-03 19:41:25 +02:00
Linus Groh
021d78f8f7 Browser: Add error page
Add a simple HTML error page that gets loaded into the HtmlView when
loading the page fails.

Closes #1210 and #1516
2020-04-01 18:49:48 +02:00
Andreas Kling
660ec504ca LibWeb: Move get_element_by_id() to a NonElementParentNode mixin class
This matches the current version of the DOM spec. And since C++ doesn't
have mixins this is actually a CRTP class.
2020-03-28 09:13:29 +01:00
Andreas Kling
0395b25e3f LibWeb: Put selection-related debug spam behind an #ifdef 2020-03-22 13:03:43 +01:00
Andreas Kling
55c845713a LibWeb: Give MouseEvents the correct offsetX and offsetY values 2020-03-21 18:27:06 +01:00
Andreas Kling
4dde36844b LibWeb: Add a DOM Event class (instead of events being simple strings)
This patch adds the Event base class, along with a MouseEvent subclass.
We now dispatch MouseEvent objects for mousedown, mouseup and mousemove
and these objects have the .offsetX and .offsetY properties.

Both of those properties are hard-coded at the moment. This will be
fixed in the next patch. :^)
2020-03-21 18:17:18 +01:00
Andreas Kling
b196665131 LibWeb: Dispatch "mouseup" event
This is a very naive implementation that doesn't account for where the
mousedown happened.
2020-03-21 17:55:41 +01:00
Andreas Kling
e265058768 LibWeb: Fire "mousedown" and "mousemove" events in the DOM :^) 2020-03-18 17:13:22 +01:00
Andreas Kling
830a57c6b2 LibWeb: Rename directory LibHTML => LibWeb
Let's rename this to LibWeb since it aims to provide more parts of the
web platform than just HTML. :^)
2020-03-07 10:32:51 +01:00
Renamed from Libraries/LibHTML/HtmlView.cpp (Browse further)