LibWeb: Rename Navigable::m_size to ::m_viewport_size

All other viewport-related dimensions are referenced to by 'viewport',
so let's rename the member that stores the viewport size to prevent
further confusion.
This commit is contained in:
Jelle Raaijmakers 2025-06-17 16:29:06 +02:00 committed by Tim Ledbetter
parent 46a46a1c61
commit e104d896eb
Notes: github-actions[bot] 2025-06-17 16:19:01 +00:00
3 changed files with 7 additions and 8 deletions

View file

@ -1803,7 +1803,7 @@ int Element::scroll_width() const
// 3. Let viewport width be the width of the viewport excluding the width of the scroll bar, if any, // 3. Let viewport width be the width of the viewport excluding the width of the scroll bar, if any,
// or zero if there is no viewport. // or zero if there is no viewport.
auto viewport_width = document.viewport_rect().width().to_int(); auto viewport_width = document.viewport_rect().width().to_int();
auto viewport_scroll_width = document.navigable()->size().width().to_int(); auto viewport_scroll_width = document.navigable()->viewport_size().width().to_int();
// 4. If the element is the root element and document is not in quirks mode // 4. If the element is the root element and document is not in quirks mode
// return max(viewport scrolling area width, viewport width). // return max(viewport scrolling area width, viewport width).
@ -1842,7 +1842,7 @@ int Element::scroll_height() const
// 3. Let viewport height be the height of the viewport excluding the height of the scroll bar, if any, // 3. Let viewport height be the height of the viewport excluding the height of the scroll bar, if any,
// or zero if there is no viewport. // or zero if there is no viewport.
auto viewport_height = document.viewport_rect().height().to_int(); auto viewport_height = document.viewport_rect().height().to_int();
auto viewport_scroll_height = document.navigable()->size().height().to_int(); auto viewport_scroll_height = document.navigable()->viewport_size().height().to_int();
// 4. If the element is the root element and document is not in quirks mode // 4. If the element is the root element and document is not in quirks mode
// return max(viewport scrolling area height, viewport height). // return max(viewport scrolling area height, viewport height).

View file

@ -2284,10 +2284,10 @@ CSSPixelPoint Navigable::to_top_level_position(CSSPixelPoint a_position)
void Navigable::set_viewport_size(CSSPixelSize size) void Navigable::set_viewport_size(CSSPixelSize size)
{ {
if (m_size == size) if (m_viewport_size == size)
return; return;
m_size = size; m_viewport_size = size;
if (auto document = active_document()) { if (auto document = active_document()) {
// NOTE: Resizing the viewport changes the reference value for viewport-relative CSS lengths. // NOTE: Resizing the viewport changes the reference value for viewport-relative CSS lengths.
document->invalidate_style(DOM::StyleInvalidationReason::NavigableSetViewportSize); document->invalidate_style(DOM::StyleInvalidationReason::NavigableSetViewportSize);

View file

@ -167,10 +167,9 @@ public:
CSSPixelPoint to_top_level_position(CSSPixelPoint); CSSPixelPoint to_top_level_position(CSSPixelPoint);
CSSPixelRect to_top_level_rect(CSSPixelRect const&); CSSPixelRect to_top_level_rect(CSSPixelRect const&);
CSSPixelSize size() const { return m_size; }
CSSPixelPoint viewport_scroll_offset() const { return m_viewport_scroll_offset; } CSSPixelPoint viewport_scroll_offset() const { return m_viewport_scroll_offset; }
CSSPixelRect viewport_rect() const { return { m_viewport_scroll_offset, m_size }; } CSSPixelRect viewport_rect() const { return { m_viewport_scroll_offset, m_viewport_size }; }
CSSPixelSize viewport_size() const { return m_viewport_size; }
virtual void set_viewport_size(CSSPixelSize); virtual void set_viewport_size(CSSPixelSize);
void perform_scroll_of_viewport(CSSPixelPoint position); void perform_scroll_of_viewport(CSSPixelPoint position);
@ -246,7 +245,7 @@ private:
bool m_has_been_destroyed { false }; bool m_has_been_destroyed { false };
CSSPixelSize m_size; CSSPixelSize m_viewport_size;
CSSPixelPoint m_viewport_scroll_offset; CSSPixelPoint m_viewport_scroll_offset;
Web::EventHandler m_event_handler; Web::EventHandler m_event_handler;