1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

LibWeb: Change viewport ownership from BrowsingContext to Navigable

This commit is contained in:
Aliaksandr Kalenik 2023-08-22 16:00:42 +02:00 committed by Andreas Kling
parent 4356d37b2c
commit dd7bba66ed
23 changed files with 196 additions and 129 deletions

View file

@ -46,8 +46,8 @@ double VisualViewport::offset_left() const
return 0;
// 2. Otherwise, return the offset of the left edge of the visual viewport from the left edge of the layout viewport.
VERIFY(m_document->browsing_context());
return m_document->browsing_context()->viewport_rect().left().to_double();
VERIFY(m_document->navigable());
return m_document->viewport_rect().left().to_double();
}
// https://drafts.csswg.org/cssom-view/#dom-visualviewport-offsettop
@ -58,8 +58,8 @@ double VisualViewport::offset_top() const
return 0;
// 2. Otherwise, return the offset of the top edge of the visual viewport from the top edge of the layout viewport.
VERIFY(m_document->browsing_context());
return m_document->browsing_context()->viewport_rect().top().to_double();
VERIFY(m_document->navigable());
return m_document->viewport_rect().top().to_double();
}
// https://drafts.csswg.org/cssom-view/#dom-visualviewport-pageleft
@ -95,8 +95,8 @@ double VisualViewport::width() const
// 2. Otherwise, return the width of the visual viewport
// FIXME: excluding the width of any rendered vertical classic scrollbar that is fixed to the visual viewport.
VERIFY(m_document->browsing_context());
return m_document->browsing_context()->viewport_rect().width().to_double();
VERIFY(m_document->navigable());
return m_document->viewport_rect().width().to_double();
}
// https://drafts.csswg.org/cssom-view/#dom-visualviewport-height
@ -108,8 +108,8 @@ double VisualViewport::height() const
// 2. Otherwise, return the height of the visual viewport
// FIXME: excluding the height of any rendered vertical classic scrollbar that is fixed to the visual viewport.
VERIFY(m_document->browsing_context());
return m_document->browsing_context()->viewport_rect().height().to_double();
VERIFY(m_document->navigable());
return m_document->viewport_rect().height().to_double();
}
// https://drafts.csswg.org/cssom-view/#dom-visualviewport-scale