ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, float devicePixelRatio, IntSize visibleViewport) { FloatSize initialViewportSize = convertToUserSpace(visibleViewport, devicePixelRatio); FloatSize deviceSize = convertToUserSpace(FloatSize(deviceWidth, deviceHeight), devicePixelRatio); return args.resolve(initialViewportSize, deviceSize, desktopWidth); }
ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, float devicePixelRatio, IntSize visibleViewport) { #if PLATFORM(IOS) // FIXME: This should probably be fixed elsewhere on iOS. iOS may only use computeViewportAttributes for tests. CGSize screenSize = wkGetViewportScreenSize(); visibleViewport.setWidth(screenSize.width); visibleViewport.setHeight(screenSize.height); #endif FloatSize initialViewportSize = convertToUserSpace(visibleViewport, devicePixelRatio); FloatSize deviceSize = convertToUserSpace(FloatSize(deviceWidth, deviceHeight), devicePixelRatio); return args.resolve(initialViewportSize, deviceSize, desktopWidth); }
void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport, float devicePixelRatio) { FloatSize viewportSize = convertToUserSpace(visibleViewport, devicePixelRatio); result.minimumScale = max<float>(result.minimumScale, max(viewportSize.width() / result.layoutSize.width(), viewportSize.height() / result.layoutSize.height())); }
float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& visibleViewport, const IntSize& contentsSize, float devicePixelRatio) { FloatSize viewportSize = convertToUserSpace(visibleViewport, devicePixelRatio); return max<float>(result.minimumScale, max(viewportSize.width() / contentsSize.width(), viewportSize.height() / contentsSize.height())); }