w3c / Mobile-Checker

The Mobile Checker is a tool for Web developers who want to make their Web page or Web app work better on mobile devices.
https://validator.w3.org/mobile-alpha/
MIT License
322 stars 84 forks source link

Mobile screenshot and device-width not quite right #51

Open dontcallmedom opened 10 years ago

dontcallmedom commented 10 years ago

Right now, when meta viewport set width to device-width, we render the page on a screen set to the size of the device-width and take a screenshot of that same size. While that behavior is correct for initial-scale=1, it's not for device-width where the zoom level is adjusted to the the widest part of the page.

dontcallmedom commented 10 years ago

I thought we could fix this by adapting the browser window size depending on whether the calculated viewport.zoom is set to null or not; but while that works for getting the right content on the screenshot, it breaks our handling of media queries :(

What we would really need is to tell webdriver the size of the content we want to see rendered in the screenshot, independently of the size of the window; but that doesn't seem to be an option at the moment. Even asking for a screenshot of the full page (which we would then crop as needed) would work, but that's no longer a possibility with chromedriver: https://code.google.com/p/chromedriver/issues/detail?id=294

We could try to do it ourselves by scrolling and stitching several screenshots together (the same way people are working around the lack of "full page" screenshot in chromedriver), but that's kind of expensive and not reliable when there are fixed elements.

Not many options in front of us; except maybe if we switch to a firefox-based system? (firefox seems to do fullpage screenshot)

gbaudusseau commented 9 years ago

if we want to provide in the future different kind of browser, switch to firefox can't be the final solution...

gbaudusseau commented 9 years ago

fixed in using scrolling.

dontcallmedom commented 9 years ago

I don't think that fixes the issue I was reporting, so re-opening