Chromium Code Reviews| Index: third_party/WebKit/PerformanceTests/Editing/move-down-with-hidden-elements.html |
| diff --git a/third_party/WebKit/PerformanceTests/Editing/move-down-with-hidden-elements.html b/third_party/WebKit/PerformanceTests/Editing/move-down-with-hidden-elements.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f1454478048d73b58db5366036c3fe3cc676faff |
| --- /dev/null |
| +++ b/third_party/WebKit/PerformanceTests/Editing/move-down-with-hidden-elements.html |
| @@ -0,0 +1,33 @@ |
| +<!doctype html> |
| +<script src="../resources/runner.js"></script> |
| +<div id="sample"></div> |
| +<script> |
| +const kCount = 10; |
| + |
| +const metaElements = (() => { |
| + const result = []; |
| + for (let count = 0; count < 100; ++count) |
|
yoichio
2017/02/14 04:00:20
Amount of 100 <meta>s is O.K. to get better metric
|
| + result.push('<meta>', '</meta>'); |
| + return result; |
| +})(); |
| +const sample = document.getElementById('sample'); |
| +sample.innerHTML = [ |
| + '<div hiddent>', ...metaElements, '</div>', |
| + '<h1 id="target">first line of renderered text</h1>', |
| + '<div hiddent>', ...metaElements, '</div>', |
| +].join(''); |
| + |
| +const selection = window.getSelection(); |
| +const target = document.getElementById('target'); |
| + |
| +PerfTestRunner.measureRunsPerSecond({ |
| + description: 'Measures performance of move-down through non-renderered elements', |
| + run: () => { |
| + selection.collapse(target, 0); |
| + selection.extend(target, target.childNodes.length); |
| + for (let counter = 0; counter < kCount; ++counter) |
| + selection.modify('move', 'forward', 'line'); |
| + }, |
| +}); |
| +</script> |
| +</body> |