Skip to content

Commit

Permalink
WebView: Plumb visibility state changes from Qt to LibWeb
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Sep 19, 2022
1 parent 9db8c19 commit 9aa5753
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions WebView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,3 +587,15 @@ void WebView::set_color_scheme(ColorScheme color_scheme)
if (auto* document = m_page_client->page().top_level_browsing_context().active_document())
document->invalidate_style();
}

void WebView::showEvent(QShowEvent*event)
{
QAbstractScrollArea::showEvent(event);
m_page_client->page().top_level_browsing_context().set_system_visibility_state(Web::HTML::VisibilityState::Visible);
}

void WebView::hideEvent(QHideEvent*event)
{
QAbstractScrollArea::hideEvent(event);
m_page_client->page().top_level_browsing_context().set_system_visibility_state(Web::HTML::VisibilityState::Hidden);
}
3 changes: 3 additions & 0 deletions WebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class WebView final : public QAbstractScrollArea {
virtual void mouseReleaseEvent(QMouseEvent*) override;
virtual void keyPressEvent(QKeyEvent* event) override;
virtual void keyReleaseEvent(QKeyEvent* event) override;
virtual void showEvent(QShowEvent*) override;
virtual void hideEvent(QHideEvent*) override;

void debug_request(String const& request, String const& argument);

String source() const;
Expand Down

0 comments on commit 9aa5753

Please sign in to comment.