summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r--Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/Box.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/ButtonBox.cpp8
-rw-r--r--Userland/Libraries/LibWeb/Layout/CheckBox.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Layout/FrameBox.cpp12
-rw-r--r--Userland/Libraries/LibWeb/Layout/ImageBox.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Layout/ImageBox.h4
-rw-r--r--Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/Label.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.cpp16
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.h4
-rw-r--r--Userland/Libraries/LibWeb/Layout/RadioButton.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/TextNode.cpp16
14 files changed, 46 insertions, 46 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
index b0650284ef..f7a21b01b4 100644
--- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp
@@ -13,7 +13,7 @@
#include <LibWeb/Layout/InlineFormattingContext.h>
#include <LibWeb/Layout/ListItemBox.h>
#include <LibWeb/Layout/ReplacedBox.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
@@ -516,7 +516,7 @@ void BlockFormattingContext::place_block_level_non_replaced_element_in_normal_fl
void BlockFormattingContext::layout_initial_containing_block(LayoutMode layout_mode)
{
- auto viewport_rect = context_box().frame().viewport_rect();
+ auto viewport_rect = context_box().browsing_context().viewport_rect();
auto& icb = downcast<Layout::InitialContainingBlockBox>(context_box());
icb.build_stacking_context_tree();
diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp
index de85dde8c5..398ffb4909 100644
--- a/Userland/Libraries/LibWeb/Layout/Box.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Box.cpp
@@ -10,7 +10,7 @@
#include <LibWeb/HTML/HTMLHtmlElement.h>
#include <LibWeb/Layout/BlockBox.h>
#include <LibWeb/Layout/Box.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
#include <LibWeb/Painting/BorderPainting.h>
namespace Web::Layout {
@@ -293,7 +293,7 @@ HitTestResult Box::hit_test(const Gfx::IntPoint& position, HitTestType type) con
void Box::set_needs_display()
{
if (!is_inline()) {
- frame().set_needs_display(enclosing_int_rect(absolute_rect()));
+ browsing_context().set_needs_display(enclosing_int_rect(absolute_rect()));
return;
}
diff --git a/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp b/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp
index 614f4bcada..0679257e55 100644
--- a/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/ButtonBox.cpp
@@ -11,7 +11,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Layout/ButtonBox.h>
#include <LibWeb/Layout/Label.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
@@ -63,7 +63,7 @@ void ButtonBox::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsi
set_needs_display();
m_tracking_mouse = true;
- frame().event_handler().set_mouse_event_tracking_layout_node(this);
+ browsing_context().event_handler().set_mouse_event_tracking_layout_node(this);
}
void ButtonBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned)
@@ -73,7 +73,7 @@ void ButtonBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& positio
// NOTE: Handling the click may run arbitrary JS, which could disappear this node.
NonnullRefPtr protected_this = *this;
- NonnullRefPtr protected_frame = frame();
+ NonnullRefPtr protected_frame = browsing_context();
bool is_inside_node_or_label = enclosing_int_rect(absolute_rect()).contains(position);
if (!is_inside_node_or_label)
@@ -114,7 +114,7 @@ void ButtonBox::handle_associated_label_mouseup(Badge<Label>)
{
// NOTE: Handling the click may run arbitrary JS, which could disappear this node.
NonnullRefPtr protected_this = *this;
- NonnullRefPtr protected_frame = frame();
+ NonnullRefPtr protected_frame = browsing_context();
dom_node().did_click_button({});
m_being_pressed = false;
diff --git a/Userland/Libraries/LibWeb/Layout/CheckBox.cpp b/Userland/Libraries/LibWeb/Layout/CheckBox.cpp
index a9f323b4b5..fc92179cdb 100644
--- a/Userland/Libraries/LibWeb/Layout/CheckBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/CheckBox.cpp
@@ -10,7 +10,7 @@
#include <LibGfx/StylePainter.h>
#include <LibWeb/Layout/CheckBox.h>
#include <LibWeb/Layout/Label.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
@@ -48,7 +48,7 @@ void CheckBox::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsig
set_needs_display();
m_tracking_mouse = true;
- frame().event_handler().set_mouse_event_tracking_layout_node(this);
+ browsing_context().event_handler().set_mouse_event_tracking_layout_node(this);
}
void CheckBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned)
@@ -68,7 +68,7 @@ void CheckBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position
m_being_pressed = false;
m_tracking_mouse = false;
- frame().event_handler().set_mouse_event_tracking_layout_node(nullptr);
+ browsing_context().event_handler().set_mouse_event_tracking_layout_node(nullptr);
}
void CheckBox::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned, unsigned)
diff --git a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp
index 092aa61d37..1ed914c87e 100644
--- a/Userland/Libraries/LibWeb/Layout/FrameBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FrameBox.cpp
@@ -10,7 +10,7 @@
#include <LibWeb/InProcessWebView.h>
#include <LibWeb/Layout/FrameBox.h>
#include <LibWeb/Layout/InitialContainingBlockBox.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
@@ -25,7 +25,7 @@ FrameBox::~FrameBox()
void FrameBox::prepare_for_replaced_layout()
{
- VERIFY(dom_node().content_frame());
+ VERIFY(dom_node().nested_browsing_context());
set_has_intrinsic_width(true);
set_has_intrinsic_height(true);
@@ -52,14 +52,14 @@ void FrameBox::paint(PaintContext& context, PaintPhase phase)
context.painter().add_clip_rect(enclosing_int_rect(absolute_rect()));
context.painter().translate(absolute_x(), absolute_y());
- context.set_viewport_rect({ {}, dom_node().content_frame()->size() });
+ context.set_viewport_rect({ {}, dom_node().nested_browsing_context()->size() });
const_cast<Layout::InitialContainingBlockBox*>(hosted_layout_tree)->paint_all_phases(context);
context.set_viewport_rect(old_viewport_rect);
context.painter().restore();
if constexpr (HIGHLIGHT_FOCUSED_FRAME_DEBUG) {
- if (dom_node().content_frame()->is_focused_frame()) {
+ if (dom_node().nested_browsing_context()->is_focused_context()) {
context.painter().draw_rect(absolute_rect().to_type<int>(), Color::Cyan);
}
}
@@ -70,8 +70,8 @@ void FrameBox::did_set_rect()
{
ReplacedBox::did_set_rect();
- VERIFY(dom_node().content_frame());
- dom_node().content_frame()->set_size(size().to_type<int>());
+ VERIFY(dom_node().nested_browsing_context());
+ dom_node().nested_browsing_context()->set_size(size().to_type<int>());
}
}
diff --git a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp
index c358c08d66..c1b0065002 100644
--- a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp
@@ -8,7 +8,7 @@
#include <LibGfx/Painter.h>
#include <LibGfx/StylePainter.h>
#include <LibWeb/Layout/ImageBox.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
@@ -16,12 +16,12 @@ ImageBox::ImageBox(DOM::Document& document, DOM::Element& element, NonnullRefPtr
: ReplacedBox(document, element, move(style))
, m_image_loader(image_loader)
{
- frame().register_viewport_client(*this);
+ browsing_context().register_viewport_client(*this);
}
ImageBox::~ImageBox()
{
- frame().unregister_viewport_client(*this);
+ browsing_context().unregister_viewport_client(*this);
}
int ImageBox::preferred_width() const
diff --git a/Userland/Libraries/LibWeb/Layout/ImageBox.h b/Userland/Libraries/LibWeb/Layout/ImageBox.h
index de4527c814..c58853d373 100644
--- a/Userland/Libraries/LibWeb/Layout/ImageBox.h
+++ b/Userland/Libraries/LibWeb/Layout/ImageBox.h
@@ -8,13 +8,13 @@
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/Layout/ReplacedBox.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
class ImageBox
: public ReplacedBox
- , public Frame::ViewportClient {
+ , public BrowsingContext::ViewportClient {
public:
ImageBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, const ImageLoader&);
virtual ~ImageBox() override;
diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp
index 3cd7f29a33..3863546763 100644
--- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp
@@ -7,7 +7,7 @@
#include <LibGfx/Painter.h>
#include <LibWeb/Dump.h>
#include <LibWeb/Layout/InitialContainingBlockBox.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
#include <LibWeb/Painting/StackingContext.h>
namespace Web::Layout {
diff --git a/Userland/Libraries/LibWeb/Layout/Label.cpp b/Userland/Libraries/LibWeb/Layout/Label.cpp
index 053ff54fd4..0edff98432 100644
--- a/Userland/Libraries/LibWeb/Layout/Label.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Label.cpp
@@ -13,7 +13,7 @@
#include <LibWeb/Layout/Label.h>
#include <LibWeb/Layout/LabelableNode.h>
#include <LibWeb/Layout/TextNode.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp
index 533c747ffd..81be66ef25 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Node.cpp
@@ -15,7 +15,7 @@
#include <LibWeb/Layout/InitialContainingBlockBox.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Layout/TextNode.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
@@ -104,16 +104,16 @@ HitTestResult Node::hit_test(const Gfx::IntPoint& position, HitTestType type) co
return result;
}
-const Frame& Node::frame() const
+const BrowsingContext& Node::browsing_context() const
{
- VERIFY(document().frame());
- return *document().frame();
+ VERIFY(document().browsing_context());
+ return *document().browsing_context();
}
-Frame& Node::frame()
+BrowsingContext& Node::browsing_context()
{
- VERIFY(document().frame());
- return *document().frame();
+ VERIFY(document().browsing_context());
+ return *document().browsing_context();
}
const InitialContainingBlockBox& Node::root() const
@@ -140,7 +140,7 @@ void Node::set_needs_display()
if (auto* block = containing_block()) {
block->for_each_fragment([&](auto& fragment) {
if (&fragment.layout_node() == this || is_ancestor_of(fragment.layout_node())) {
- frame().set_needs_display(enclosing_int_rect(fragment.absolute_rect()));
+ browsing_context().set_needs_display(enclosing_int_rect(fragment.absolute_rect()));
}
return IterationDecision::Continue;
});
diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h
index 770339732c..837ea203db 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.h
+++ b/Userland/Libraries/LibWeb/Layout/Node.h
@@ -65,8 +65,8 @@ public:
DOM::Document& document() { return m_document; }
const DOM::Document& document() const { return m_document; }
- const Frame& frame() const;
- Frame& frame();
+ const BrowsingContext& browsing_context() const;
+ BrowsingContext& browsing_context();
const InitialContainingBlockBox& root() const;
InitialContainingBlockBox& root();
diff --git a/Userland/Libraries/LibWeb/Layout/RadioButton.cpp b/Userland/Libraries/LibWeb/Layout/RadioButton.cpp
index 02399b7a7b..8712c2f9b0 100644
--- a/Userland/Libraries/LibWeb/Layout/RadioButton.cpp
+++ b/Userland/Libraries/LibWeb/Layout/RadioButton.cpp
@@ -10,7 +10,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Layout/Label.h>
#include <LibWeb/Layout/RadioButton.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
@@ -48,7 +48,7 @@ void RadioButton::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, un
set_needs_display();
m_tracking_mouse = true;
- frame().event_handler().set_mouse_event_tracking_layout_node(this);
+ browsing_context().event_handler().set_mouse_event_tracking_layout_node(this);
}
void RadioButton::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned)
@@ -68,7 +68,7 @@ void RadioButton::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& posit
m_being_pressed = false;
m_tracking_mouse = false;
- frame().event_handler().set_mouse_event_tracking_layout_node(nullptr);
+ browsing_context().event_handler().set_mouse_event_tracking_layout_node(nullptr);
}
void RadioButton::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned, unsigned)
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
index 24bcf24326..677a24f1b7 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
@@ -12,7 +12,7 @@
#include <LibWeb/Layout/TableFormattingContext.h>
#include <LibWeb/Layout/TableRowBox.h>
#include <LibWeb/Layout/TableRowGroupBox.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
diff --git a/Userland/Libraries/LibWeb/Layout/TextNode.cpp b/Userland/Libraries/LibWeb/Layout/TextNode.cpp
index e2f6783e31..c5aaeb47d8 100644
--- a/Userland/Libraries/LibWeb/Layout/TextNode.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TextNode.cpp
@@ -12,7 +12,7 @@
#include <LibWeb/Layout/InlineFormattingContext.h>
#include <LibWeb/Layout/Label.h>
#include <LibWeb/Layout/TextNode.h>
-#include <LibWeb/Page/Frame.h>
+#include <LibWeb/Page/BrowsingContext.h>
#include <ctype.h>
namespace Web::Layout {
@@ -77,17 +77,17 @@ void TextNode::paint_fragment(PaintContext& context, const LineBoxFragment& frag
void TextNode::paint_cursor_if_needed(PaintContext& context, const LineBoxFragment& fragment) const
{
- if (!frame().is_focused_frame())
+ if (!browsing_context().is_focused_context())
return;
- if (!frame().cursor_blink_state())
+ if (!browsing_context().cursor_blink_state())
return;
- if (frame().cursor_position().node() != &dom_node())
+ if (browsing_context().cursor_position().node() != &dom_node())
return;
// NOTE: This checks if the cursor is before the start or after the end of the fragment. If it is at the end, after all text, it should still be painted.
- if (frame().cursor_position().offset() < (unsigned)fragment.start() || frame().cursor_position().offset() > (unsigned)(fragment.start() + fragment.length()))
+ if (browsing_context().cursor_position().offset() < (unsigned)fragment.start() || browsing_context().cursor_position().offset() > (unsigned)(fragment.start() + fragment.length()))
return;
if (!fragment.layout_node().dom_node() || !fragment.layout_node().dom_node()->is_editable())
@@ -95,7 +95,7 @@ void TextNode::paint_cursor_if_needed(PaintContext& context, const LineBoxFragme
auto fragment_rect = fragment.absolute_rect();
- float cursor_x = fragment_rect.x() + font().width(fragment.text().substring_view(0, frame().cursor_position().offset() - fragment.start()));
+ float cursor_x = fragment_rect.x() + font().width(fragment.text().substring_view(0, browsing_context().cursor_position().offset() - fragment.start()));
float cursor_top = fragment_rect.top();
float cursor_height = fragment_rect.height();
Gfx::IntRect cursor_rect(cursor_x, cursor_top, 1, cursor_height);
@@ -234,7 +234,7 @@ void TextNode::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint& positi
if (!parent() || !is<Label>(*parent()))
return;
downcast<Label>(*parent()).handle_mousedown_on_label({}, position, button);
- frame().event_handler().set_mouse_event_tracking_layout_node(this);
+ browsing_context().event_handler().set_mouse_event_tracking_layout_node(this);
}
void TextNode::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned)
@@ -246,7 +246,7 @@ void TextNode::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position
NonnullRefPtr protect = *this;
downcast<Label>(*parent()).handle_mouseup_on_label({}, position, button);
- frame().event_handler().set_mouse_event_tracking_layout_node(nullptr);
+ browsing_context().event_handler().set_mouse_event_tracking_layout_node(nullptr);
}
void TextNode::handle_mousemove(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned)