OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <style> | 2 <style> |
3 body { | 3 body { |
4 margin: 0; | 4 margin: 0; |
5 } | 5 } |
6 .container { | 6 .container { |
7 height: 250px; | 7 height: 250px; |
8 width: 250px; | 8 width: 250px; |
9 margin-top: 50px; | 9 margin-top: 50px; |
10 display: block; | 10 display: block; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 var index = 0; | 70 var index = 0; |
71 function next(){ | 71 function next(){ |
72 if (index < testCases.length) { | 72 if (index < testCases.length) { |
73 var type = testCases[index][0]; | 73 var type = testCases[index][0]; |
74 debug('running tests for non-fast scrollable ' + type); | 74 debug('running tests for non-fast scrollable ' + type); |
75 runTest.apply(this, testCases[index]); | 75 runTest.apply(this, testCases[index]); |
76 } else { | 76 } else { |
77 // Next 3 statements have no functional impact just visual | 77 // Next 3 statements have no functional impact just visual |
78 showSectionIf(function(){return true;}); | 78 showSectionIf(function(){return true;}); |
79 awaitCompsitingUpdate(function(){ | 79 awaitCompsitingUpdate(function(){ |
80 runNonFastScrollableRegionTest(); | 80 drawNonFastScrollableRegionOverlays(); |
81 | 81 |
82 finishJSTest(); | 82 finishJSTest(); |
83 }); | 83 }); |
84 } | 84 } |
85 | 85 |
86 index++; | 86 index++; |
87 } | 87 } |
88 | 88 |
89 // Execute tests for given non-fast scrollable type. | 89 // Execute tests for given non-fast scrollable type. |
90 function runTest(type, elemToShowExpected, elemToHideExpected) { | 90 function runTest(type, elemToShowExpected, elemToHideExpected) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 container.innerHTML = inner; | 151 container.innerHTML = inner; |
152 } | 152 } |
153 | 153 |
154 // Shows sections that pass condition but hides others | 154 // Shows sections that pass condition but hides others |
155 function showSectionIf(condition) { | 155 function showSectionIf(condition) { |
156 var sections = document.querySelectorAll('section'); | 156 var sections = document.querySelectorAll('section'); |
157 for (var i = 0; i < sections.length; i++) | 157 for (var i = 0; i < sections.length; i++) |
158 sections[i].style.display = condition(sections[i]) ? 'block' : 'none'; | 158 sections[i].style.display = condition(sections[i]) ? 'block' : 'none'; |
159 } | 159 } |
160 | |
161 // Waits for one RAF call to ensure compositing update has occurred and invoke
s task. | |
162 function awaitCompsitingUpdate(task) { | |
163 window.requestAnimationFrame(task); | |
164 } | |
165 | |
166 function rectToString(rect) { | |
167 return '[' + [rect.left, rect.top, rect.width, rect.height].join(', ') + ']'
; | |
168 } | |
169 </script> | 160 </script> |
OLD | NEW |