Changeset 156912 in webkit
- Timestamp:
- Oct 4, 2013 1:46:57 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r156909 r156912 1 2013-10-04 Ralph Thomas <ralpht@gmail.com> 2 3 Inserting a JS generated keyframe animation shouldn't trigger a whole document style recalc 4 https://bugs.webkit.org/show_bug.cgi?id=119479 5 6 Reviewed by Antti Koivisto. 7 8 Change CSSStyleSheet::didMutateRules to not invalidate all node's styles when inserting a 9 @-webkit-keyframes rule, and to instead insert the rule directly into the StyleResolver. 10 11 Test: animation/keyframes-dynamic.html: adds and removes keyframe rules using JavaScript and 12 validates that the correct elements are animated. 13 14 * css/CSSStyleSheet.cpp: 15 (WebCore::CSSStyleSheet::didMutateRules): 16 (WebCore::CSSStyleSheet::insertRule): 17 * css/CSSStyleSheet.h: 18 1 19 2013-10-04 Zan Dobersek <zdobersek@igalia.com> 2 20 -
trunk/Source/WebCore/css/CSSStyleSheet.cpp
r156550 r156912 38 38 #include "SVGNames.h" 39 39 #include "SecurityOrigin.h" 40 #include "StyleResolver.h" 40 41 #include "StyleRule.h" 41 42 #include "StyleSheetContents.h" 43 #include "WebKitCSSKeyframesRule.h" 42 44 #include <wtf/text/StringBuilder.h> 43 45 … … 158 160 } 159 161 160 void CSSStyleSheet::didMutateRules(RuleMutationType mutationType, WhetherContentsWereClonedForMutation contentsWereClonedForMutation )162 void CSSStyleSheet::didMutateRules(RuleMutationType mutationType, WhetherContentsWereClonedForMutation contentsWereClonedForMutation, StyleRuleKeyframes* insertedKeyframesRule) 161 163 { 162 164 ASSERT(m_contents->isMutable()); … … 168 170 169 171 if (mutationType == RuleInsertion && !contentsWereClonedForMutation && !owner->styleSheetCollection().activeStyleSheetsContains(this)) { 172 if (insertedKeyframesRule) { 173 if (StyleResolver* resolver = owner->styleResolverIfExists()) 174 resolver->addKeyframeStyle(insertedKeyframesRule); 175 return; 176 } 170 177 owner->scheduleOptimizedStyleSheetUpdate(); 171 178 return; … … 296 303 } 297 304 298 RuleMutationScope mutationScope(this, RuleInsertion );305 RuleMutationScope mutationScope(this, RuleInsertion, rule->type() == StyleRuleBase::Keyframes ? static_cast<StyleRuleKeyframes*>(rule.get()) : 0); 299 306 300 307 bool success = m_contents->wrapperInsertRule(rule, index); … … 402 409 } 403 410 404 CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSStyleSheet* sheet, RuleMutationType mutationType )411 CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSStyleSheet* sheet, RuleMutationType mutationType, StyleRuleKeyframes* insertedKeyframesRule) 405 412 : m_styleSheet(sheet) 406 413 , m_mutationType(mutationType) 414 , m_insertedKeyframesRule(insertedKeyframesRule) 407 415 { 408 416 ASSERT(m_styleSheet); … … 414 422 , m_mutationType(OtherMutation) 415 423 , m_contentsWereClonedForMutation(ContentsWereNotClonedForMutation) 424 , m_insertedKeyframesRule(nullptr) 416 425 { 417 426 if (m_styleSheet) … … 422 431 { 423 432 if (m_styleSheet) 424 m_styleSheet->didMutateRules(m_mutationType, m_contentsWereClonedForMutation );425 } 426 427 } 433 m_styleSheet->didMutateRules(m_mutationType, m_contentsWereClonedForMutation, m_insertedKeyframesRule); 434 } 435 436 } -
trunk/Source/WebCore/css/CSSStyleSheet.h
r156550 r156912 41 41 class MediaQuerySet; 42 42 class SecurityOrigin; 43 class StyleRuleKeyframes; 43 44 class StyleSheetContents; 44 45 … … 92 93 WTF_MAKE_NONCOPYABLE(RuleMutationScope); 93 94 public: 94 RuleMutationScope(CSSStyleSheet*, RuleMutationType = OtherMutation );95 RuleMutationScope(CSSStyleSheet*, RuleMutationType = OtherMutation, StyleRuleKeyframes* insertedKeyframesRule = nullptr); 95 96 RuleMutationScope(CSSRule*); 96 97 ~RuleMutationScope(); … … 100 101 RuleMutationType m_mutationType; 101 102 WhetherContentsWereClonedForMutation m_contentsWereClonedForMutation; 103 StyleRuleKeyframes* m_insertedKeyframesRule; 102 104 }; 103 105 104 106 WhetherContentsWereClonedForMutation willMutateRules(); 105 void didMutateRules(RuleMutationType, WhetherContentsWereClonedForMutation );107 void didMutateRules(RuleMutationType, WhetherContentsWereClonedForMutation, StyleRuleKeyframes* insertedKeyframesRule); 106 108 void didMutateRuleFromCSSStyleDeclaration(); 107 109 void didMutate();
Note: See TracChangeset
for help on using the changeset viewer.