summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-09 02:07:32 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-09 02:30:54 +0200
commitd1100dd6bcc3f119d955c8655bd1e1976d767d6c (patch)
treeb18330c2c7f237840582420d231188cc6e3689cd /Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
parent5356de1c58bcee409075e808c7460defbb2e8679 (diff)
downloadserenity-d1100dd6bcc3f119d955c8655bd1e1976d767d6c.zip
LibWeb: Add BrowsingContext::container() to align with the spec
We already have a base class for frame elements that we call BrowsingContextContainer. This patch makes BrowsingContext::container() actually return one of those. This makes us match the spec names, and also solves a FIXME about having a shared base for <frame> and <iframe>. (We already had the shared base, but the pointer we had there wasn't tightly typed enough.)
Diffstat (limited to 'Userland/Libraries/LibWeb/Page/BrowsingContext.cpp')
-rw-r--r--Userland/Libraries/LibWeb/Page/BrowsingContext.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp b/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
index fc7aaf6a5a..23a1725ba8 100644
--- a/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/Page/BrowsingContext.cpp
@@ -18,12 +18,12 @@
namespace Web {
-BrowsingContext::BrowsingContext(Page& page, DOM::Element* host_element, BrowsingContext& top_level_browsing_context)
+BrowsingContext::BrowsingContext(Page& page, HTML::BrowsingContextContainer* container, BrowsingContext& top_level_browsing_context)
: m_page(page)
, m_top_level_browsing_context(top_level_browsing_context)
, m_loader(*this)
, m_event_handler({}, *this)
- , m_host_element(host_element)
+ , m_container(container)
{
m_cursor_blink_timer = Core::Timer::construct(500, [this] {
if (!is_focused_context())
@@ -35,8 +35,8 @@ BrowsingContext::BrowsingContext(Page& page, DOM::Element* host_element, Browsin
});
}
-BrowsingContext::BrowsingContext(DOM::Element& host_element, BrowsingContext& top_level_browsing_context)
- : BrowsingContext(*top_level_browsing_context.page(), &host_element, top_level_browsing_context)
+BrowsingContext::BrowsingContext(HTML::BrowsingContextContainer& container, BrowsingContext& top_level_browsing_context)
+ : BrowsingContext(*top_level_browsing_context.page(), &container, top_level_browsing_context)
{
}
@@ -147,8 +147,8 @@ void BrowsingContext::set_needs_display(Gfx::IntRect const& rect)
return;
}
- if (host_element() && host_element()->layout_node())
- host_element()->layout_node()->set_needs_display();
+ if (container() && container()->layout_node())
+ container()->layout_node()->set_needs_display();
}
void BrowsingContext::scroll_to_anchor(String const& fragment)
@@ -199,11 +199,11 @@ Gfx::IntPoint BrowsingContext::to_top_level_position(Gfx::IntPoint const& a_posi
for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
if (ancestor->is_top_level())
break;
- if (!ancestor->host_element())
+ if (!ancestor->container())
return {};
- if (!ancestor->host_element()->layout_node())
+ if (!ancestor->container()->layout_node())
return {};
- position.translate_by(ancestor->host_element()->layout_node()->box_type_agnostic_position().to_type<int>());
+ position.translate_by(ancestor->container()->layout_node()->box_type_agnostic_position().to_type<int>());
}
return position;
}