mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
User activation is a concept used to prevents annoying usage of specific API (Fullscreen API, Virtual Keyboard) to the user by states that the API needs to have in order to process. This PR implements the `UserActivation` interface and keep track of the last user interaction. Each `Window` will keep track the [last activation time stamp](https://html.spec.whatwg.org/multipage/interaction.html#last-activation-timestamp), which will be set if there are a triggering input event firing in the `Window` and propagating across the browsing contexts ancestors and descendants. These timestamp could be consumed, and the timestamp will be set to negative infinite. It is then used to gate some APIs within browser that is determined as transient activation consuming-gated APIs, which needs transient activation to be true and consumes the activation. For the purpose of testing, this PR would implement this behavior on fullscreen API which is used to test activation consuming behavior. Spec: https://html.spec.whatwg.org/multipage/interaction.html#the-useractivation-interface Testing: Existing WPT --------- Signed-off-by: Jo Steven Novaryo <steven.novaryo@gmail.com>
15 lines
508 B
Plaintext
15 lines
508 B
Plaintext
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
// https://html.spec.whatwg.org/multipage/#the-useractivation-interface
|
|
[Exposed=Window]
|
|
interface UserActivation {
|
|
readonly attribute boolean hasBeenActive;
|
|
readonly attribute boolean isActive;
|
|
};
|
|
|
|
partial interface Navigator {
|
|
[SameObject] readonly attribute UserActivation userActivation;
|
|
};
|