Commit 74cb0ac5 authored by Mitsuru Oshima's avatar Mitsuru Oshima Committed by Chromium LUCI CQ

Set the layer size before setting the transferable resource.

Bug: 1158058
Test: Added DCHECK. Updated the test to workardound the issue (crbug.com/1065281)

Change-Id: I47e2c96a636d574c814df622e1b15f347053eddb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2622660
Auto-Submit: Mitsuru Oshima <oshima@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842263}
parent 8153258d
...@@ -360,11 +360,10 @@ void ScreenRotationAnimator::CreateOldLayerTreeForSlowAnimation() { ...@@ -360,11 +360,10 @@ void ScreenRotationAnimator::CreateOldLayerTreeForSlowAnimation() {
std::unique_ptr<ui::LayerTreeOwner> ScreenRotationAnimator::CopyLayerTree( std::unique_ptr<ui::LayerTreeOwner> ScreenRotationAnimator::CopyLayerTree(
std::unique_ptr<viz::CopyOutputResult> result) { std::unique_ptr<viz::CopyOutputResult> result) {
DCHECK_EQ(result->size(),
GetScreenRotationContainer(root_window_)->layer()->size());
std::unique_ptr<ui::Layer> copy_layer = std::unique_ptr<ui::Layer> copy_layer =
CreateLayerFromCopyOutputResult(std::move(result)); CreateLayerFromCopyOutputResult(std::move(result));
const gfx::Rect rect(
GetScreenRotationContainer(root_window_)->layer()->size());
copy_layer->SetBounds(rect);
// TODO(crbug.com/1040279): This is a workaround and should be removed once // TODO(crbug.com/1040279): This is a workaround and should be removed once
// the issue is fixed. // the issue is fixed.
copy_layer->SetFillsBoundsOpaquely(false); copy_layer->SetFillsBoundsOpaquely(false);
......
...@@ -539,7 +539,12 @@ TEST_F(ScreenRotationAnimatorSmoothAnimationTest, ...@@ -539,7 +539,12 @@ TEST_F(ScreenRotationAnimatorSmoothAnimationTest,
// request callback called, it should stop rotating. // request callback called, it should stop rotating.
TEST_F(ScreenRotationAnimatorSmoothAnimationTest, TEST_F(ScreenRotationAnimatorSmoothAnimationTest,
RemoveExternalSecondaryDisplayBeforeSecondCopyCallback) { RemoveExternalSecondaryDisplayBeforeSecondCopyCallback) {
UpdateDisplay("640x480,800x600"); {
// Disable wallpaper animation on a secondary display.
ui::ScopedAnimationDurationScaleMode disable(
ui::ScopedAnimationDurationScaleMode::ZERO_DURATION);
UpdateDisplay("640x480,800x600");
}
EXPECT_EQ(2U, display_manager()->GetNumDisplays()); EXPECT_EQ(2U, display_manager()->GetNumDisplays());
const int64_t primary_display_id = display_manager()->GetDisplayAt(0).id(); const int64_t primary_display_id = display_manager()->GetDisplayAt(0).id();
......
...@@ -65,6 +65,7 @@ void CopyToLayerOnCopyRequestFinished( ...@@ -65,6 +65,7 @@ void CopyToLayerOnCopyRequestFinished(
std::unique_ptr<ui::Layer> CreateLayerFromCopyOutputResult( std::unique_ptr<ui::Layer> CreateLayerFromCopyOutputResult(
std::unique_ptr<viz::CopyOutputResult> copy_result) { std::unique_ptr<viz::CopyOutputResult> copy_result) {
auto copy_layer = std::make_unique<ui::Layer>(); auto copy_layer = std::make_unique<ui::Layer>();
copy_layer->SetBounds(gfx::Rect(copy_result->size()));
CopyCopyOutputResultToLayer(std::move(copy_result), copy_layer.get()); CopyCopyOutputResultToLayer(std::move(copy_result), copy_layer.get());
return copy_layer; return copy_layer;
} }
......
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