1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:57:45 +00:00

LibWeb+WebContent+Browser: Plumb visibility state from GUI to web pages

OOPWV now reacts to show/hide events and informs LibWeb about the state
change. This makes visibilitychange events fire when switching tabs. :^)
This commit is contained in:
Andreas Kling 2022-09-19 20:50:33 +02:00
parent 5908873b45
commit d4acdac317
14 changed files with 150 additions and 11 deletions

View file

@ -31,6 +31,7 @@
#include <LibWeb/HTML/Origin.h>
#include <LibWeb/HTML/SandboxingFlagSet.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/VisibilityState.h>
#include <LibWeb/HTML/Window.h>
namespace Web::DOM {
@ -319,7 +320,7 @@ public:
String visibility_state() const;
// https://html.spec.whatwg.org/multipage/interaction.html#update-the-visibility-state
void update_the_visibility_state(String visibility_state);
void update_the_visibility_state(HTML::VisibilityState);
void run_the_resize_steps();
void run_the_scroll_steps();
@ -382,6 +383,9 @@ public:
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-policy-container
HTML::PolicyContainer policy_container() const;
// https://html.spec.whatwg.org/multipage/browsers.html#list-of-the-descendant-browsing-contexts
Vector<NonnullRefPtr<HTML::BrowsingContext>> list_of_descendant_browsing_contexts() const;
protected:
virtual void visit_edges(Cell::Visitor&) override;
@ -527,7 +531,7 @@ private:
HTML::PolicyContainer m_policy_container;
// https://html.spec.whatwg.org/multipage/interaction.html#visibility-state
String m_visibility_state { "hidden" };
HTML::VisibilityState m_visibility_state { HTML::VisibilityState::Hidden };
};
}