Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp

Issue 2043273002: Defer compositor keyframe snapshots until the next style resolve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
index a3611642f3a993e429d247a13dd19b2d57628c63..21f77974b4d1972111d3706080b499877612f2c9 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -850,17 +850,12 @@ PassRefPtr<ComputedStyle> StyleResolver::styleForElement(Element* element, const
return state.takeStyle();
}
-// This function is used by the WebAnimations JavaScript API method animate().
-// FIXME: Remove this when animate() switches away from resolution-dependent parsing.
-PassRefPtr<AnimatableValue> StyleResolver::createAnimatableValueSnapshot(Element& element, const ComputedStyle* baseStyle, CSSPropertyID property, const CSSValue* value)
-{
- StyleResolverState state(element.document(), &element);
- state.setStyle(baseStyle ? ComputedStyle::clone(*baseStyle) : ComputedStyle::create());
- return createAnimatableValueSnapshot(state, property, value);
-}
-
-PassRefPtr<AnimatableValue> StyleResolver::createAnimatableValueSnapshot(StyleResolverState& state, CSSPropertyID property, const CSSValue* value)
+// TODO(alancutter): Create compositor keyframe values directly instead of intermediate AnimatableValues.
+PassRefPtr<AnimatableValue> StyleResolver::createAnimatableValueSnapshot(Element& element, const ComputedStyle& baseStyle, const ComputedStyle* parentStyle, CSSPropertyID property, const CSSValue* value)
{
+ // TODO(alancutter): Avoid creating a StyleResolverState just to apply a single value on a ComputedStyle.
+ StyleResolverState state(element.document(), &element, parentStyle);
+ state.setStyle(ComputedStyle::clone(baseStyle));
if (value) {
StyleBuilder::applyProperty(property, state, *value);
state.fontBuilder().createFont(state.document().styleEngine().fontSelector(), state.mutableStyleRef());
@@ -1131,6 +1126,8 @@ bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ele
if (state.animationUpdate().isEmpty())
return false;
+ CSSAnimations::snapshotCompositorKeyframes(*element, state.animationUpdate(), *state.style(), state.parentStyle());
+
if (state.style()->insideLink() != NotInsideLink) {
ASSERT(state.applyPropertyToRegularStyle());
state.setApplyPropertyToVisitedLinkStyle(true);

Powered by Google App Engine
This is Rietveld 408576698