1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:57:46 +00:00

LibWeb: Convert BrowsingContext to east-const style

This commit is contained in:
Andreas Kling 2021-09-08 10:43:20 +02:00
parent 57fbeff925
commit 76b0253b6b
2 changed files with 25 additions and 25 deletions

View file

@ -88,7 +88,7 @@ void BrowsingContext::set_document(DOM::Document* document)
m_page->client().page_did_set_document_in_top_level_browsing_context(m_document);
}
void BrowsingContext::set_viewport_rect(const Gfx::IntRect& rect)
void BrowsingContext::set_viewport_rect(Gfx::IntRect const& rect)
{
bool did_change = false;
@ -112,7 +112,7 @@ void BrowsingContext::set_viewport_rect(const Gfx::IntRect& rect)
}
}
void BrowsingContext::set_size(const Gfx::IntSize& size)
void BrowsingContext::set_size(Gfx::IntSize const& size)
{
if (m_size == size)
return;
@ -126,7 +126,7 @@ void BrowsingContext::set_size(const Gfx::IntSize& size)
client->frame_did_set_viewport_rect(viewport_rect());
}
void BrowsingContext::set_viewport_scroll_offset(const Gfx::IntPoint& offset)
void BrowsingContext::set_viewport_scroll_offset(Gfx::IntPoint const& offset)
{
if (m_viewport_scroll_offset == offset)
return;
@ -136,7 +136,7 @@ void BrowsingContext::set_viewport_scroll_offset(const Gfx::IntPoint& offset)
client->frame_did_set_viewport_rect(viewport_rect());
}
void BrowsingContext::set_needs_display(const Gfx::IntRect& rect)
void BrowsingContext::set_needs_display(Gfx::IntRect const& rect)
{
if (!viewport_rect().intersects(rect))
return;
@ -151,7 +151,7 @@ void BrowsingContext::set_needs_display(const Gfx::IntRect& rect)
host_element()->layout_node()->set_needs_display();
}
void BrowsingContext::scroll_to_anchor(const String& fragment)
void BrowsingContext::scroll_to_anchor(String const& fragment)
{
if (!document())
return;
@ -186,14 +186,14 @@ void BrowsingContext::scroll_to_anchor(const String& fragment)
m_page->client().page_did_request_scroll_into_view(enclosing_int_rect(float_rect));
}
Gfx::IntRect BrowsingContext::to_top_level_rect(const Gfx::IntRect& a_rect)
Gfx::IntRect BrowsingContext::to_top_level_rect(Gfx::IntRect const& a_rect)
{
auto rect = a_rect;
rect.set_location(to_top_level_position(a_rect.location()));
return rect;
}
Gfx::IntPoint BrowsingContext::to_top_level_position(const Gfx::IntPoint& a_position)
Gfx::IntPoint BrowsingContext::to_top_level_position(Gfx::IntPoint const& a_position)
{
auto position = a_position;
for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
@ -279,7 +279,7 @@ void BrowsingContext::select_all()
if (!layout_root)
return;
const Layout::Node* first_layout_node = layout_root;
Layout::Node const* first_layout_node = layout_root;
for (;;) {
auto* next = first_layout_node->next_in_pre_order();
@ -290,9 +290,9 @@ void BrowsingContext::select_all()
break;
}
const Layout::Node* last_layout_node = first_layout_node;
Layout::Node const* last_layout_node = first_layout_node;
for (const Layout::Node* layout_node = first_layout_node; layout_node; layout_node = layout_node->next_in_pre_order()) {
for (Layout::Node const* layout_node = first_layout_node; layout_node; layout_node = layout_node->next_in_pre_order()) {
if (is<Layout::TextNode>(*layout_node))
last_layout_node = layout_node;
}

View file

@ -30,7 +30,7 @@ public:
class ViewportClient {
public:
virtual ~ViewportClient() { }
virtual void frame_did_set_viewport_rect(const Gfx::IntRect&) = 0;
virtual void frame_did_set_viewport_rect(Gfx::IntRect const&) = 0;
};
void register_viewport_client(ViewportClient&);
void unregister_viewport_client(ViewportClient&);
@ -38,41 +38,41 @@ public:
bool is_top_level() const { return this == &m_top_level_browsing_context; }
bool is_focused_context() const;
const DOM::Document* document() const { return m_document; }
DOM::Document const* document() const { return m_document; }
DOM::Document* document() { return m_document; }
void set_document(DOM::Document*);
Page* page() { return m_page; }
const Page* page() const { return m_page; }
Page const* page() const { return m_page; }
const Gfx::IntSize& size() const { return m_size; }
void set_size(const Gfx::IntSize&);
Gfx::IntSize const& size() const { return m_size; }
void set_size(Gfx::IntSize const&);
void set_needs_display(const Gfx::IntRect&);
void set_needs_display(Gfx::IntRect const&);
void set_viewport_scroll_offset(const Gfx::IntPoint&);
void set_viewport_scroll_offset(Gfx::IntPoint const&);
Gfx::IntRect viewport_rect() const { return { m_viewport_scroll_offset, m_size }; }
void set_viewport_rect(const Gfx::IntRect&);
void set_viewport_rect(Gfx::IntRect const&);
FrameLoader& loader() { return m_loader; }
const FrameLoader& loader() const { return m_loader; }
FrameLoader const& loader() const { return m_loader; }
EventHandler& event_handler() { return m_event_handler; }
const EventHandler& event_handler() const { return m_event_handler; }
EventHandler const& event_handler() const { return m_event_handler; }
void scroll_to_anchor(const String&);
void scroll_to_anchor(String const&);
BrowsingContext& top_level_browsing_context() { return m_top_level_browsing_context; }
BrowsingContext const& top_level_browsing_context() const { return m_top_level_browsing_context; }
DOM::Element* host_element() { return m_host_element; }
const DOM::Element* host_element() const { return m_host_element; }
DOM::Element const* host_element() const { return m_host_element; }
Gfx::IntPoint to_top_level_position(const Gfx::IntPoint&);
Gfx::IntRect to_top_level_rect(const Gfx::IntRect&);
Gfx::IntPoint to_top_level_position(Gfx::IntPoint const&);
Gfx::IntRect to_top_level_rect(Gfx::IntRect const&);
const DOM::Position& cursor_position() const { return m_cursor_position; }
DOM::Position const& cursor_position() const { return m_cursor_position; }
void set_cursor_position(DOM::Position);
bool increment_cursor_position_offset();
bool decrement_cursor_position_offset();