1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

Ladybird/WebContentView: Accept focus and notify WebContent on change

This commit is contained in:
Andreas Kling 2022-10-11 11:38:03 +02:00 committed by Andrew Kaster
parent 71dadabfaa
commit c154d94964
2 changed files with 14 additions and 0 deletions

View file

@ -58,6 +58,8 @@ WebContentView::WebContentView()
{
setMouseTracking(true);
setFocusPolicy(Qt::FocusPolicy::StrongFocus);
m_inverse_pixel_scaling_ratio = 1.0 / devicePixelRatio();
verticalScrollBar()->setSingleStep(24);
@ -354,6 +356,16 @@ void WebContentView::keyReleaseEvent(QKeyEvent* event)
client().async_key_up(keycode, modifiers, point);
}
void WebContentView::focusInEvent(QFocusEvent*)
{
client().async_set_has_focus(true);
}
void WebContentView::focusOutEvent(QFocusEvent*)
{
client().async_set_has_focus(false);
}
Gfx::IntPoint WebContentView::to_content(Gfx::IntPoint viewport_position) const
{
return viewport_position.translated(horizontalScrollBar()->value(), verticalScrollBar()->value());