Commit bc45151a authored by Christopher Grant's avatar Christopher Grant Committed by Commit Bot

VR: Fix element visibility checks in the optmimized tree case

Elements are possibly visible only if they ran the opacity computation
step.

BUG=835445
R=mthiesse

Change-Id: Ib45d933c36d509a8d0f224a1d2080fc88de78412
Reviewed-on: https://chromium-review.googlesource.com/1026071Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Christopher Grant <cjgrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553199}
parent 8dd13428
...@@ -300,10 +300,14 @@ void UiElement::SetVisibleImmediately(bool visible) { ...@@ -300,10 +300,14 @@ void UiElement::SetVisibleImmediately(bool visible) {
} }
bool UiElement::IsVisible() const { bool UiElement::IsVisible() const {
// Many things rely on checking element visibility, including tests.
// Therefore, support reporting visibility even if an element sits in an
// invisible portion of the tree. We can infer that if the scene computed
// opacities, but this element did not, it must be invisible.
DCHECK(update_phase_ >= kUpdatedComputedOpacity || DCHECK(update_phase_ >= kUpdatedComputedOpacity ||
FrameLifecycle::phase() >= kUpdatedComputedOpacity); FrameLifecycle::phase() >= kUpdatedComputedOpacity);
// TODO(crbug.com/832216): we shouldn't need to check opacity() here. // TODO(crbug.com/832216): we shouldn't need to check opacity() here.
return update_phase_ != kDirty && opacity() > 0.0f && return update_phase_ >= kUpdatedComputedOpacity && opacity() > 0.0f &&
computed_opacity() > 0.0f; computed_opacity() > 0.0f;
} }
...@@ -311,7 +315,7 @@ bool UiElement::IsVisibleAndOpaque() const { ...@@ -311,7 +315,7 @@ bool UiElement::IsVisibleAndOpaque() const {
DCHECK(update_phase_ >= kUpdatedComputedOpacity || DCHECK(update_phase_ >= kUpdatedComputedOpacity ||
FrameLifecycle::phase() >= kUpdatedComputedOpacity); FrameLifecycle::phase() >= kUpdatedComputedOpacity);
// TODO(crbug.com/832216): we shouldn't need to check opacity() here. // TODO(crbug.com/832216): we shouldn't need to check opacity() here.
return update_phase_ != kDirty && opacity() == 1.0f && return update_phase_ >= kUpdatedComputedOpacity && opacity() == 1.0f &&
computed_opacity() == 1.0f; computed_opacity() == 1.0f;
} }
......
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