Commit 0fd83141 authored by Kevin Ellis's avatar Kevin Ellis Committed by Commit Bot

Deflake registered-neutral-keyframe test

The change to always cache the base computed style safeguarded against
reusing it to optimize style recalculation when not appropriate, but not
against DCHECK verification that the same results would be produced.
By only fetching the cached style when it can be used, we ensure that it
can be validated as well.

Bug: 1098371, 1098254
Change-Id: Ie0366189af809ecd9bc9b6018292ef54a516b8d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2261168
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781932}
parent 7a1b4234
......@@ -127,8 +127,7 @@ bool HasAnimationsOrTransitions(const StyleResolverState& state) {
state.GetAnimatingElement()->HasAnimations());
}
bool ShouldComputeBaseComputedStyle(const ComputedStyle* base_computed_style,
bool base_is_usable) {
bool ShouldComputeBaseComputedStyle(const ComputedStyle* base_computed_style) {
#if DCHECK_IS_ON()
// The invariant in the base computed style optimization is that as long as
// |IsAnimationStyleChange| is true, the computed style that would be
......@@ -138,7 +137,7 @@ bool ShouldComputeBaseComputedStyle(const ComputedStyle* base_computed_style,
// call ValidateBaseComputedStyle() to check that the optimization was sound.
return true;
#else
return !(base_computed_style && base_is_usable);
return !base_computed_style;
#endif // !DCHECK_IS_ON()
}
......@@ -931,12 +930,11 @@ void StyleResolver::ApplyBaseComputedStyle(
MatchResult& match_result,
RuleMatchingBehavior matching_behavior,
bool can_cache_animation_base_computed_style) {
const ComputedStyle* animation_base_computed_style =
CachedAnimationBaseComputedStyle(state);
bool base_is_usable = can_cache_animation_base_computed_style &&
CanReuseBaseComputedStyle(state);
if (ShouldComputeBaseComputedStyle(animation_base_computed_style,
base_is_usable)) {
const ComputedStyle* animation_base_computed_style =
base_is_usable ? CachedAnimationBaseComputedStyle(state) : nullptr;
if (ShouldComputeBaseComputedStyle(animation_base_computed_style)) {
InitStyleAndApplyInheritance(*element, state);
GetDocument().GetStyleEngine().EnsureUAStyleForElement(*element);
......@@ -1007,10 +1005,8 @@ void StyleResolver::ApplyBaseComputedStyle(
StyleAdjuster::AdjustComputedStyle(state, element);
if (can_cache_animation_base_computed_style) {
DCHECK(ValidateBaseComputedStyle(animation_base_computed_style,
*state.Style()));
}
DCHECK(ValidateBaseComputedStyle(animation_base_computed_style,
*state.Style()));
}
if (base_is_usable) {
......@@ -1067,8 +1063,9 @@ bool StyleResolver::PseudoStyleForElementInternal(
SelectorFilterParentScope::EnsureParentStackIsPushed();
bool base_is_usable = CanReuseBaseComputedStyle(state);
const ComputedStyle* animation_base_computed_style =
CachedAnimationBaseComputedStyle(state);
base_is_usable ? CachedAnimationBaseComputedStyle(state) : nullptr;
// Since we don't use pseudo-elements in any of our quirk/print
// user agent rules, don't waste time walking those rules.
......@@ -1077,9 +1074,7 @@ bool StyleResolver::PseudoStyleForElementInternal(
StyleCascade* cascade_ptr =
RuntimeEnabledFeatures::CSSCascadeEnabled() ? &cascade : nullptr;
bool base_is_usable = CanReuseBaseComputedStyle(state);
if (ShouldComputeBaseComputedStyle(animation_base_computed_style,
base_is_usable)) {
if (ShouldComputeBaseComputedStyle(animation_base_computed_style)) {
if (pseudo_style_request.AllowsInheritance(state.ParentStyle())) {
scoped_refptr<ComputedStyle> style = ComputedStyle::Create();
style->InheritFrom(*state.ParentStyle());
......
......@@ -6866,7 +6866,6 @@ crbug.com/1098067 [ Fuchsia ] virtual/text-antialias/bidi-isolate-nextlinebreak-
# Sheriff 2020-06-23
crbug.com/1098136 [ Linux ] virtual/android/fullscreen/video-fixed-background.html [ Failure ]
crbug.com/1025944 [ Linux ] external/wpt/pointerevents/pointerlock/pointerevent_pointermove_on_chorded_mouse_button_when_locked.html [ Pass Failure ]
crbug.com/1098371 [ Linux ] virtual/threaded-no-composited-antialiasing/animations/custom-properties/registered-neutral-keyframe.html [ Pass Crash Failure ]
# Sheriff 2020-06-24
crbug.com/1098676 [ Win ] http/tests/devtools/console-xhr-logging.js [ Pass Failure ]
......
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