2020-06-05 18:36:02 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-05 18:36:02 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/DOM/Document.h>
|
2021-11-18 11:01:28 -03:00
|
|
|
#include <LibWeb/HTML/BrowsingContext.h>
|
2020-11-22 11:53:01 -03:00
|
|
|
#include <LibWeb/Layout/FrameBox.h>
|
2023-02-25 07:04:29 -03:00
|
|
|
#include <LibWeb/Layout/Viewport.h>
|
2022-03-10 10:02:25 -03:00
|
|
|
#include <LibWeb/Painting/NestedBrowsingContextPaintable.h>
|
2020-06-05 18:36:02 -03:00
|
|
|
|
2020-11-22 11:53:01 -03:00
|
|
|
namespace Web::Layout {
|
2020-06-05 18:36:02 -03:00
|
|
|
|
2020-11-22 11:53:01 -03:00
|
|
|
FrameBox::FrameBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style)
|
|
|
|
|
: ReplacedBox(document, element, move(style))
|
2020-06-05 18:36:02 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-14 16:21:51 -03:00
|
|
|
FrameBox::~FrameBox() = default;
|
2020-06-05 18:36:02 -03:00
|
|
|
|
2020-11-22 11:53:01 -03:00
|
|
|
void FrameBox::prepare_for_replaced_layout()
|
2020-06-05 18:36:02 -03:00
|
|
|
{
|
2021-05-30 07:36:53 -03:00
|
|
|
VERIFY(dom_node().nested_browsing_context());
|
2020-06-06 08:10:11 -03:00
|
|
|
|
2020-06-05 18:36:02 -03:00
|
|
|
// FIXME: Do proper error checking, etc.
|
2020-11-22 10:46:36 -03:00
|
|
|
set_intrinsic_width(dom_node().attribute(HTML::AttributeNames::width).to_int().value_or(300));
|
|
|
|
|
set_intrinsic_height(dom_node().attribute(HTML::AttributeNames::height).to_int().value_or(150));
|
2020-06-05 18:36:02 -03:00
|
|
|
}
|
|
|
|
|
|
2020-11-22 11:53:01 -03:00
|
|
|
void FrameBox::did_set_rect()
|
2020-06-05 18:36:02 -03:00
|
|
|
{
|
2020-11-22 11:53:01 -03:00
|
|
|
ReplacedBox::did_set_rect();
|
2020-06-05 18:36:02 -03:00
|
|
|
|
2021-05-30 07:36:53 -03:00
|
|
|
VERIFY(dom_node().nested_browsing_context());
|
2023-04-20 12:00:42 -03:00
|
|
|
dom_node().nested_browsing_context()->set_size(paintable_box()->content_size());
|
2020-06-05 18:36:02 -03:00
|
|
|
}
|
|
|
|
|
|
2023-01-11 08:51:49 -03:00
|
|
|
JS::GCPtr<Painting::Paintable> FrameBox::create_paintable() const
|
2022-03-10 10:02:25 -03:00
|
|
|
{
|
|
|
|
|
return Painting::NestedBrowsingContextPaintable::create(*this);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-05 18:36:02 -03:00
|
|
|
}
|