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

Unified Diff: PerformanceTests/Layout/resources/regions.js

Issue 76293002: [CSS Regions] Add performance test for selection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « PerformanceTests/Layout/RegionsSelection.html ('k') | PerformanceTests/Skipped » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+
})();
« no previous file with comments | « PerformanceTests/Layout/RegionsSelection.html ('k') | PerformanceTests/Skipped » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698