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) { ...@@ -127,8 +127,7 @@ bool HasAnimationsOrTransitions(const StyleResolverState& state) {
state.GetAnimatingElement()->HasAnimations()); state.GetAnimatingElement()->HasAnimations());
} }
bool ShouldComputeBaseComputedStyle(const ComputedStyle* base_computed_style, bool ShouldComputeBaseComputedStyle(const ComputedStyle* base_computed_style) {
bool base_is_usable) {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
// The invariant in the base computed style optimization is that as long as // The invariant in the base computed style optimization is that as long as
// |IsAnimationStyleChange| is true, the computed style that would be // |IsAnimationStyleChange| is true, the computed style that would be
...@@ -138,7 +137,7 @@ bool ShouldComputeBaseComputedStyle(const ComputedStyle* base_computed_style, ...@@ -138,7 +137,7 @@ bool ShouldComputeBaseComputedStyle(const ComputedStyle* base_computed_style,
// call ValidateBaseComputedStyle() to check that the optimization was sound. // call ValidateBaseComputedStyle() to check that the optimization was sound.
return true; return true;
#else #else
return !(base_computed_style && base_is_usable); return !base_computed_style;
#endif // !DCHECK_IS_ON() #endif // !DCHECK_IS_ON()
} }
...@@ -931,12 +930,11 @@ void StyleResolver::ApplyBaseComputedStyle( ...@@ -931,12 +930,11 @@ void StyleResolver::ApplyBaseComputedStyle(
MatchResult& match_result, MatchResult& match_result,
RuleMatchingBehavior matching_behavior, RuleMatchingBehavior matching_behavior,
bool can_cache_animation_base_computed_style) { 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 && bool base_is_usable = can_cache_animation_base_computed_style &&
CanReuseBaseComputedStyle(state); CanReuseBaseComputedStyle(state);
if (ShouldComputeBaseComputedStyle(animation_base_computed_style, const ComputedStyle* animation_base_computed_style =
base_is_usable)) { base_is_usable ? CachedAnimationBaseComputedStyle(state) : nullptr;
if (ShouldComputeBaseComputedStyle(animation_base_computed_style)) {
InitStyleAndApplyInheritance(*element, state); InitStyleAndApplyInheritance(*element, state);
GetDocument().GetStyleEngine().EnsureUAStyleForElement(*element); GetDocument().GetStyleEngine().EnsureUAStyleForElement(*element);
...@@ -1007,10 +1005,8 @@ void StyleResolver::ApplyBaseComputedStyle( ...@@ -1007,10 +1005,8 @@ void StyleResolver::ApplyBaseComputedStyle(
StyleAdjuster::AdjustComputedStyle(state, element); StyleAdjuster::AdjustComputedStyle(state, element);
if (can_cache_animation_base_computed_style) { DCHECK(ValidateBaseComputedStyle(animation_base_computed_style,
DCHECK(ValidateBaseComputedStyle(animation_base_computed_style, *state.Style()));
*state.Style()));
}
} }
if (base_is_usable) { if (base_is_usable) {
...@@ -1067,8 +1063,9 @@ bool StyleResolver::PseudoStyleForElementInternal( ...@@ -1067,8 +1063,9 @@ bool StyleResolver::PseudoStyleForElementInternal(
SelectorFilterParentScope::EnsureParentStackIsPushed(); SelectorFilterParentScope::EnsureParentStackIsPushed();
bool base_is_usable = CanReuseBaseComputedStyle(state);
const ComputedStyle* animation_base_computed_style = 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 // Since we don't use pseudo-elements in any of our quirk/print
// user agent rules, don't waste time walking those rules. // user agent rules, don't waste time walking those rules.
...@@ -1077,9 +1074,7 @@ bool StyleResolver::PseudoStyleForElementInternal( ...@@ -1077,9 +1074,7 @@ bool StyleResolver::PseudoStyleForElementInternal(
StyleCascade* cascade_ptr = StyleCascade* cascade_ptr =
RuntimeEnabledFeatures::CSSCascadeEnabled() ? &cascade : nullptr; RuntimeEnabledFeatures::CSSCascadeEnabled() ? &cascade : nullptr;
bool base_is_usable = CanReuseBaseComputedStyle(state); if (ShouldComputeBaseComputedStyle(animation_base_computed_style)) {
if (ShouldComputeBaseComputedStyle(animation_base_computed_style,
base_is_usable)) {
if (pseudo_style_request.AllowsInheritance(state.ParentStyle())) { if (pseudo_style_request.AllowsInheritance(state.ParentStyle())) {
scoped_refptr<ComputedStyle> style = ComputedStyle::Create(); scoped_refptr<ComputedStyle> style = ComputedStyle::Create();
style->InheritFrom(*state.ParentStyle()); style->InheritFrom(*state.ParentStyle());
......
...@@ -6866,7 +6866,6 @@ crbug.com/1098067 [ Fuchsia ] virtual/text-antialias/bidi-isolate-nextlinebreak- ...@@ -6866,7 +6866,6 @@ crbug.com/1098067 [ Fuchsia ] virtual/text-antialias/bidi-isolate-nextlinebreak-
# Sheriff 2020-06-23 # Sheriff 2020-06-23
crbug.com/1098136 [ Linux ] virtual/android/fullscreen/video-fixed-background.html [ Failure ] 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/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 # Sheriff 2020-06-24
crbug.com/1098676 [ Win ] http/tests/devtools/console-xhr-logging.js [ Pass Failure ] 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