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