Commit ba05b791 authored by bokan@chromium.org's avatar bokan@chromium.org

Don't calculate a top controls adjustment if pinch viewport size is uninitialized.

This was causing a NaN assertion further on in FrameView::maximumScrollPosition.

BUG=425757

Review URL: https://codereview.chromium.org/663993003

git-svn-id: svn://svn.chromium.org/blink/trunk@184298 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ad7b2dcd
......@@ -1687,6 +1687,9 @@ void WebViewImpl::performResize()
if (pinchVirtualViewportEnabled())
page()->frameHost().pinchViewport().setSize(m_size);
// In case we didn't have a size when the top controls were updated.
didUpdateTopControls();
// When device emulation is enabled, device size values may change - they are
// usually set equal to the view size. These values are not considered viewport-dependent
// (see MediaQueryExp::isViewportDependent), since they are only viewport-dependent in emulation mode,
......@@ -1729,6 +1732,10 @@ void WebViewImpl::didUpdateTopControls()
view->setTopControlsViewportAdjustment(topControlsViewportAdjustment);
} else {
PinchViewport& pinchViewport = page()->frameHost().pinchViewport();
if (pinchViewport.visibleRect().isEmpty())
return;
pinchViewport.setTopControlsAdjustment(topControlsViewportAdjustment);
// Shrink the FrameView by the amount that will maintain the aspect-ratio with the PinchViewport.
......
......@@ -353,8 +353,7 @@ template<> inline double defaultMinimumForClamp<double>() { return -std::numeric
// And, finally, the actual function for people to call.
template<typename LimitType, typename ValueType> inline LimitType clampTo(ValueType value, LimitType min = defaultMinimumForClamp<LimitType>(), LimitType max = defaultMaximumForClamp<LimitType>())
{
// FIXME: Uncomment this after fixing all callsites which violate it.
// ASSERT(!std::isnan(static_cast<double>(value)));
ASSERT(!std::isnan(static_cast<double>(value)));
ASSERT(min <= max); // This also ensures |min| and |max| aren't NaN.
return ClampToHelper<LimitType, ValueType>::clampTo(value, min, max);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment