ladybird/Userland/Libraries/LibWeb/Layout/Label.h
Andreas Kling c4826eae4f LibWeb: Rename Layout::BlockBox => BlockContainer
There's a subtle difference here. A "block box" in the spec is a
block-level box, while a "block container" is a box whose children are
either all inline-level boxes in an IFC, or all block-level boxes
participating in a BFC.

Notably, an "inline-block" box is a "block container" but not a "block
box" since it is itself inline-level.
2021-10-06 20:10:36 +02:00

36 lines
1.2 KiB
C++

/*
* Copyright (c) 2021, Tim Flynn <trflynn89@pm.me>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/HTML/HTMLLabelElement.h>
#include <LibWeb/Layout/BlockContainer.h>
namespace Web::Layout {
class Label : public BlockContainer {
public:
Label(DOM::Document&, HTML::HTMLLabelElement*, NonnullRefPtr<CSS::StyleProperties>);
virtual ~Label() override;
static bool is_inside_associated_label(LabelableNode&, const Gfx::IntPoint&);
static bool is_associated_label_hovered(LabelableNode&);
const HTML::HTMLLabelElement& dom_node() const { return static_cast<const HTML::HTMLLabelElement&>(*BlockContainer::dom_node()); }
HTML::HTMLLabelElement& dom_node() { return static_cast<HTML::HTMLLabelElement&>(*BlockContainer::dom_node()); }
void handle_mousedown_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button);
void handle_mouseup_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button);
void handle_mousemove_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button);
private:
static Label* label_for_control_node(LabelableNode&);
LabelableNode* control_node();
bool m_tracking_mouse { false };
};
}