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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/touch/touch-action-range-input-csp.html

Issue 2359813002: Allows inline style in User-Agent shadow trees under CSP (Closed)
Patch Set: Check using containingShadowRoot and ShadowRootType Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta http-equiv="Content-Security-Policy" content="style-src 'self'">
3 <script src='../../../resources/testharness.js'></script>
4 <script src='../../../resources/testharnessreport.js'></script>
5 <div id='space1'></div>
6 <div><input type='range' id='slider' min = '0' max = '100' step = '10'></input>< /div>
7 <div id='space2'></div>
8
9 <script>
10 function forceLayoutUpdate() {
11 document.body.offsetTop;
12 }
13
14 function buildPage() {
15 var space1 = document.getElementById('space1');
16 var space2 = document.getElementById('space2');
17 for (var i = 0; i < 50; ++i) {
18 var br = document.createElement('br');
19 space1.appendChild(br);
20 space2.appendChild(br);
21 }
22 }
23
24 forceLayoutUpdate();
25 buildPage();
26 forceLayoutUpdate();
27
28 var slider = document.getElementById('slider');
29 var container = internals.shadowRoot(slider).children[0];
30 const touchSourceType = 1;
31
32
33 var isMac = navigator.platform.indexOf('Mac') == 0;
34 if (!isMac) {
35 testSliderH();
36 } else {
37 testTouchAction();
38 }
39
40 function testSliderH() {
41 var testSliderH = async_test('Changes the value of a horizontal slider.');
42 testSliderH.step(function () {
43 var offsetX = window.pageXOffset;
44 var offsetY = window.pageYOffset;
45 var w = slider.clientWidth;
46 var h = slider.clientHeight;
47 var x = slider.offsetLeft + w / 2 - offsetX;
48 var y = slider.offsetTop + h / 2 - offsetY;
49 assert_equals(parseInt(slider.value), 50);
50 // Perform a left drag with a bit up on the thumb.
51 chrome.gpuBenchmarking.smoothDrag(x, y, x - w, y - w / 2,
52 function() {
53 // Should set slider's value to 0.
54 assert_equals(parseInt(slider.value), 0);
55 // Should not drag the page vertically.
56 assert_approx_equals(window.pageYOffset, offsetY, 10);
57 // Should not drag the page horizontally.
58 assert_approx_equals(window.pageXOffset, offsetX, 0);
59 testSliderV();
60 testSliderH.done();
61 }, touchSourceType);
62 });
63 }
64
65 function testSliderV() {
66 var testSliderV = async_test('Drags up on a horizontal slider.');
67 testSliderV.step(function () {
68 var offsetX = window.pageXOffset;
69 var offsetY = window.pageYOffset;
70 var w = slider.clientWidth;
71 var h = slider.clientHeight;
72 var x = slider.offsetLeft - offsetX;
73 var y = slider.offsetTop - offsetY;
74 assert_equals(parseInt(slider.value), 0);
75 // Perform an up drag with a bit right on the thumb.
76 chrome.gpuBenchmarking.smoothDrag(x, y, x + 10, y - 100,
77 function() {
78 // Should not change slider's value.
79 assert_equals(parseInt(slider.value), 0);
80 // Should drag the page upwards.
81 assert_approx_equals(window.pageYOffset, offsetY + 85, 10);
82 // Should not drag the page horizontally.
83 assert_approx_equals(window.pageXOffset, offsetX, 0);
84 testTouchAction();
85 testSliderV.done();
86 }, touchSourceType);
87 });
88 }
89
90 function testTouchAction() {
91 test(() => {
92 assert_equals(getComputedStyle(container).touchAction, 'pan-y');
93 }, 'Tests that <input range="type"> has the correct pan-x or pan-y touch-actio n inside its shadow element: container.');
94 }
95 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698