From 6bc152ece01371da519bc942967540751fd93b2a Mon Sep 17 00:00:00 2001 From: Junyan <yancoding@gmail.com> Date: Mon, 2 Jan 2023 18:01:36 +0800 Subject: [PATCH] chore: small refactor for screenshotTask (#9451) --- packages/puppeteer-core/src/common/Page.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/puppeteer-core/src/common/Page.ts b/packages/puppeteer-core/src/common/Page.ts index e85d2713648..ea32e942e1c 100644 --- a/packages/puppeteer-core/src/common/Page.ts +++ b/packages/puppeteer-core/src/common/Page.ts @@ -1377,14 +1377,13 @@ export class CDPPage extends Page { const fromSurface = options.fromSurface; if (options.fullPage) { - const metrics = await this.#client.send('Page.getLayoutMetrics'); - // Fallback to `contentSize` in case of using Firefox. - const {width, height} = metrics.cssContentSize || metrics.contentSize; - // Overwrite clip for full page. clip = undefined; if (!captureBeyondViewport) { + const metrics = await this.#client.send('Page.getLayoutMetrics'); + // Fallback to `contentSize` in case of using Firefox. + const {width, height} = metrics.cssContentSize || metrics.contentSize; const { isMobile = false, deviceScaleFactor = 1,