summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-10 22:46:35 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-11 00:21:49 +0100
commitcb0c5390ff9a0189ae79cfd690f6c089ba73c4a7 (patch)
treef6b3f94c65f92cb195e67eb75add5eb9815e8cc2 /Userland/Libraries/LibWeb/DOM
parented84fbce474a86721ff85aa9559213e12bd556ba (diff)
downloadserenity-cb0c5390ff9a0189ae79cfd690f6c089ba73c4a7.zip
LibWeb: Move mouse event and label logic from layout to painting tree
Input events have nothing to do with layout, so let's not send them to layout nodes. The job of Paintable starts to become clear. It represents a paintable item that can be rendered into the viewport, which means it can also be targeted by the mouse cursor.
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Node.cpp7
-rw-r--r--Userland/Libraries/LibWeb/DOM/Node.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp
index 5241cb9f1d..b1eb86a63d 100644
--- a/Userland/Libraries/LibWeb/DOM/Node.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Node.cpp
@@ -1010,6 +1010,13 @@ size_t Node::length() const
return child_count();
}
+Painting::Paintable const* Node::paintable() const
+{
+ if (!layout_node())
+ return nullptr;
+ return layout_node()->paintable();
+}
+
Painting::PaintableBox const* Node::paint_box() const
{
if (!layout_node())
diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h
index 8b9b641de2..536738c9f0 100644
--- a/Userland/Libraries/LibWeb/DOM/Node.h
+++ b/Userland/Libraries/LibWeb/DOM/Node.h
@@ -159,6 +159,7 @@ public:
Layout::Node* layout_node() { return m_layout_node; }
Painting::PaintableBox const* paint_box() const;
+ Painting::Paintable const* paintable() const;
void set_layout_node(Badge<Layout::Node>, Layout::Node*) const;