1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +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

@ -5,7 +5,7 @@
*/
#include <LibWeb/InProcessWebView.h>
#include <LibWeb/Page/Frame.h>
#include <LibWeb/Page/BrowsingContext.h>
#include <LibWeb/Page/Page.h>
namespace Web {
@ -13,38 +13,38 @@ namespace Web {
Page::Page(PageClient& client)
: m_client(client)
{
m_main_frame = Frame::create(*this);
m_top_level_browsing_context = BrowsingContext::create(*this);
}
Page::~Page()
{
}
Frame& Page::focused_frame()
BrowsingContext& Page::focused_context()
{
if (m_focused_frame)
return *m_focused_frame;
return main_frame();
if (m_focused_context)
return *m_focused_context;
return top_level_browsing_context();
}
void Page::set_focused_frame(Badge<EventHandler>, Frame& frame)
void Page::set_focused_browsing_context(Badge<EventHandler>, BrowsingContext& browsing_context)
{
m_focused_frame = frame.make_weak_ptr();
m_focused_context = browsing_context.make_weak_ptr();
}
void Page::load(const URL& url)
{
main_frame().loader().load(url, FrameLoader::Type::Navigation);
top_level_browsing_context().loader().load(url, FrameLoader::Type::Navigation);
}
void Page::load(const LoadRequest& request)
{
main_frame().loader().load(request, FrameLoader::Type::Navigation);
top_level_browsing_context().loader().load(request, FrameLoader::Type::Navigation);
}
void Page::load_html(const StringView& html, const URL& url)
{
main_frame().loader().load_html(html, url);
top_level_browsing_context().loader().load_html(html, url);
}
Gfx::Palette Page::palette() const
@ -59,27 +59,27 @@ Gfx::IntRect Page::screen_rect() const
bool Page::handle_mousewheel(const Gfx::IntPoint& position, unsigned button, unsigned modifiers, int wheel_delta)
{
return main_frame().event_handler().handle_mousewheel(position, button, modifiers, wheel_delta);
return top_level_browsing_context().event_handler().handle_mousewheel(position, button, modifiers, wheel_delta);
}
bool Page::handle_mouseup(const Gfx::IntPoint& position, unsigned button, unsigned modifiers)
{
return main_frame().event_handler().handle_mouseup(position, button, modifiers);
return top_level_browsing_context().event_handler().handle_mouseup(position, button, modifiers);
}
bool Page::handle_mousedown(const Gfx::IntPoint& position, unsigned button, unsigned modifiers)
{
return main_frame().event_handler().handle_mousedown(position, button, modifiers);
return top_level_browsing_context().event_handler().handle_mousedown(position, button, modifiers);
}
bool Page::handle_mousemove(const Gfx::IntPoint& position, unsigned buttons, unsigned modifiers)
{
return main_frame().event_handler().handle_mousemove(position, buttons, modifiers);
return top_level_browsing_context().event_handler().handle_mousemove(position, buttons, modifiers);
}
bool Page::handle_keydown(KeyCode key, unsigned modifiers, u32 code_point)
{
return focused_frame().event_handler().handle_keydown(key, modifiers, code_point);
return focused_context().event_handler().handle_keydown(key, modifiers, code_point);
}
}