DoublePoint VisualViewport::maximumScrollPositionDouble() const
{
    if (!mainFrame())
        return IntPoint();

    // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/422331.
    FloatSize frameViewSize(contentsSize());

    if (m_topControlsAdjustment) {
        float minScale = frameHost().pageScaleConstraintsSet().finalConstraints().minimumScale;
        frameViewSize.expand(0, m_topControlsAdjustment / minScale);
    }

    frameViewSize.scale(m_scale);
    frameViewSize = flooredIntSize(frameViewSize);

    FloatSize viewportSize(m_size);
    viewportSize.expand(0, m_topControlsAdjustment);

    FloatSize maxPosition = frameViewSize - viewportSize;
    maxPosition.scale(1 / m_scale);
    return DoublePoint(maxPosition);
}
Ejemplo n.º 2
0
ScrollOffset VisualViewport::maximumScrollOffset() const {
  if (!mainFrame())
    return ScrollOffset();

  // TODO(bokan): We probably shouldn't be storing the bounds in a float.
  // crbug.com/470718.
  FloatSize frameViewSize(contentsSize());

  if (m_browserControlsAdjustment) {
    float minScale =
        frameHost().pageScaleConstraintsSet().finalConstraints().minimumScale;
    frameViewSize.expand(0, m_browserControlsAdjustment / minScale);
  }

  frameViewSize.scale(m_scale);
  frameViewSize = FloatSize(flooredIntSize(frameViewSize));

  FloatSize viewportSize(m_size);
  viewportSize.expand(0, ceilf(m_browserControlsAdjustment));

  FloatSize maxPosition = frameViewSize - viewportSize;
  maxPosition.scale(1 / m_scale);
  return ScrollOffset(maxPosition);
}