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

Unified Diff: third_party/WebKit/Source/core/animation/EffectInput.cpp

Issue 1698913003: Avoid style recalc during element.animate() when unnecessary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_renameToSampledEffect
Patch Set: Added test case Created 4 years, 10 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
« no previous file with comments | « third_party/WebKit/LayoutTests/web-animations-api/element-animate-no-style-recalc.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/animation/EffectInput.cpp
diff --git a/third_party/WebKit/Source/core/animation/EffectInput.cpp b/third_party/WebKit/Source/core/animation/EffectInput.cpp
index 0433dea6a075a3889067083a7e2a70e6375efcba..03c90927f04f33e787ea31e148027f130b5c0fdb 100644
--- a/third_party/WebKit/Source/core/animation/EffectInput.cpp
+++ b/third_party/WebKit/Source/core/animation/EffectInput.cpp
@@ -33,6 +33,7 @@
#include "bindings/core/v8/Dictionary.h"
#include "bindings/core/v8/UnionTypesCore.h"
#include "core/animation/AnimationInputHelpers.h"
+#include "core/animation/CompositorAnimations.h"
#include "core/animation/KeyframeEffectModel.h"
#include "core/animation/StringKeyframe.h"
#include "core/css/CSSStyleSheet.h"
@@ -51,13 +52,10 @@ EffectModel* EffectInput::convert(Element* element, const Vector<Dictionary>& ke
if (!element)
return nullptr;
- // TODO(alancutter): Remove this once composited animations no longer depend on AnimatableValues.
- if (element->inActiveDocument())
- element->document().updateLayoutTreeForNodeIfNeeded(element);
-
StyleSheetContents* styleSheetContents = element->document().elementSheet().contents();
StringKeyframeVector keyframes;
double lastOffset = 0;
+ bool encounteredCompositableProperty = false;
for (const auto& keyframeDictionary : keyframeDictionaryVector) {
RefPtr<StringKeyframe> keyframe = StringKeyframe::create();
@@ -110,6 +108,9 @@ EffectModel* EffectInput::convert(Element* element, const Vector<Dictionary>& ke
CSSPropertyID cssProperty = AnimationInputHelpers::keyframeAttributeToCSSProperty(property);
if (cssProperty != CSSPropertyInvalid) {
+ if (!encounteredCompositableProperty && CompositorAnimations::isCompositableProperty(cssProperty))
+ encounteredCompositableProperty = true;
+
keyframe->setCSSPropertyValue(cssProperty, value, element, styleSheetContents);
continue;
}
@@ -132,6 +133,10 @@ EffectModel* EffectInput::convert(Element* element, const Vector<Dictionary>& ke
}
}
+ // TODO(alancutter): Remove this once composited animations no longer depend on AnimatableValues.
+ if (encounteredCompositableProperty && element->inActiveDocument())
+ element->document().updateLayoutTreeForNodeIfNeeded(element);
+
StringKeyframeEffectModel* keyframeEffectModel = StringKeyframeEffectModel::create(keyframes);
if (!RuntimeEnabledFeatures::cssAdditiveAnimationsEnabled()) {
for (const auto& keyframeGroup : keyframeEffectModel->getPropertySpecificKeyframeGroups()) {
« no previous file with comments | « third_party/WebKit/LayoutTests/web-animations-api/element-animate-no-style-recalc.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698