Re-allow nullptr animating elements

Because of an unintended behavior change in [1], it's no longer possible
to have a nullptr animating element, since StyleResolverState::
GetAnimatingElement will fall back to GetElement() if pseudo_element is
nullptr. Previously (pre-[1]), if the PseudoElement* retrieved by
StyleResolver::PseudoStyleForElement was nullptr, the animating element
would just be nullptr, and not fall back to anything.

This CL restores that behavior by passing PseudoId to a dedicated
StyleResolverState constructor. That way we know whether we're doing a
style resolution for a pseudo element or a regular element, and we can
return the correct thing from GetAnimatingElement.

Also removed the StyleResolverState constructor which accepted a
ElementResolveContext, since it only had one call site which anyway
did the same thing as the other constructor.


Bug: 989151,989402,989437
Change-Id: I0aecf0a7a3a857dbd0664d969abeea7ec5852260
Reviewed-by: Rune Lillesveen <>
Reviewed-by: Fernando Serboncini <>
Commit-Queue: Anders Hartvoll Ruud <>
Cr-Commit-Position: refs/heads/master@{#683124}
8 files changed