mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:35:07 +00:00
Ladybird/WebView: Implement page_did_request_scroll_into_view()
This makes #foo links actually scroll the #foo element into view.
This commit is contained in:
parent
345faff586
commit
6ee92a1fd0
1 changed files with 9 additions and 1 deletions
|
@ -285,8 +285,16 @@ public:
|
|||
m_view.horizontalScrollBar()->setPageStep(m_viewport_rect.width());
|
||||
}
|
||||
|
||||
virtual void page_did_request_scroll_into_view(Gfx::IntRect const&) override
|
||||
virtual void page_did_request_scroll_into_view(Gfx::IntRect const& rect) override
|
||||
{
|
||||
if (m_viewport_rect.contains(rect))
|
||||
return;
|
||||
|
||||
if (rect.top() < m_viewport_rect.top()) {
|
||||
m_view.verticalScrollBar()->setValue(rect.top());
|
||||
} else if (rect.top() > m_viewport_rect.top() && rect.bottom() > m_viewport_rect.bottom()) {
|
||||
m_view.verticalScrollBar()->setValue(rect.bottom() - m_viewport_rect.height() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void page_did_request_alert(String const& message) override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue