mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 10:25:10 +00:00
LibHTML: Have Document track its hovered Node
This gets set from HtmlView::mousemove_event() at the moment.
This commit is contained in:
parent
754e6e0f67
commit
88de955073
3 changed files with 18 additions and 1 deletions
|
@ -1,9 +1,11 @@
|
|||
#include <LibGUI/GPainter.h>
|
||||
#include <LibHTML/DOM/Document.h>
|
||||
#include <LibHTML/DOM/Element.h>
|
||||
#include <LibHTML/Layout/LayoutBlock.h>
|
||||
#include <LibHTML/Layout/LayoutNode.h>
|
||||
|
||||
//#define DRAW_BOXES_AROUND_LAYOUT_NODES
|
||||
//#define DRAW_BOXES_AROUND_HOVERED_NODES
|
||||
|
||||
LayoutNode::LayoutNode(const Node* node, StyleProperties&& style_properties)
|
||||
: m_node(node)
|
||||
|
@ -35,6 +37,10 @@ void LayoutNode::render(RenderingContext& context)
|
|||
{
|
||||
#ifdef DRAW_BOXES_AROUND_LAYOUT_NODES
|
||||
context.painter().draw_rect(m_rect, Color::Blue);
|
||||
#endif
|
||||
#ifdef DRAW_BOXES_AROUND_HOVERED_NODES
|
||||
if (!is_anonymous() && node() == document().hovered_node())
|
||||
context.painter().draw_rect(m_rect, Color::Red);
|
||||
#endif
|
||||
// TODO: render our background and border
|
||||
for_each_child([&](auto& child) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue