1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:28:13 +00:00

LibWeb: Rename Web::Frame to Web::BrowsingContext

Our "frame" concept very closely matches what the web specs call a
"browsing context", so let's rename it to that. :^)

The "main frame" becomes the "top-level browsing context",
and "sub-frames" are now "nested browsing contexts".
This commit is contained in:
Andreas Kling 2021-05-30 12:36:53 +02:00
parent 8be98af77c
commit 4190fd2199
43 changed files with 241 additions and 241 deletions

View file

@ -50,7 +50,7 @@
#include <LibWeb/Layout/TreeBuilder.h>
#include <LibWeb/Namespace.h>
#include <LibWeb/Origin.h>
#include <LibWeb/Page/Frame.h>
#include <LibWeb/Page/BrowsingContext.h>
#include <LibWeb/SVG/TagNames.h>
#include <LibWeb/UIEvents/MouseEvent.h>
#include <ctype.h>
@ -281,22 +281,22 @@ void Document::set_title(const String& title)
title_element->append_child(adopt_ref(*new Text(*this, title)));
if (auto* page = this->page()) {
if (frame() == &page->main_frame())
if (browsing_context() == &page->top_level_browsing_context())
page->client().page_did_change_title(title);
}
}
void Document::attach_to_frame(Badge<Frame>, Frame& frame)
void Document::attach_to_browsing_context(Badge<BrowsingContext>, BrowsingContext& browsing_context)
{
m_frame = frame;
m_browsing_context = browsing_context;
update_layout();
}
void Document::detach_from_frame(Badge<Frame>, Frame& frame)
void Document::detach_from_browsing_context(Badge<BrowsingContext>, BrowsingContext& browsing_context)
{
VERIFY(&frame == m_frame);
VERIFY(&browsing_context == m_browsing_context);
tear_down_layout_tree();
m_frame = nullptr;
m_browsing_context = nullptr;
}
void Document::tear_down_layout_tree()
@ -399,7 +399,7 @@ void Document::force_layout()
void Document::update_layout()
{
if (!frame())
if (!browsing_context())
return;
if (!m_layout_root) {
@ -412,7 +412,7 @@ void Document::update_layout()
m_layout_root->set_needs_display();
if (frame()->is_main_frame()) {
if (browsing_context()->is_top_level()) {
if (auto* page = this->page())
page->client().page_did_layout();
}
@ -881,12 +881,12 @@ void Document::set_ready_state(const String& ready_state)
Page* Document::page()
{
return m_frame ? m_frame->page() : nullptr;
return m_browsing_context ? m_browsing_context->page() : nullptr;
}
const Page* Document::page() const
{
return m_frame ? m_frame->page() : nullptr;
return m_browsing_context ? m_browsing_context->page() : nullptr;
}
EventTarget* Document::get_parent(const Event& event)