Chromium Code Reviews| Index: PerformanceTests/resources/runner.js |
| diff --git a/PerformanceTests/resources/runner.js b/PerformanceTests/resources/runner.js |
| index ffa6fa7669f77110a50df0b171a4b7e206bc4093..c09754a546a5197137653f9485b4bde936818435 100644 |
| --- a/PerformanceTests/resources/runner.js |
| +++ b/PerformanceTests/resources/runner.js |
| @@ -137,6 +137,24 @@ if (window.testRunner) { |
| finish(); |
| } |
| + PerfTestRunner.forceLayout = function(doc) { |
| + doc = doc || document; |
| + // Forcing full layout is only fully feasible when window.internals is available. |
|
leviw_travelin_and_unemployed
2014/10/30 20:33:53
I don't think this naming is right. Simply calling
Xianzhu
2014/10/30 21:29:12
I'm not sure what the correct name is. I thought s
|
| + if (window.fullLayoutMeasurement) { |
| + if (window.internals) |
| + internals.forceCompositingUpdate(doc); |
| + else |
| + PerfTestRunner.logFatalError('window.internals API is required for full layout measurement.'); |
| + return; |
| + } |
| + |
| + // Otherwise just force style recalc and layout without compositing update and paint invalidation. |
| + if (doc.body) |
| + doc.body.offsetHeight; |
| + else if (doc.documentElement) |
| + doc.documentElement.offsetHeight; |
| + }; |
| + |
| function start(test, runner) { |
| if (!test) { |
| PerfTestRunner.logFatalError("Got a bad test object."); |
| @@ -311,12 +329,7 @@ if (window.testRunner) { |
| for (var chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) { |
| iframe.contentDocument.write(chunks[chunkIndex]); |
| - // Note that we won't cause a style resolve until we've encountered the <body> element. |
| - // Thus the number of chunks counted above is not exactly equal to the number of style resolves. |
| - if (iframe.contentDocument.body) |
| - iframe.contentDocument.body.clientHeight; // Force a full layout/style-resolve. |
| - else if (iframe.documentElement.localName == 'html') |
| - iframe.contentDocument.documentElement.offsetWidth; // Force the painting. |
| + PerfTestRunner.forceLayout(iframe.contentDocument); |
| } |
| iframe.contentDocument.close(); |