Chromium Code Reviews

Unified Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 2105743002: Optimize style recalc when adding @keyframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved logic out of AnimationTimeline. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: third_party/WebKit/Source/core/dom/StyleEngine.cpp
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
index b7cccd69a0808c85471a3698915ce9c4f613368e..80728018d5fcf036180b8a15f05f172f64ace92f 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -28,6 +28,7 @@
#include "core/dom/StyleEngine.h"
#include "core/HTMLNames.h"
+#include "core/animation/AnimationTimeline.h"
#include "core/css/CSSDefaultStyleSheets.h"
#include "core/css/CSSFontSelector.h"
#include "core/css/CSSStyleSheet.h"
@@ -743,6 +744,17 @@ void StyleEngine::ensureFullscreenUAStyle()
m_resolver->resetRuleFeatures();
}
+void StyleEngine::keyframesRulesAdded()
+{
+ if (m_hasUnresolvedKeyframesRule) {
+ m_hasUnresolvedKeyframesRule = false;
+ document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleSheetChange));
+ return;
+ }
+
+ document().timeline().invalidateKeyframeEffects();
+}
+
DEFINE_TRACE(StyleEngine)
{
visitor->trace(m_document);

Powered by Google App Engine