Commit 3e401c1a authored by David Black's avatar David Black Committed by Commit Bot

Fixes DCHECK failure due to aura::Window opacity.

DCHECK failure occured at this line:
https://cs.chromium.org/chromium/src/ui/aura/window.cc?type=cs&l=244

Because we are only at 0% opacity right before we animate in or right
before our window is removed, I think it should be safe to just avoid
the DCHECK by using an approximate value instead of 0% opacity.

Bug: b:113298385
Change-Id: I5dcc2b93a45a515e3a0d9278fc835e919cf01cd6
Reviewed-on: https://chromium-review.googlesource.com/1208823Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#589079}
parent 0931dc80
...@@ -291,9 +291,13 @@ void UiElementContainerView::OnResponseChanged( ...@@ -291,9 +291,13 @@ void UiElementContainerView::OnResponseChanged(
for (const std::pair<ui::LayerOwner*, float>& pair : ui_element_views_) { for (const std::pair<ui::LayerOwner*, float>& pair : ui_element_views_) {
StartLayerAnimationSequence( StartLayerAnimationSequence(
pair.first->layer()->GetAnimator(), pair.first->layer()->GetAnimator(),
// Fade out the opacity to 0%. // Fade out the opacity to 0%. Note that we approximate 0% by actually
// using 0.01%. We do this to workaround a DCHECK that requires
// aura::Windows to have a target opacity > 0% when shown. Because our
// window will be removed after it reaches this value, it should be safe
// to circumnavigate this DCHECK.
CreateLayerAnimationSequence( CreateLayerAnimationSequence(
CreateOpacityElement(0.f, kUiElementAnimationFadeOutDuration)), CreateOpacityElement(0.0001f, kUiElementAnimationFadeOutDuration)),
// Observe the animation. // Observe the animation.
ui_elements_exit_animation_observer_.get()); ui_elements_exit_animation_observer_.get());
} }
...@@ -465,9 +469,13 @@ void UiElementContainerView::OnCardReady( ...@@ -465,9 +469,13 @@ void UiElementContainerView::OnCardReady(
view_holder->Attach(); view_holder->Attach();
// The view will be animated on its own layer, so we need to do some initial // The view will be animated on its own layer, so we need to do some initial
// layer setup. We're going to fade the view in, so hide it. // layer setup. We're going to fade the view in, so hide it. Note that we
// approximate 0% opacity by actually using 0.01%. We do this to workaround
// a DCHECK that requires aura::Windows to have a target opacity > 0% when
// shown. Because our window will be animated to full opacity from this
// value, it should be safe to circumnavigate this DCHECK.
view_holder->native_view()->layer()->SetFillsBoundsOpaquely(false); view_holder->native_view()->layer()->SetFillsBoundsOpaquely(false);
view_holder->native_view()->layer()->SetOpacity(0.f); view_holder->native_view()->layer()->SetOpacity(0.0001f);
// We cache the native view for use during animations and its desired // We cache the native view for use during animations and its desired
// opacity that we'll animate to while processing the next query response. // opacity that we'll animate to while processing the next query response.
......
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