mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
LibWeb: Add Page abstraction between PageView and main Frame
* A PageView is a view onto a Page object. * A Page always has a main Frame (root of Frame tree.) * Page has a PageClient. PageView is a PageClient. The goal here is to allow building another kind of view onto a Page while keeping the rest of LibWeb intact.
This commit is contained in:
parent
5072d4e02d
commit
92392398a2
16 changed files with 351 additions and 179 deletions
|
@ -376,7 +376,7 @@ Color Document::link_color() const
|
|||
return m_link_color.value();
|
||||
if (!frame())
|
||||
return Color::Blue;
|
||||
return frame()->page_view()->palette().link();
|
||||
return frame()->page().palette().link();
|
||||
}
|
||||
|
||||
Color Document::active_link_color() const
|
||||
|
@ -385,7 +385,7 @@ Color Document::active_link_color() const
|
|||
return m_active_link_color.value();
|
||||
if (!frame())
|
||||
return Color::Red;
|
||||
return frame()->page_view()->palette().active_link();
|
||||
return frame()->page().palette().active_link();
|
||||
}
|
||||
|
||||
Color Document::visited_link_color() const
|
||||
|
@ -394,7 +394,7 @@ Color Document::visited_link_color() const
|
|||
return m_visited_link_color.value();
|
||||
if (!frame())
|
||||
return Color::Magenta;
|
||||
return frame()->page_view()->palette().visited_link();
|
||||
return frame()->page().palette().visited_link();
|
||||
}
|
||||
|
||||
JS::Interpreter& Document::interpreter()
|
||||
|
|
|
@ -72,7 +72,7 @@ void HTMLFormElement::submit(RefPtr<HTMLInputElement> submitter)
|
|||
url.set_query(url_encode(parameters));
|
||||
|
||||
// FIXME: We shouldn't let the form just do this willy-nilly.
|
||||
document().frame()->page_view()->load(url);
|
||||
document().frame()->page().load(url);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,8 +50,7 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*)
|
|||
{
|
||||
ASSERT(document().frame());
|
||||
auto& frame = *document().frame();
|
||||
ASSERT(frame.page_view());
|
||||
auto& page_view = const_cast<PageView&>(*frame.page_view());
|
||||
auto& page_view = const_cast<PageView&>(static_cast<const PageView&>(frame.page().client()));
|
||||
|
||||
if (type() == "hidden")
|
||||
return nullptr;
|
||||
|
|
|
@ -115,10 +115,7 @@ void Window::did_set_location_href(Badge<Bindings::LocationObject>, const String
|
|||
auto* frame = document().frame();
|
||||
if (!frame)
|
||||
return;
|
||||
auto* view = frame->page_view();
|
||||
if (!view)
|
||||
return;
|
||||
view->load(new_href);
|
||||
frame->loader().load(new_href);
|
||||
}
|
||||
|
||||
void Window::did_call_location_reload(Badge<Bindings::LocationObject>)
|
||||
|
@ -126,10 +123,7 @@ void Window::did_call_location_reload(Badge<Bindings::LocationObject>)
|
|||
auto* frame = document().frame();
|
||||
if (!frame)
|
||||
return;
|
||||
auto* view = frame->page_view();
|
||||
if (!view)
|
||||
return;
|
||||
view->reload();
|
||||
frame->loader().load(document().url());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue