chromium-bidi icon indicating copy to clipboard operation
chromium-bidi copied to clipboard

Document screenshots are not using document scroll height

Open OrKoN opened this issue 1 year ago • 3 comments

The issue can be reproduced by the following test in Puppeteer:

    it('should work with odd clip size on Retina displays', async () => {
      const {page} = await getTestState();
      const screenshot = await page.screenshot({
        clip: {
          x: 0,
          y: 0,
          width: 11,
          height: 11,
        },
      });
      expect(screenshot).toBeGolden('screenshot-clip-odd-size.png');
    });

The screenshot is taken using origin=document. The test passes in Chrome while it should not according to the spec. The spec says that the document elements scroll height should be used to determine the screenshot size and in this case the scroll height is only 8px so it should not be possible to generate the screenshot with the height of 11px.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1873090

OrKoN avatar Jan 12 '24 08:01 OrKoN

@jrandolf it looks like the final spec text deviated from the original intention here? at least it looks like chromium-bidi implementation is not matching the spec completely so it is possible that a screenshot with fullPage=true is smaller than the fullPage=false. WDYT? it looks like we should fix it on the chromium-bidi side and adjust Puppeteer tests.

OrKoN avatar Jan 12 '24 08:01 OrKoN

There was some discussion on Matrix.

whimboo avatar Jan 17 '24 10:01 whimboo

We will fix the issue in Chromium BiDi.

jrandolf-google avatar Jan 17 '24 11:01 jrandolf-google