Commit 22871189 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Chromium LUCI CQ

Handle empty viewport in AdjustRasterScaleForTransformAnimation()

Previously empty viewport triggered DCHECK failure in user
environments.

Bug: 1155943, 1153428
Change-Id: I15f784a3196d412621a2ab7a4e9bf99f2efe133a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2576777
Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarvmpstr <vmpstr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: vmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834244}
parent 130fc581
...@@ -1491,13 +1491,16 @@ void PictureLayerImpl::AdjustRasterScaleForTransformAnimation( ...@@ -1491,13 +1491,16 @@ void PictureLayerImpl::AdjustRasterScaleForTransformAnimation(
if (maximum_scale == kNotScaled && starting_scale == kNotScaled) if (maximum_scale == kNotScaled && starting_scale == kNotScaled)
return; return;
gfx::Size viewport = layer_tree_impl()->GetDeviceViewport().size();
if (viewport.IsEmpty())
return;
// We rasterize at the maximum scale that will occur during the animation. // We rasterize at the maximum scale that will occur during the animation.
raster_contents_scale_ = std::max(maximum_scale, starting_scale); raster_contents_scale_ = std::max(maximum_scale, starting_scale);
DCHECK_NE(raster_contents_scale_, kNotScaled); DCHECK_NE(raster_contents_scale_, kNotScaled);
// However we want to avoid excessive memory use. Choose a scale at which this // However we want to avoid excessive memory use. Choose a scale at which this
// layer's rastered content is not larger than the viewport. // layer's rastered content is not larger than the viewport.
gfx::Size viewport = layer_tree_impl()->GetDeviceViewport().size();
float max_viewport_dimension = std::max(viewport.width(), viewport.height()); float max_viewport_dimension = std::max(viewport.width(), viewport.height());
DCHECK(max_viewport_dimension); DCHECK(max_viewport_dimension);
// Use square to compensate for viewports with different aspect ratios. // Use square to compensate for viewports with different aspect ratios.
......
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