Chromium Code Reviews| Index: PerformanceTests/resources/runner.js |
| diff --git a/PerformanceTests/resources/runner.js b/PerformanceTests/resources/runner.js |
| index ffa6fa7669f77110a50df0b171a4b7e206bc4093..8014c7843841ea1cac041031ea2c36e9e1f93b4f 100644 |
| --- a/PerformanceTests/resources/runner.js |
| +++ b/PerformanceTests/resources/runner.js |
| @@ -137,6 +137,27 @@ if (window.testRunner) { |
| finish(); |
| } |
| + // Force a layout (including style recalc) if window.fullRenderingMeasurement is false, |
| + // or a full rendering (including style recalc, layout, compositing update and paint invalidation, |
| + // not including painting). |
| + PerfTestRunner.layoutOrFullyRender = function(doc) { |
|
Julien - ping for review
2014/11/17 19:05:46
Not a huge fan of this name (render is quite an ov
Xianzhu
2014/11/17 20:44:12
Renamed to forcelayoutOrFullFrame.
|
| + doc = doc || document; |
| + // Forcing full rendering is only feasible when window.internals is available. |
| + if (window.fullRenderingMeasurement) { |
| + if (window.internals) |
| + internals.forceCompositingUpdate(doc); |
| + else |
| + PerfTestRunner.logFatalError('window.internals API is required for full rendering 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 +332,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.layoutOrFullyRender(iframe.contentDocument); |
| } |
| iframe.contentDocument.close(); |