/src/serenity/Userland/Libraries/LibWeb/Layout/ReplacedBox.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/DOM/Element.h> |
10 | | #include <LibWeb/Layout/Box.h> |
11 | | |
12 | | namespace Web::Layout { |
13 | | |
14 | | class ReplacedBox : public Box { |
15 | | JS_CELL(ReplacedBox, Box); |
16 | | |
17 | | public: |
18 | | ReplacedBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>); |
19 | | virtual ~ReplacedBox() override; |
20 | | |
21 | 0 | DOM::Element const& dom_node() const { return verify_cast<DOM::Element>(*Node::dom_node()); } |
22 | 0 | DOM::Element& dom_node() { return verify_cast<DOM::Element>(*Node::dom_node()); } |
23 | | |
24 | 0 | virtual void prepare_for_replaced_layout() { } |
25 | | |
26 | 0 | virtual bool can_have_children() const override { return false; } |
27 | | |
28 | | private: |
29 | 0 | virtual bool is_replaced_box() const final { return true; } |
30 | | |
31 | | Optional<CSSPixels> m_intrinsic_width; |
32 | | Optional<CSSPixels> m_intrinsic_height; |
33 | | Optional<float> m_intrinsic_aspect_ratio; |
34 | | }; |
35 | | |
36 | | template<> |
37 | 0 | inline bool Node::fast_is<ReplacedBox>() const { return is_replaced_box(); } |
38 | | |
39 | | } |