Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/fullscreen/trusted-click.js

Issue 2376103007: Import wpt@09907a9c4bcee14986431d53e4381384c7c69107 (Closed)
Patch Set: update platform expectations Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/fullscreen/trusted-click.js
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/fullscreen/trusted-click.js b/third_party/WebKit/LayoutTests/imported/wpt/fullscreen/trusted-click.js
new file mode 100644
index 0000000000000000000000000000000000000000..6cd4020f6edf02caf2bfaa122690b0f6260cd670
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/fullscreen/trusted-click.js
@@ -0,0 +1,24 @@
+// Invokes callback from a trusted click event, to satisfy
+// https://html.spec.whatwg.org/#triggered-by-user-activation
+function trusted_click(callback, container)
+{
+ var document = container.ownerDocument;
+ var button = document.createElement("button");
+ button.textContent = "click to continue test";
+ button.style.display = "block";
+ button.style.fontSize = "20px";
+ button.style.padding = "10px";
+ button.onclick = function()
+ {
+ callback();
+ container.removeChild(button);
+ };
+ container.appendChild(button);
+}
+
+// Invokes element.requestFullscreen() from a trusted click.
+function trusted_request(element, container)
+{
+ var request = element.requestFullscreen.bind(element);
+ trusted_click(request, container || element.parentNode);
+}

Powered by Google App Engine
This is Rietveld 408576698