/src/serenity/Userland/Libraries/LibWeb/Layout/CanvasBox.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibWeb/Layout/CanvasBox.h> |
8 | | #include <LibWeb/Painting/CanvasPaintable.h> |
9 | | |
10 | | namespace Web::Layout { |
11 | | |
12 | | JS_DEFINE_ALLOCATOR(CanvasBox); |
13 | | |
14 | | CanvasBox::CanvasBox(DOM::Document& document, HTML::HTMLCanvasElement& element, NonnullRefPtr<CSS::StyleProperties> style) |
15 | 0 | : ReplacedBox(document, element, move(style)) |
16 | 0 | { |
17 | 0 | } |
18 | | |
19 | 0 | CanvasBox::~CanvasBox() = default; |
20 | | |
21 | | void CanvasBox::prepare_for_replaced_layout() |
22 | 0 | { |
23 | 0 | set_natural_width(dom_node().width()); |
24 | 0 | set_natural_height(dom_node().height()); |
25 | 0 | } |
26 | | |
27 | | JS::GCPtr<Painting::Paintable> CanvasBox::create_paintable() const |
28 | 0 | { |
29 | 0 | return Painting::CanvasPaintable::create(*this); |
30 | 0 | } |
31 | | |
32 | | } |