Serenity Operating System
at master 31 lines 737 B view raw
1/* 2 * Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibGfx/Painter.h> 8#include <LibWeb/Layout/CanvasBox.h> 9#include <LibWeb/Painting/CanvasPaintable.h> 10 11namespace Web::Layout { 12 13CanvasBox::CanvasBox(DOM::Document& document, HTML::HTMLCanvasElement& element, NonnullRefPtr<CSS::StyleProperties> style) 14 : ReplacedBox(document, element, move(style)) 15{ 16} 17 18CanvasBox::~CanvasBox() = default; 19 20void CanvasBox::prepare_for_replaced_layout() 21{ 22 set_intrinsic_width(dom_node().width()); 23 set_intrinsic_height(dom_node().height()); 24} 25 26JS::GCPtr<Painting::Paintable> CanvasBox::create_paintable() const 27{ 28 return Painting::CanvasPaintable::create(*this); 29} 30 31}