Chromium Code Reviews| Index: PerformanceTests/Layout/resources/regions.js |
| diff --git a/PerformanceTests/Layout/resources/regions.js b/PerformanceTests/Layout/resources/regions.js |
| index b89e2d77be8a1c1d12fc25d8f4d3aeecd0d52eda..0a1f26405647d68cf7825862b8c02ed74005aebf 100644 |
| --- a/PerformanceTests/Layout/resources/regions.js |
| +++ b/PerformanceTests/Layout/resources/regions.js |
| @@ -88,5 +88,49 @@ |
| }; |
| } |
| + function mouseMoveToRegionCenter(region) { |
| + var rect = region.getBoundingClientRect(); |
| + eventSender.mouseMoveTo(rect.left + (rect.width / 2), rect.top + (rect.height / 2)); |
| + } |
| + |
| + function performSelection(regionCount) { |
| + var regions = document.getElementsByClassName("region"); |
| + |
| + if (window.eventSender) { |
| + mouseMoveToRegionCenter(regions[0]); |
| + eventSender.mouseDown(); |
| + |
| + for (var i = 1; i < regionCount; i++) |
| + mouseMoveToRegionCenter(regions[i]); |
| + |
| + eventSender.mouseUp(); |
| + } |
| + } |
| + |
| + function createRegionsSelectionTest(regionCount) { |
|
Julien - ping for review
2013/11/20 05:31:55
Why don't you directly do the following?
window.c
|
| + var article = createArticle(regionCount, 1); |
| + article.className = "articleInFlow"; |
| + var regions = createRegions("600px", "auto", regionCount, "auto"); |
| + document.body.appendChild(article); |
| + document.body.appendChild(regions); |
| + return { |
| + description: "Testing selection with " + regionCount + " regions. Select text from first region to last one passing through all the regions.", |
| + run: function() { |
| + performSelection(regionCount); |
| + }, |
| + setup: function() { |
| + window.getSelection().removeAllRanges(); |
| + }, |
| + done: function() { |
| + document.body.removeChild(article); |
| + document.body.removeChild(regions); |
| + templateParagraph = null; |
| + templateRegion = null; |
| + } |
| + }; |
| + } |
| + |
| window.createRegionsTest = createRegionsTest; |
| + window.createRegionsSelectionTest = createRegionsSelectionTest; |
| + |
| })(); |