AnimationTimeline should not have multiple HashMaps with raw Element* keys
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Mar 2020 07:48:06 +0000 (07:48 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Mar 2020 07:48:06 +0000 (07:48 +0000)
commitf8fe6573b98310d0afacfdf63db2922826c04f50
treee5b316ad3ee4e8e26624fb9d5b078dabf04011fb
parent361ee4f3aab7b2ac350ea117b16fdd78656b7a9e
AnimationTimeline should not have multiple HashMaps with raw Element* keys
https://bugs.webkit.org/show_bug.cgi?id=208079
<rdar://problem/59687906>

Reviewed by Ryosuke Niwa.

We introduce a new ElementAnimationRareData class that holds the KeyframeEffectStack previously owned by ElementRareData as well as a few maps and lists
owned by AnimationTimeline which would use raw Element pointers as keys. Specifically, this is what changed:

- AnimationTimeline::m_elementToRunningCSSTransitionByCSSPropertyID → ElementAnimationRareData::runningTransitionByProperty()
- AnimationTimeline::m_elementToCompletedCSSTransitionByCSSPropertyID → ElementAnimationRareData::completedTransitionByProperty()
- AnimationTimeline::m_elementToCSSAnimationsCreatedByMarkupMap → ElementAnimationRareData::animationsCreatedByMarkup()
- AnimationTimeline::m_elementToCSSTransitionsMap → ElementAnimationRareData::transitions()
- AnimationTimeline::m_elementToCSSAnimationsMap → ElementAnimationRareData::cssAnimations()
- AnimationTimeline::m_elementToAnimationsMap → ElementAnimationRareData::webAnimations()

For convenience, these new members are exposed via Element directly.

No change in behavior, so no new tests.

* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* animation/AnimationPlaybackEventInit.h:
* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::animationWasAddedToElement):
(WebCore::removeCSSTransitionFromMap):
(WebCore::AnimationTimeline::animationWasRemovedFromElement):
(WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement):
(WebCore::AnimationTimeline::animationsForElement const):
(WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup):
(WebCore::AnimationTimeline::willDestroyRendererForElement):
(WebCore::AnimationTimeline::elementWasRemoved):
(WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
(WebCore::AnimationTimeline::updateCSSAnimationsForElement):
(WebCore::propertyInStyleMatchesValueForTransitionInMap):
(WebCore::AnimationTimeline::updateCSSTransitionsForElementAndProperty):
(WebCore::AnimationTimeline::updateCSSTransitionsForElement):
(WebCore::removeAnimationFromMapForElement): Deleted.
(WebCore::AnimationTimeline::ensureRunningTransitionsByProperty): Deleted.
* animation/AnimationTimeline.h:
* animation/ComputedEffectTiming.h:
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::transitionDidComplete):
* animation/ElementAnimationRareData.cpp: Copied from Source/WebCore/animation/ComputedEffectTiming.h.
(WebCore::ElementAnimationRareData::ElementAnimationRareData):
(WebCore::ElementAnimationRareData::~ElementAnimationRareData):
(WebCore::ElementAnimationRareData::ensureKeyframeEffectStack):
* animation/ElementAnimationRareData.h: Added.
(WebCore::ElementAnimationRareData::keyframeEffectStack):
(WebCore::ElementAnimationRareData::webAnimations):
(WebCore::ElementAnimationRareData::cssAnimations):
(WebCore::ElementAnimationRareData::transitions):
(WebCore::ElementAnimationRareData::animationsCreatedByMarkup):
(WebCore::ElementAnimationRareData::setAnimationsCreatedByMarkup):
(WebCore::ElementAnimationRareData::completedTransitionByProperty):
(WebCore::ElementAnimationRareData::runningTransitionsByProperty):
* animation/KeyframeEffect.h:
* animation/OptionalEffectTiming.h:
* animation/WebAnimation.h:
* animation/WebAnimationTypes.h: Copied from Source/WebCore/animation/WebAnimationUtilities.h.
(WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue):
(WebCore::WebAnimationsMarkableDoubleTraits::emptyValue):
* animation/WebAnimationUtilities.h:
(WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue): Deleted.
(WebCore::WebAnimationsMarkableDoubleTraits::emptyValue): Deleted.
* dom/Element.cpp:
(WebCore::Element::animationRareData const):
(WebCore::Element::ensureAnimationRareData):
(WebCore::Element::keyframeEffectStack const):
(WebCore::Element::ensureKeyframeEffectStack):
(WebCore::Element::hasKeyframeEffects const):
(WebCore::Element::webAnimations):
(WebCore::Element::cssAnimations):
(WebCore::Element::transitions):
(WebCore::Element::animationsCreatedByMarkup):
(WebCore::Element::setAnimationsCreatedByMarkup):
(WebCore::Element::completedTransitionByProperty):
(WebCore::Element::runningTransitionsByProperty):
* dom/Element.h:
* dom/ElementRareData.h:
(WebCore::ElementRareData::elementAnimationRareData):
(WebCore::ElementRareData::useTypes const):
(WebCore::ElementRareData::ensureAnimationRareData):
(WebCore::ElementRareData::keyframeEffectStack): Deleted.
(WebCore::ElementRareData::setKeyframeEffectStack): Deleted.
* dom/Node.cpp:
(WebCore::stringForRareDataUseType):
* dom/NodeRareData.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Headers.cmake
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/animation/AnimationPlaybackEventInit.h
Source/WebCore/animation/AnimationTimeline.cpp
Source/WebCore/animation/AnimationTimeline.h
Source/WebCore/animation/ComputedEffectTiming.h
Source/WebCore/animation/DocumentTimeline.cpp
Source/WebCore/animation/ElementAnimationRareData.cpp [new file with mode: 0644]
Source/WebCore/animation/ElementAnimationRareData.h [new file with mode: 0644]
Source/WebCore/animation/KeyframeEffect.h
Source/WebCore/animation/OptionalEffectTiming.h
Source/WebCore/animation/WebAnimation.h
Source/WebCore/animation/WebAnimationTypes.h [new file with mode: 0644]
Source/WebCore/animation/WebAnimationUtilities.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/ElementRareData.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/NodeRareData.h