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

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

Issue 2610243002: Import wpt@5e1a3b80cea8d36774d2afd78b29a74792e9f15a (Closed)
Patch Set: Rebased Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Invokes callback from a trusted click event, to satisfy 1 // Invokes callback from a trusted click event, to satisfy
2 // https://html.spec.whatwg.org/#triggered-by-user-activation 2 // https://html.spec.whatwg.org/#triggered-by-user-activation
3 function trusted_click(callback, container) 3 function trusted_click(test, callback, container)
4 { 4 {
5 var document = container.ownerDocument; 5 var document = container.ownerDocument;
6 var button = document.createElement("button"); 6 var button = document.createElement("button");
7 button.textContent = "click to continue test"; 7 button.textContent = "click to continue test";
8 button.style.display = "block"; 8 button.style.display = "block";
9 button.style.fontSize = "20px"; 9 button.style.fontSize = "20px";
10 button.style.padding = "10px"; 10 button.style.padding = "10px";
11 button.onclick = function() 11 button.onclick = test.step_func(function()
12 { 12 {
13 callback(); 13 callback();
14 container.removeChild(button); 14 container.removeChild(button);
15 }; 15 });
16 container.appendChild(button); 16 container.appendChild(button);
17 } 17 }
18 18
19 // Invokes element.requestFullscreen() from a trusted click. 19 // Invokes element.requestFullscreen() from a trusted click.
20 function trusted_request(element, container) 20 function trusted_request(test, element, container)
21 { 21 {
22 var request = element.requestFullscreen.bind(element); 22 trusted_click(test, () => element.requestFullscreen(), container || element. parentNode);
23 trusted_click(request, container || element.parentNode);
24 } 23 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698