haikuwebkit/Source/WebCore/style/Styleable.cpp

500 lines
27 KiB
C++
Raw Permalink Normal View History

Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
/*
* Copyright (C) 2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "Styleable.h"
#include "Animation.h"
#include "AnimationEffect.h"
#include "AnimationList.h"
#include "AnimationTimeline.h"
#include "CSSAnimation.h"
#include "CSSPropertyAnimation.h"
#include "CSSTransition.h"
#include "DeclarativeAnimation.h"
#include "Document.h"
Non-unified build fixes, early April 2021 https://bugs.webkit.org/show_bug.cgi?id=224091 Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-02 Reviewed by Alex Christensen. Non-unified build fixes, April 2021. * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): For IDLs that have a property with a type of `undefined`, also add #include "JSDOMConvertBase.h" to the generated binding source file. This fixes a build error in DerivedSources/JSWebGLLoseContext.cpp that looked like: WebCore/DerivedSources/JSWebGLLoseContext.cpp:147:78: error: expected primary-expression before ‘>’ token RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.loseContext(); }))); Thanks to Darin Adler for figuring this out. To see the full error, go here: https://bugs.webkit.org/show_bug.cgi?id=223150#c14 * dom/EventContext.h: * dom/FocusOptions.h: * loader/ResourceLoadInfo.cpp: * page/scrolling/ScrollSnapOffsetsInfo.cpp: * platform/network/soup/SoupNetworkSession.cpp: * rendering/RenderLayerModelObject.cpp: * style/Styleable.cpp: * workers/service/server/SWScriptStorage.cpp: * workers/service/server/SWScriptStorage.h: * Modules/mediastream/RTCDataChannelRemoteSource.h: Fix 'invalid use of incomplete type <TYPE>' or '<TYPE> does not name a type' errors. * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: * bindings/scripts/test/JS/JSTestConditionalIncludes.cpp: * bindings/scripts/test/JS/JSTestDomainSecurity.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOperationConditional.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp: Update bindings via `run-bindings-tests --reset-results` to add new "JSDOMConvertBase.h" include. Canonical link: https://commits.webkit.org/236085@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-02 16:23:39 +00:00
#include "DocumentTimeline.h"
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
#include "Element.h"
#include "KeyframeEffect.h"
#include "KeyframeEffectStack.h"
#include "RenderStyle.h"
#include "StylePropertyShorthand.h"
Non-unified build fixes, early April 2021 https://bugs.webkit.org/show_bug.cgi?id=224091 Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-02 Reviewed by Alex Christensen. Non-unified build fixes, April 2021. * bindings/scripts/CodeGeneratorJS.pm: (AddToIncludesForIDLType): For IDLs that have a property with a type of `undefined`, also add #include "JSDOMConvertBase.h" to the generated binding source file. This fixes a build error in DerivedSources/JSWebGLLoseContext.cpp that looked like: WebCore/DerivedSources/JSWebGLLoseContext.cpp:147:78: error: expected primary-expression before ‘>’ token RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLUndefined>(*lexicalGlobalObject, throwScope, [&]() -> decltype(auto) { return impl.loseContext(); }))); Thanks to Darin Adler for figuring this out. To see the full error, go here: https://bugs.webkit.org/show_bug.cgi?id=223150#c14 * dom/EventContext.h: * dom/FocusOptions.h: * loader/ResourceLoadInfo.cpp: * page/scrolling/ScrollSnapOffsetsInfo.cpp: * platform/network/soup/SoupNetworkSession.cpp: * rendering/RenderLayerModelObject.cpp: * style/Styleable.cpp: * workers/service/server/SWScriptStorage.cpp: * workers/service/server/SWScriptStorage.h: * Modules/mediastream/RTCDataChannelRemoteSource.h: Fix 'invalid use of incomplete type <TYPE>' or '<TYPE> does not name a type' errors. * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: * bindings/scripts/test/JS/JSTestConditionalIncludes.cpp: * bindings/scripts/test/JS/JSTestDomainSecurity.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestLegacyNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestMapLikeWithOverriddenOperations.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOperationConditional.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestSetLikeWithOverriddenOperations.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp: Update bindings via `run-bindings-tests --reset-results` to add new "JSDOMConvertBase.h" include. Canonical link: https://commits.webkit.org/236085@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-02 16:23:39 +00:00
#include "StyleResolver.h"
Non-unified build fixes, late-ish May 2021 edition https://bugs.webkit.org/show_bug.cgi?id=225990 Unreviewed non-unified build fixes. Source/JavaScriptCore: * jit/CCallHelpers.cpp: Add missing LinkBuffer.h header. Source/WebCore: No new tests needed. * Modules/indexeddb/server/MemoryObjectStore.cpp: Add missing pal/SessioID.h header. * Modules/webaudio/OfflineAudioContext.cpp: Add missing OfflineAudioCompletionEvent.h header. * Modules/webaudio/OfflineAudioContext.h: Add missing wtf/UniqueRef.h header. * Modules/websockets/WebSocketDeflateFramer.h: Add missing WebSocketExtensionProcessor.h header, remove wtf/text/WTFString.h as it is already included by the former. * bindings/js/JSDOMConvertEnumeration.h: Add missing JSDOMGlobalObject.h header. * contentextensions/DFANode.cpp: Add missing wtf/HashMap.h header. * html/HTMLFrameElement.cpp: Add missing HTMLParserIdioms.h header. * html/HTMLHRElement.cpp: Ditto. * html/HTMLIFrameElement.cpp: Ditto. * html/HTMLLIElement.cpp: Ditto. * html/HTMLMetaElement.cpp: Add missing HTMLParserIdioms.h, Frame.h, and FrameView.h headers. * html/HTMLOutputElement.cpp: (WebCore::HTMLOutputElement::parseAttribute): Add missing HTMLNames:: namespace prefix in usage of HTMLNames::forAttr. (WebCore::HTMLOutputElement::htmlFor): Ditto. * html/OffscreenCanvas.cpp: Add missing RuntimeEnabledFeatures.h header. * layout/formattingContexts/FormattingGeometry.cpp: Add missing FormattingQuirks.h header. * layout/formattingContexts/FormattingQuirks.cpp: Add missing FormattingGeometry.h header. * layout/formattingContexts/block/BlockFormattingGeometry.cpp: Add missing BlockFormattingContext.h, BlockFormattingQuirks.h, and BlockMarginCollapse.h headers; remove unneeded BlockFormattingState.h and FormattingContext.h headers. * layout/formattingContexts/block/BlockFormattingGeometry.h: Add missing forward declaration for BlockFormattingContext. * layout/formattingContexts/block/BlockFormattingQuirks.cpp: Add missing BlockFormattingContext.h and BlockMarginCollapse.h headers, remove unneeded BlockFormattingState.h header. * layout/formattingContexts/block/PrecomputedBlockMarginCollapse.cpp: Add missing BlockFormattingContext.h and BlockFormattingQuirks.h headers, remove unneeded BlockFormattingState.h header. * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingContext.cpp: Add missing BlockMarginCollapse.h header. * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.cpp: Add missing TableWrapperBlockFormattingContext.h header. * layout/formattingContexts/block/tablewrapper/TableWrapperBlockFormattingQuirks.h: Add missing forward declaration for TableWrapperBlockFormattingContext. * layout/formattingContexts/flex/FlexFormattingGeometry.cpp: Add missing FlexFormattingContext.h header, remove unneeded FlexFormattingState.h and FormattingContext.h headers. * layout/formattingContexts/flex/FlexFormattingGeometry.h: Add missing forward declaration for FlexFormattingContext. * layout/formattingContexts/inline/InlineFormattingGeometry.cpp: Add missing InlineFormattingContext.h header, remove unneeded InlineLineBox.h header. * layout/formattingContexts/inline/InlineFormattingGeometry.h: Add missing InlineLineBox.h and InlineLineBuilder.h headers, add missing forward declaration for InlineFormattingContext. * layout/formattingContexts/inline/InlineFormattingQuirks.cpp: Add missing InlineFormattingContext.h header. * layout/formattingContexts/inline/InlineFormattingQuirks.h: Add missing InlineLineBox.h header, add missing forward declaration for InlineFormattingContext. * layout/formattingContexts/inline/InlineLineBuilder.cpp: Add missing InlineFormattingQuirks.h header. * layout/formattingContexts/table/TableFormattingGeometry.cpp: Add missing TableFormattingContext.h header, remove unneeded TableFormattingState.h header. * layout/formattingContexts/table/TableFormattingGeometry.h: Add missing TableGrid.h header, add missing forward declaration for TableFormattingContext. * layout/formattingContexts/table/TableFormattingQuirks.cpp: Add missing TableFormattingContext.h header. * layout/formattingContexts/table/TableFormattingQuirks.h: Add missing forward declaration for TableFormattingContext. * layout/formattingContexts/table/TableLayout.cpp: Add missing TableFormattingGeometry.h header. * page/FrameViewLayoutContext.cpp: Add missing StyleScope.h header. * page/ImageOverlayController.h: Add missing LayoutRect.h header. * page/PageConfiguration.h: Add missing wtf/HashSet.h header. * platform/network/soup/SoupNetworkSession.cpp: Add missing wtf/text/StringHash.h header. * style/StyleScopeRuleSets.cpp: Add missing StyleScope.h header. * style/Styleable.cpp: Ditto. * svg/SVGDocumentExtensions.cpp: Add missing SVGUseElement.h header. * svg/SVGDocumentExtensions.h: Add missing wtf/WeakHashSet.h header, add missing forward declaration for SVGUseElement. * workers/WorkerGlobalScope.cpp: Add missing FontCustomPlatformData.h header. Source/WebKit: * NetworkProcess/PreconnectTask.h: Add missing forward declaration for NetworkSession. * NetworkProcess/WebStorage/LocalStorageDatabase.h: Add missing wtf/HashMap.h header, remove unneeded wtf/RefCounted.h header. * Shared/WebPageCreationParameters.cpp: (WebKit::WebPageCreationParameters::decode): Add missing WebCore:: namespace prefix to usage of WebCore::MediaProducer::MutedStateFlags. Canonical link: https://commits.webkit.org/238000@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@277858 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-21 13:52:45 +00:00
#include "StyleScope.h"
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
#include "WebAnimation.h"
#include "WebAnimationUtilities.h"
namespace WebCore {
void Styleable::animationWasAdded(WebAnimation& animation) const
{
ensureAnimations().add(&animation);
}
static inline bool removeCSSTransitionFromMap(CSSTransition& transition, PropertyToTransitionMap& cssTransitionsByProperty)
{
auto transitionIterator = cssTransitionsByProperty.find(transition.property());
if (transitionIterator == cssTransitionsByProperty.end() || transitionIterator->value != &transition)
return false;
cssTransitionsByProperty.remove(transitionIterator);
return true;
}
void Styleable::removeDeclarativeAnimationFromListsForOwningElement(WebAnimation& animation) const
{
ASSERT(is<DeclarativeAnimation>(animation));
if (is<CSSTransition>(animation)) {
auto& transition = downcast<CSSTransition>(animation);
if (!removeCSSTransitionFromMap(transition, ensureRunningTransitionsByProperty()))
removeCSSTransitionFromMap(transition, ensureCompletedTransitionsByProperty());
}
}
void Styleable::animationWasRemoved(WebAnimation& animation) const
{
ensureAnimations().remove(&animation);
// Now, if we're dealing with a CSS Transition, we remove it from the m_elementToRunningCSSTransitionByCSSPropertyID map.
// We don't need to do this for CSS Animations because their timing can be set via CSS to end, which would cause this
// function to be called, but they should remain associated with their owning element until this is changed via a call
// to the JS API or changing the target element's animation-name property.
if (is<CSSTransition>(animation))
removeDeclarativeAnimationFromListsForOwningElement(animation);
}
static void removeCSSAnimationCreatedByMarkup(const Styleable& styleable, CSSAnimation& cssAnimation)
{
styleable.animationsCreatedByMarkup().remove(&cssAnimation);
if (!styleable.hasKeyframeEffects())
return;
auto& keyframeEffectStack = styleable.ensureKeyframeEffectStack();
auto* cssAnimationList = keyframeEffectStack.cssAnimationList();
if (!cssAnimationList || cssAnimationList->isEmpty())
return;
auto& backingAnimation = cssAnimation.backingAnimation();
for (size_t i = 0; i < cssAnimationList->size(); ++i) {
if (cssAnimationList->animation(i) == backingAnimation) {
auto newAnimationList = cssAnimationList->copy();
newAnimationList->remove(i);
keyframeEffectStack.setCSSAnimationList(WTFMove(newAnimationList));
return;
}
}
}
void Styleable::elementWasRemoved() const
{
cancelDeclarativeAnimations();
}
void Styleable::willChangeRenderer() const
{
if (auto* animations = this->animations()) {
for (const auto& animation : *animations)
animation->willChangeRenderer();
}
}
void Styleable::cancelDeclarativeAnimations() const
{
if (auto* animations = this->animations()) {
for (auto& animation : *animations) {
if (is<DeclarativeAnimation>(animation)) {
if (is<CSSAnimation>(animation))
removeCSSAnimationCreatedByMarkup(*this, downcast<CSSAnimation>(*animation));
downcast<DeclarativeAnimation>(*animation).cancelFromStyle();
}
}
}
}
static bool shouldConsiderAnimation(Element& element, const Animation& animation)
{
if (!animation.isValidAnimation())
return false;
Handle custom identifiers and strings separately, so we can quote strings correctly consistently https://bugs.webkit.org/show_bug.cgi?id=226694 Reviewed by Sam Weinig. LayoutTests/imported/w3c: * web-platform-tests/css/css-animations/parsing/animation-name-valid-expected.txt: * web-platform-tests/css/css-counter-styles/counter-style-negative-syntax-expected.txt: * web-platform-tests/css/css-counter-styles/counter-style-pad-syntax-expected.txt: * web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt: * web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt: * web-platform-tests/css/css-grid/parsing/grid-area-computed-expected.txt: * web-platform-tests/css/css-grid/parsing/grid-area-shorthand-expected.txt: * web-platform-tests/css/css-grid/parsing/grid-area-valid-expected.txt: * web-platform-tests/css/css-lists/parsing/content-invalid-expected.txt: * web-platform-tests/css/css-transitions/transition-property-002-expected.txt: * web-platform-tests/css/cssom/getComputedStyle-pseudo-expected.txt: * web-platform-tests/css/cssom/serialize-values-expected.txt: Rebased to reflect progressions. In some cases the entire test passes, in other cases we still have failures, but the string serialization part of the test has progressed. Source/WebCore: Progressions in a number of WPT tests. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::CSSAnimation): Update since Animation::name() now returns a struct. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): Ditto. * css/CSSComputedStyleDeclaration.cpp: (WebCore::OrderedNamedLinesCollector::appendLines const): Use createCustomIdent for line names. (WebCore::valueForGridPosition): Use createCustomIdent for grid line name. (WebCore::createTransitionPropertyValue): Use createCustomIdent for animation property names. (WebCore::counterToCSSValue): Use createCustomIdent for counter names. (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Use createCustomIdent for list-style-type, locale, animation names if they were created from a custom-ident, and line-grid. * css/CSSCustomIdentValue.cpp: Emptied out this file; we can delete it soon. * css/CSSCustomIdentValue.h: Ditto. * css/CSSMarkup.cpp: (WebCore::serializeCharacterAsCodePoint): Optimized to do a single StringBuilder::append call. (WebCore::serializeAsStringOrCustomIdent): Deleted. * css/CSSMarkup.h: Removed serializeAsStringOrCustomIdent. * css/CSSPrimitiveValue.cpp: (WebCore::isValidCSSUnitTypeForDoubleConversion): Added a case for CustomIdent. Changed CSS_IDENT to assert not reached, since it should never be passed to this function. More cleanup of CSSUnitType is needed, but for now mostly leaving it alone. (WebCore::isStringType): Added a case for CustomIdent. Moved CSS_DIMENSION, which was incorrectly returning true, to return false. Pretty sure there's no way to create one of these with CSS_DIMENSION, but this is less peculiar. (WebCore::CSSPrimitiveValue::primitiveType const): Added transformation from CustomIdent to CSS_IDENT as we do with CSS_PROPERTY_ID and CSS_VALUE_ID. (WebCore::CSSPrimitiveValue::cleanup): Added a case for CustomIdent. Moved CSS_DIMENSION to the correct section. Pretty sure there's no way to create one of these with CSS_DIMENSION, but this is less peculiar. (WebCore::CSSPrimitiveValue::setFloatValue): Deleted. (WebCore::CSSPrimitiveValue::setStringValue): Deleted. (WebCore::CSSPrimitiveValue::getStringValue const): Deleted. (WebCore::CSSPrimitiveValue::stringValue const): Added a case for CustomIdent. (WebCore::CSSPrimitiveValue::unitTypeString): Added a case for CustomIdent and an ASSERT_NOT_REACHED for invalid enumeration values. (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): Removed inaccurate FIXME comment for CSS_DIMENSION and changed it to do something less wrong, but still incorrect. Pretty sure there's no way to create one of these with CSS_DIMENSION, but this is less peculiar. Changed CSS_STRING case to always serializeAsString. Added a CustomIdent case that always serializes as an identifier. (WebCore::CSSPrimitiveValue::equals const): Moved the CSS_DIMENSION to the correct part of this switch statement. Pretty sure there's no way to create one of these with CSS_DIMENSION, but this is less peculiar. Added case for CustomIdent. * css/CSSPrimitiveValue.h: Made isFontRelativeLength, isResolution, and isViewportPercentageLength private. Made those plus isLength all constexpr. Removed WEBCORE_EXPORT from primitiveType and getFloatValue: those needed to be exported when this was the web-exposed class, but that is now DeprecatedCSSOMPrimitiveValue. Deleted setFloatValue, setStringValue, and getStringValue for the same reason: those functions are now in DeprecatedCSSOMPrimitiveValue and don't need to be here. * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationName): Updated to pass a boolean in to the animation name to keep track of whether it was created with a string or a custom-ident so we it can properly round-trip in computed style. This is required to pass some of the WPT tests, although I could not find clear guidance in the specification that this behavior is required. The same name with a string and custom-ident are equivalent in other ways. * css/CSSUnits.cpp: (WebCore::operator<<): Added a case for CustomIdent. * css/CSSUnits.h: Added CustomIdent. Added some FIXME about how we can change this in the future. It's a remnant of the past when these were part of our web-facing API, and this can be greatly cleaned up. * css/CSSValue.cpp: (WebCore::CSSValue::cssText const): Removed CSSCustomIdentValue.h, CustomIdentClass, CSSCustomIdentValue. We are not going to use a separate class for custom-ident, just a separate type of primitive value. (WebCore::CSSValue::destroy): Ditto. * css/CSSValue.h: Deleted isCustomIdentValue and CustomIdentClass. * css/CSSValueList.cpp: (WebCore::CSSValueList::customCSSText const): Tweaked algorithm to be slightly more efficient. * css/CSSValuePool.h: Added createCustomIdent. Later should remove the create function that takes a string value and a type and use separate named functions for the few different cases, but doing the new one this way for now. * css/DeprecatedCSSOMPrimitiveValue.cpp: (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const): Rewrote this to be a switch that preserves the current behavior but no longer relies on the numeric values of CSSUnitType values. Added a FIXME about using CSS_UNKNOWN more: some of the numbers we are exposing to the web are doing no good. (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue): Moved this function to the header. (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const): Rewrote this to be a switch as above. Preserves current behavior but stops relying on CSSUnitType numeric values. (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue): Moved this function to the header. (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue const): Ditto. By putting a switch on primitiveType here, we can enforce the desired exception behavior here, instead of getting it from CSSPrimitiveValue, and it's better for this class to deal with the legacy bindings issues. (WebCore::DeprecatedCSSOMPrimitiveValue::getCounterValue const): Ditto. (WebCore::DeprecatedCSSOMPrimitiveValue::getRectValue const): Ditto. (WebCore::DeprecatedCSSOMPrimitiveValue::getRGBColorValue const): Ditto. * css/DeprecatedCSSOMPrimitiveValue.h: Removed unneeded cssValueType function. Made both setFloatValue and setStringValue simpler since they always raise an exception and we do not intend to change that. Also stop using protected since we have no classes derived from this. Could do more cleanup, but this is a start. * css/DeprecatedCSSOMValue.cpp: (WebCore::DeprecatedCSSOMValue::cssValueType const): Put the constant values, CSS_PRIMITIVE_VALUE and CSS_VALUE_LIST, here rather than calling member functions. * css/DeprecatedCSSOMValueList.cpp: (WebCore::DeprecatedCSSOMValueList::cssText const): Tweaked to make the code more efficient. * css/DeprecatedCSSOMValueList.h: Removed unneeded cssValueType function and const overload of item function. Also stop using protected since we have no classes derived from this. * css/MediaQueryExpression.cpp: (WebCore::featureWithValidIdent): Fixed indentation to match WebKit style. (WebCore::featureWithValidDensity): Ditto. (WebCore::featureWithValidPositiveLength): Ditto. (WebCore::featureExpectingPositiveInteger): Ditto. (WebCore::featureWithPositiveNumber): Ditto. * css/calc/CSSCalcCategoryMapping.cpp: (WebCore::hasDoubleValue): Added a case for CustomIdent. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeWillChange): Removed comment saying we should use CSSCustomIdentValue since using a property ID for the value is great. (WebCore::consumeAnimationName): Removed comment saying we should use CSSCustomIdentValue here because that would be incorrect: we need to preserve and round-trip the fact that this was string, not custom-ident. (WebCore::consumeTransitionProperty): Remove special case for CSSValueAll that wasn't doing anything. Removed comment saying we should use CSSCustomIdentValue since using a value ID for the value is great. (WebCore::consumeAttr): Updated comment. (WebCore::isCustomIdentValue): Updated to work with the new primitive value. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeCustomIdent): Use the new createCustomIdent and removed an outdated comment. While we might some day want to implement custom-ident differently, we won't need to change the code here to make that happen. * platform/animation/Animation.cpp: (WebCore::Animation::animationsMatch const): Update since m_name now is a struct. (WebCore::Animation::initialName): Update to return Name instead of String. (WebCore::operator<<): Update since name() now returns a struct. * platform/animation/Animation.h: Added the Name struct so we can store a boolean to indicate whether it's a string or custom-ident for round tripping. Update types and implementations of function and data members accordingly. * style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::createGridPosition): Update code to expect custom-ident instead of string; they used to both be the same thing. * style/Styleable.cpp: (WebCore::shouldConsiderAnimation): Update since Animation::name() now returns a struct. Also got rid of unsuccessful attempt to optimize comparison againt the string "none"; later might be good to clean out that special case. (WebCore::Styleable::updateCSSAnimations const): Ditto. Tools: * TestRunnerShared/TestFeatures.cpp: (WTR::parseTestHeader): Fixed a missing quote that made a log message read strangely. LayoutTests: * TestExpectations: Removed expected failures from 13 css-counter-styles tests that are not currently failing. I had planned to work on making more of these pass, but first found I could fix them with a corrected custom-ident implementation. * css3/supports-expected.txt: Rebased. * css3/supports.html: Updated to expect the value of the content property to be a quoted string, rather than the old behavior, which was to leave the string unquoted if it happened to be a string with all characters legal for a custom-ident. New expectation is the correct behavior. * fast/css/alt-inherit-initial-expected.txt: Rebased. * fast/css/alt-inherit-initial.html: Updated to expect the value of the language property to be a custom-ident, and serialize unusual cases with custom-ident rules, not as a quoted string. New expectation is the correct behavior. * fast/css/content-language-comma-separated-list-expected.txt: Ditto. * fast/css/content-language-empty-expected.txt: Ditto. * fast/css/content-language-only-whitespace-expected.txt: Ditto. * fast/css/content-language-with-whitespace-expected.txt: Ditto. * fast/css/getComputedStyle/computed-style-properties-expected.txt: Rebased. * fast/css/getComputedStyle/computed-style-properties.html: Expect content string (see above). * fast/css/lang-mapped-to-webkit-locale-expected.txt: Rebased. * fast/css/lang-mapped-to-webkit-locale.xhtml: Expect language custom-ident (see above). * fast/css/nested-at-rules-expected.txt: Rebased. * fast/css/nested-at-rules.html: Expect content string (see above). * fast/css/parsing-text-emphasis-expected.txt: Rebased. * fast/css/parsing-text-emphasis.html: Updated to expect strings to remaing quoted strings in the text-emphasis property, not change into custom-ident if all characters happen to fit. * fast/encoding/css-charset-default-expected.txt: Expect content string (see above). * inspector/css/pseudo-element-matches-for-pseudo-element-node-expected.txt: Ditto. Canonical link: https://commits.webkit.org/238538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-07 02:39:33 +00:00
auto& name = animation.name().string;
if (name == "none" || name.isEmpty())
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
return false;
if (auto* styleScope = Style::Scope::forOrdinal(element, animation.nameStyleScopeOrdinal()))
return styleScope->resolver().isAnimationNameValid(name);
return false;
}
void Styleable::updateCSSAnimations(const RenderStyle* currentStyle, const RenderStyle& newStyle, const RenderStyle* parentElementStyle) const
{
auto& keyframeEffectStack = ensureKeyframeEffectStack();
// In case this element is newly getting a "display: none" we need to cancel all of its animations and disregard new ones.
if (currentStyle && currentStyle->display() != DisplayType::None && newStyle.display() == DisplayType::None) {
for (auto& cssAnimation : animationsCreatedByMarkup())
cssAnimation->cancelFromStyle();
keyframeEffectStack.setCSSAnimationList(nullptr);
return;
}
auto* currentAnimationList = newStyle.animations();
auto* previousAnimationList = keyframeEffectStack.cssAnimationList();
if (previousAnimationList && !previousAnimationList->isEmpty() && newStyle.hasAnimations() && *(previousAnimationList) == *(newStyle.animations()))
return;
CSSAnimationCollection newAnimations;
auto& previousAnimations = animationsCreatedByMarkup();
// https://www.w3.org/TR/css-animations-1/#animations
// The same @keyframes rule name may be repeated within an animation-name. Changes to the animation-name update existing
// animations by iterating over the new list of animations from last to first, and, for each animation, finding the last
// matching animation in the list of existing animations. If a match is found, the existing animation is updated using the
// animation properties corresponding to its position in the new list of animations, whilst maintaining its current playback
// time as described above. The matching animation is removed from the existing list of animations such that it will not match
// twice. If a match is not found, a new animation is created. As a result, updating animation-name from a to a, a will
// cause the existing animation for a to become the second animation in the list and a new animation will be created for the
// first item in the list.
if (currentAnimationList) {
for (size_t i = currentAnimationList->size(); i > 0; --i) {
auto& currentAnimation = currentAnimationList->animation(i - 1);
if (!shouldConsiderAnimation(this->element, currentAnimation))
continue;
bool foundMatchingAnimation = false;
for (auto& previousAnimation : previousAnimations) {
Handle custom identifiers and strings separately, so we can quote strings correctly consistently https://bugs.webkit.org/show_bug.cgi?id=226694 Reviewed by Sam Weinig. LayoutTests/imported/w3c: * web-platform-tests/css/css-animations/parsing/animation-name-valid-expected.txt: * web-platform-tests/css/css-counter-styles/counter-style-negative-syntax-expected.txt: * web-platform-tests/css/css-counter-styles/counter-style-pad-syntax-expected.txt: * web-platform-tests/css/css-counter-styles/counter-style-prefix-suffix-syntax-expected.txt: * web-platform-tests/css/css-counter-styles/counter-style-symbols-syntax-expected.txt: * web-platform-tests/css/css-grid/parsing/grid-area-computed-expected.txt: * web-platform-tests/css/css-grid/parsing/grid-area-shorthand-expected.txt: * web-platform-tests/css/css-grid/parsing/grid-area-valid-expected.txt: * web-platform-tests/css/css-lists/parsing/content-invalid-expected.txt: * web-platform-tests/css/css-transitions/transition-property-002-expected.txt: * web-platform-tests/css/cssom/getComputedStyle-pseudo-expected.txt: * web-platform-tests/css/cssom/serialize-values-expected.txt: Rebased to reflect progressions. In some cases the entire test passes, in other cases we still have failures, but the string serialization part of the test has progressed. Source/WebCore: Progressions in a number of WPT tests. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::CSSAnimation): Update since Animation::name() now returns a struct. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): Ditto. * css/CSSComputedStyleDeclaration.cpp: (WebCore::OrderedNamedLinesCollector::appendLines const): Use createCustomIdent for line names. (WebCore::valueForGridPosition): Use createCustomIdent for grid line name. (WebCore::createTransitionPropertyValue): Use createCustomIdent for animation property names. (WebCore::counterToCSSValue): Use createCustomIdent for counter names. (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Use createCustomIdent for list-style-type, locale, animation names if they were created from a custom-ident, and line-grid. * css/CSSCustomIdentValue.cpp: Emptied out this file; we can delete it soon. * css/CSSCustomIdentValue.h: Ditto. * css/CSSMarkup.cpp: (WebCore::serializeCharacterAsCodePoint): Optimized to do a single StringBuilder::append call. (WebCore::serializeAsStringOrCustomIdent): Deleted. * css/CSSMarkup.h: Removed serializeAsStringOrCustomIdent. * css/CSSPrimitiveValue.cpp: (WebCore::isValidCSSUnitTypeForDoubleConversion): Added a case for CustomIdent. Changed CSS_IDENT to assert not reached, since it should never be passed to this function. More cleanup of CSSUnitType is needed, but for now mostly leaving it alone. (WebCore::isStringType): Added a case for CustomIdent. Moved CSS_DIMENSION, which was incorrectly returning true, to return false. Pretty sure there's no way to create one of these with CSS_DIMENSION, but this is less peculiar. (WebCore::CSSPrimitiveValue::primitiveType const): Added transformation from CustomIdent to CSS_IDENT as we do with CSS_PROPERTY_ID and CSS_VALUE_ID. (WebCore::CSSPrimitiveValue::cleanup): Added a case for CustomIdent. Moved CSS_DIMENSION to the correct section. Pretty sure there's no way to create one of these with CSS_DIMENSION, but this is less peculiar. (WebCore::CSSPrimitiveValue::setFloatValue): Deleted. (WebCore::CSSPrimitiveValue::setStringValue): Deleted. (WebCore::CSSPrimitiveValue::getStringValue const): Deleted. (WebCore::CSSPrimitiveValue::stringValue const): Added a case for CustomIdent. (WebCore::CSSPrimitiveValue::unitTypeString): Added a case for CustomIdent and an ASSERT_NOT_REACHED for invalid enumeration values. (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): Removed inaccurate FIXME comment for CSS_DIMENSION and changed it to do something less wrong, but still incorrect. Pretty sure there's no way to create one of these with CSS_DIMENSION, but this is less peculiar. Changed CSS_STRING case to always serializeAsString. Added a CustomIdent case that always serializes as an identifier. (WebCore::CSSPrimitiveValue::equals const): Moved the CSS_DIMENSION to the correct part of this switch statement. Pretty sure there's no way to create one of these with CSS_DIMENSION, but this is less peculiar. Added case for CustomIdent. * css/CSSPrimitiveValue.h: Made isFontRelativeLength, isResolution, and isViewportPercentageLength private. Made those plus isLength all constexpr. Removed WEBCORE_EXPORT from primitiveType and getFloatValue: those needed to be exported when this was the web-exposed class, but that is now DeprecatedCSSOMPrimitiveValue. Deleted setFloatValue, setStringValue, and getStringValue for the same reason: those functions are now in DeprecatedCSSOMPrimitiveValue and don't need to be here. * css/CSSToStyleMap.cpp: (WebCore::CSSToStyleMap::mapAnimationName): Updated to pass a boolean in to the animation name to keep track of whether it was created with a string or a custom-ident so we it can properly round-trip in computed style. This is required to pass some of the WPT tests, although I could not find clear guidance in the specification that this behavior is required. The same name with a string and custom-ident are equivalent in other ways. * css/CSSUnits.cpp: (WebCore::operator<<): Added a case for CustomIdent. * css/CSSUnits.h: Added CustomIdent. Added some FIXME about how we can change this in the future. It's a remnant of the past when these were part of our web-facing API, and this can be greatly cleaned up. * css/CSSValue.cpp: (WebCore::CSSValue::cssText const): Removed CSSCustomIdentValue.h, CustomIdentClass, CSSCustomIdentValue. We are not going to use a separate class for custom-ident, just a separate type of primitive value. (WebCore::CSSValue::destroy): Ditto. * css/CSSValue.h: Deleted isCustomIdentValue and CustomIdentClass. * css/CSSValueList.cpp: (WebCore::CSSValueList::customCSSText const): Tweaked algorithm to be slightly more efficient. * css/CSSValuePool.h: Added createCustomIdent. Later should remove the create function that takes a string value and a type and use separate named functions for the few different cases, but doing the new one this way for now. * css/DeprecatedCSSOMPrimitiveValue.cpp: (WebCore::DeprecatedCSSOMPrimitiveValue::primitiveType const): Rewrote this to be a switch that preserves the current behavior but no longer relies on the numeric values of CSSUnitType values. Added a FIXME about using CSS_UNKNOWN more: some of the numbers we are exposing to the web are doing no good. (WebCore::DeprecatedCSSOMPrimitiveValue::setFloatValue): Moved this function to the header. (WebCore::DeprecatedCSSOMPrimitiveValue::getFloatValue const): Rewrote this to be a switch as above. Preserves current behavior but stops relying on CSSUnitType numeric values. (WebCore::DeprecatedCSSOMPrimitiveValue::setStringValue): Moved this function to the header. (WebCore::DeprecatedCSSOMPrimitiveValue::getStringValue const): Ditto. By putting a switch on primitiveType here, we can enforce the desired exception behavior here, instead of getting it from CSSPrimitiveValue, and it's better for this class to deal with the legacy bindings issues. (WebCore::DeprecatedCSSOMPrimitiveValue::getCounterValue const): Ditto. (WebCore::DeprecatedCSSOMPrimitiveValue::getRectValue const): Ditto. (WebCore::DeprecatedCSSOMPrimitiveValue::getRGBColorValue const): Ditto. * css/DeprecatedCSSOMPrimitiveValue.h: Removed unneeded cssValueType function. Made both setFloatValue and setStringValue simpler since they always raise an exception and we do not intend to change that. Also stop using protected since we have no classes derived from this. Could do more cleanup, but this is a start. * css/DeprecatedCSSOMValue.cpp: (WebCore::DeprecatedCSSOMValue::cssValueType const): Put the constant values, CSS_PRIMITIVE_VALUE and CSS_VALUE_LIST, here rather than calling member functions. * css/DeprecatedCSSOMValueList.cpp: (WebCore::DeprecatedCSSOMValueList::cssText const): Tweaked to make the code more efficient. * css/DeprecatedCSSOMValueList.h: Removed unneeded cssValueType function and const overload of item function. Also stop using protected since we have no classes derived from this. * css/MediaQueryExpression.cpp: (WebCore::featureWithValidIdent): Fixed indentation to match WebKit style. (WebCore::featureWithValidDensity): Ditto. (WebCore::featureWithValidPositiveLength): Ditto. (WebCore::featureExpectingPositiveInteger): Ditto. (WebCore::featureWithPositiveNumber): Ditto. * css/calc/CSSCalcCategoryMapping.cpp: (WebCore::hasDoubleValue): Added a case for CustomIdent. * css/parser/CSSPropertyParser.cpp: (WebCore::consumeWillChange): Removed comment saying we should use CSSCustomIdentValue since using a property ID for the value is great. (WebCore::consumeAnimationName): Removed comment saying we should use CSSCustomIdentValue here because that would be incorrect: we need to preserve and round-trip the fact that this was string, not custom-ident. (WebCore::consumeTransitionProperty): Remove special case for CSSValueAll that wasn't doing anything. Removed comment saying we should use CSSCustomIdentValue since using a value ID for the value is great. (WebCore::consumeAttr): Updated comment. (WebCore::isCustomIdentValue): Updated to work with the new primitive value. * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeCustomIdent): Use the new createCustomIdent and removed an outdated comment. While we might some day want to implement custom-ident differently, we won't need to change the code here to make that happen. * platform/animation/Animation.cpp: (WebCore::Animation::animationsMatch const): Update since m_name now is a struct. (WebCore::Animation::initialName): Update to return Name instead of String. (WebCore::operator<<): Update since name() now returns a struct. * platform/animation/Animation.h: Added the Name struct so we can store a boolean to indicate whether it's a string or custom-ident for round tripping. Update types and implementations of function and data members accordingly. * style/StyleBuilderConverter.h: (WebCore::Style::BuilderConverter::createGridPosition): Update code to expect custom-ident instead of string; they used to both be the same thing. * style/Styleable.cpp: (WebCore::shouldConsiderAnimation): Update since Animation::name() now returns a struct. Also got rid of unsuccessful attempt to optimize comparison againt the string "none"; later might be good to clean out that special case. (WebCore::Styleable::updateCSSAnimations const): Ditto. Tools: * TestRunnerShared/TestFeatures.cpp: (WTR::parseTestHeader): Fixed a missing quote that made a log message read strangely. LayoutTests: * TestExpectations: Removed expected failures from 13 css-counter-styles tests that are not currently failing. I had planned to work on making more of these pass, but first found I could fix them with a corrected custom-ident implementation. * css3/supports-expected.txt: Rebased. * css3/supports.html: Updated to expect the value of the content property to be a quoted string, rather than the old behavior, which was to leave the string unquoted if it happened to be a string with all characters legal for a custom-ident. New expectation is the correct behavior. * fast/css/alt-inherit-initial-expected.txt: Rebased. * fast/css/alt-inherit-initial.html: Updated to expect the value of the language property to be a custom-ident, and serialize unusual cases with custom-ident rules, not as a quoted string. New expectation is the correct behavior. * fast/css/content-language-comma-separated-list-expected.txt: Ditto. * fast/css/content-language-empty-expected.txt: Ditto. * fast/css/content-language-only-whitespace-expected.txt: Ditto. * fast/css/content-language-with-whitespace-expected.txt: Ditto. * fast/css/getComputedStyle/computed-style-properties-expected.txt: Rebased. * fast/css/getComputedStyle/computed-style-properties.html: Expect content string (see above). * fast/css/lang-mapped-to-webkit-locale-expected.txt: Rebased. * fast/css/lang-mapped-to-webkit-locale.xhtml: Expect language custom-ident (see above). * fast/css/nested-at-rules-expected.txt: Rebased. * fast/css/nested-at-rules.html: Expect content string (see above). * fast/css/parsing-text-emphasis-expected.txt: Rebased. * fast/css/parsing-text-emphasis.html: Updated to expect strings to remaing quoted strings in the text-emphasis property, not change into custom-ident if all characters happen to fit. * fast/encoding/css-charset-default-expected.txt: Expect content string (see above). * inspector/css/pseudo-element-matches-for-pseudo-element-node-expected.txt: Ditto. Canonical link: https://commits.webkit.org/238538@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278540 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-06-07 02:39:33 +00:00
if (previousAnimation->animationName() == currentAnimation.name().string) {
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
// Timing properties or play state may have changed so we need to update the backing animation with
// the Animation found in the current style.
previousAnimation->setBackingAnimation(currentAnimation);
newAnimations.add(previousAnimation);
// Remove the matched animation from the list of previous animations so we may not match it again.
previousAnimations.remove(previousAnimation);
foundMatchingAnimation = true;
break;
}
}
if (!foundMatchingAnimation)
newAnimations.add(CSSAnimation::create(*this, currentAnimation, currentStyle, newStyle, parentElementStyle));
}
}
// Any animation found in previousAnimations but not found in newAnimations is not longer current and should be canceled.
for (auto& previousAnimation : previousAnimations) {
if (!newAnimations.contains(previousAnimation)) {
if (previousAnimation->owningElement())
previousAnimation->cancelFromStyle();
}
}
setAnimationsCreatedByMarkup(WTFMove(newAnimations));
keyframeEffectStack.setCSSAnimationList(currentAnimationList);
}
static KeyframeEffect* keyframeEffectForElementAndProperty(const Styleable& styleable, CSSPropertyID property)
{
if (auto* keyframeEffectStack = styleable.keyframeEffectStack()) {
auto effects = keyframeEffectStack->sortedEffects();
for (const auto& effect : makeReversedRange(effects)) {
if (effect->animatesProperty(property))
return effect.get();
}
}
return nullptr;
}
static bool propertyInStyleMatchesValueForTransitionInMap(CSSPropertyID property, const RenderStyle& style, PropertyToTransitionMap& transitions)
{
if (auto* transition = transitions.get(property)) {
Refactor parameters to blending functions https://bugs.webkit.org/show_bug.cgi?id=224433 Reviewed by Dean Jackson. Reduce the number of parameters passed to the blending functions such that we package the client and progress together and track whether the animation is discrete instead of computing it several times. This information is now passed as a BlendingContext parameter, and a CSSPropertyBlendingContext private to CSSPropertyAnimation. When we support composite operations, we'll just need to add a new member to that struct instead of modifying all the method signatures. Since we are modifying the method signatures, we also change the RenderStyle pointers to references since we would never pass in a null value. * animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext): (WebCore::blendFunc): (WebCore::blendFilterOperations): (WebCore::blendFilter): (WebCore::crossfadeBlend): (WebCore::AnimationPropertyWrapperBase::canInterpolate const): (WebCore::PropertyWrapperGetter::value const): (WebCore::canInterpolateCaretColor): (WebCore::CSSPropertyAnimation::blendProperties): (WebCore::CSSPropertyAnimation::propertiesEqual): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * animation/CSSPropertyAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): * css/CSSCrossfadeValue.cpp: (WebCore::blendFunc): (WebCore::CSSCrossfadeValue::blend const): * css/CSSCrossfadeValue.h: * css/CSSGradientValue.cpp: (WebCore::RadialGradientAdapter::normalizeStopsAndEndpointsOutsideRange): (WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange): (WebCore::CSSGradientValue::computeStops): * platform/Length.cpp: (WebCore::blendMixedTypes): (WebCore::blend): * platform/Length.h: * platform/LengthPoint.h: (WebCore::blend): * platform/LengthSize.h: (WebCore::blend): * platform/animation/AnimationUtilities.h: (WebCore::blend): * platform/graphics/ColorBlending.cpp: (WebCore::blend): (WebCore::blendWithoutPremultiply): * platform/graphics/ColorBlending.h: * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (WebCore::PlatformCAFilters::colorMatrixValueForFilter): * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicColorMatrixFilterOperation::blend): (WebCore::BasicComponentTransferFilterOperation::blend): (WebCore::InvertLightnessFilterOperation::blend): (WebCore::BlurFilterOperation::blend): (WebCore::DropShadowFilterOperation::blend): * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::blend): * platform/graphics/transforms/IdentityTransformOperation.h: * platform/graphics/transforms/Matrix3DTransformOperation.cpp: (WebCore::createOperation): (WebCore::Matrix3DTransformOperation::blend): * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.cpp: (WebCore::MatrixTransformOperation::blend): * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.cpp: (WebCore::PerspectiveTransformOperation::blend): * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.cpp: (WebCore::RotateTransformOperation::blend): * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.cpp: (WebCore::ScaleTransformOperation::blend): * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.cpp: (WebCore::SkewTransformOperation::blend): * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::blendByMatchingOperations const): (WebCore::TransformOperations::blendByUsingMatrixInterpolation const): (WebCore::TransformOperations::blend const): * platform/graphics/transforms/TransformOperations.h: * platform/graphics/transforms/TranslateTransformOperation.cpp: (WebCore::TranslateTransformOperation::blend): * platform/graphics/transforms/TranslateTransformOperation.h: * rendering/style/BasicShapes.cpp: (WebCore::BasicShapeCircle::blend const): (WebCore::BasicShapeEllipse::blend const): (WebCore::BasicShapePolygon::blend const): (WebCore::BasicShapePath::blend const): (WebCore::BasicShapeInset::blend const): * rendering/style/BasicShapes.h: (WebCore::BasicShapeCenterCoordinate::blend const): (WebCore::BasicShapeRadius::blend const): * style/Styleable.cpp: (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::updateCSSTransitionsForStyleableAndProperty): * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::blend): * svg/SVGPathBlender.cpp: (WebCore::blendFloatPoint): (WebCore::SVGPathBlender::blendAnimatedDimensonalFloat): (WebCore::SVGPathBlender::blendArcToSegment): Canonical link: https://commits.webkit.org/236634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 16:55:43 +00:00
if (CSSPropertyAnimation::propertiesEqual(property, style, transition->targetStyle()))
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
return true;
}
return false;
}
static double transitionCombinedDuration(const Animation* transition)
{
return std::max(0.0, transition->duration()) + transition->delay();
}
static bool transitionMatchesProperty(const Animation& transition, CSSPropertyID property)
{
auto mode = transition.property().mode;
if (mode == Animation::TransitionMode::None || mode == Animation::TransitionMode::UnknownProperty)
return false;
if (mode == Animation::TransitionMode::SingleProperty) {
auto transitionProperty = transition.property().id;
if (transitionProperty != property) {
for (auto longhand : shorthandForProperty(transitionProperty)) {
if (longhand == property)
return true;
}
return false;
}
}
return true;
}
static void compileTransitionPropertiesInStyle(const RenderStyle& style, HashSet<CSSPropertyID>& transitionProperties, bool& transitionPropertiesContainAll)
{
if (transitionPropertiesContainAll)
return;
auto* transitions = style.transitions();
if (!transitions)
return;
for (size_t i = 0; i < transitions->size(); ++i) {
const auto& animation = transitions->animation(i);
auto mode = animation.property().mode;
if (mode == Animation::TransitionMode::SingleProperty) {
auto property = animation.property().id;
if (isShorthandCSSProperty(property)) {
for (auto longhand : shorthandForProperty(property))
transitionProperties.add(longhand);
} else if (property != CSSPropertyInvalid)
transitionProperties.add(property);
} else if (mode == Animation::TransitionMode::All) {
transitionPropertiesContainAll = true;
return;
}
}
}
static void updateCSSTransitionsForStyleableAndProperty(const Styleable& styleable, CSSPropertyID property, const RenderStyle& currentStyle, const RenderStyle& newStyle, const MonotonicTime generationTime)
{
auto* keyframeEffect = keyframeEffectForElementAndProperty(styleable, property);
auto* animation = keyframeEffect ? keyframeEffect->animation() : nullptr;
bool isDeclarative = false;
if (is<DeclarativeAnimation>(animation)) {
if (auto owningElement = downcast<DeclarativeAnimation>(*animation).owningElement())
isDeclarative = *owningElement == styleable;
}
if (animation && !isDeclarative)
return;
const Animation* matchingBackingAnimation = nullptr;
if (auto* transitions = newStyle.transitions()) {
for (size_t i = 0; i < transitions->size(); ++i) {
auto& backingAnimation = transitions->animation(i);
if (transitionMatchesProperty(backingAnimation, property))
matchingBackingAnimation = &backingAnimation;
}
}
// A CSS Transition might have completed since the last time animations were updated so we must
// update the running and completed transitions membership in that case.
if (is<CSSTransition>(animation) && matchingBackingAnimation && styleable.hasRunningTransitionForProperty(property) && animation->playState() == WebAnimation::PlayState::Finished) {
styleable.ensureCompletedTransitionsByProperty().set(property, styleable.ensureRunningTransitionsByProperty().take(property));
animation = nullptr;
}
// https://drafts.csswg.org/css-transitions-1/#before-change-style
// Define the before-change style as the computed values of all properties on the element as of the previous style change event, except with
// any styles derived from declarative animations such as CSS Transitions, CSS Animations, and SMIL Animations updated to the current time.
auto beforeChangeStyle = [&]() -> const RenderStyle {
if (animation && animation->isRelevant()) {
auto animatedStyle = RenderStyle::clone(currentStyle);
// If a transition has not yet started or started when animations were last updated, use the timeline time at its creation
// as its start time to ensure that it will produce a style with progress > 0.
bool shouldUseTimelineTimeAtCreation = is<CSSTransition>(animation) && (!animation->startTime() || *animation->startTime() == styleable.element.document().timeline().currentTime());
Next step toward using std::optional directly instead of through WTF::Optional typedef https://bugs.webkit.org/show_bug.cgi?id=226280 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Accept the renaming done by do-webcore-rename. * yarr/YarrSyntaxChecker.cpp: Since the style checker complained about this file, tweaked style to make it happy after the renaming done by do-webcore-rename, and also hand-updated Optional to std::optional as long as we were touching it. Source/WebCore: * <many files>: Accept the renaming done by do-webcore-rename. * Modules/webauthn/fido/DeviceRequestConverter.h: Since style checker complained about the names of some arguments, fixed them, and also hand-updated Optional to std::optional as long as we were touching it. * loader/EmptyClients.cpp: Since style checker complained about the mix of WEBCORE_EXPORT and inlined functions, moved them out of line, and also hand-updated Optional to std::optional as long as we were touching it. Also removed is<EmptyFrameLoaderClient>(). * loader/EmptyFrameLoaderClient.h: Ditto. Source/WebCore/PAL: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebDriver: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKit: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy: * Storage/StorageTracker.cpp: (WebKit::StorageTracker::diskUsageForOrigin): Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/mac: * <many files>: Accept the renaming done by do-webcore-rename. Source/WebKitLegacy/win: * <many files>: Accept the renaming done by do-webcore-rename. Source/WTF: * <many files>: Accept the renaming done by do-webcore-rename. * wtf/Optional.h: Remove WTF::nullopt_t and WTF::makeOptional. * wtf/URLHelpers.cpp: (WTF::URLHelpers::mapHostName): Convert from nullopt to std::nullopt. Tools: * Scripts/do-webcore-rename: Use script to rename valueOr, WTF::nullopt, WTF::nullopt_t, WTF::Optional, WTF::makeOptional, and makeOptional. Other renamings can't necessarily be done by the script and so will be done in later passes. * <many files>: Accept the renaming done by do-webcore-rename. Canonical link: https://commits.webkit.org/238228@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278185 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-28 01:26:23 +00:00
animation->resolve(animatedStyle, nullptr, shouldUseTimelineTimeAtCreation ? downcast<CSSTransition>(*animation).timelineTimeAtCreation() : std::nullopt);
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
return animatedStyle;
}
// If it exists, use the recorded RenderStyle for this element during a previous call to Style::TreeResolver::createAnimatedElementUpdate().
if (auto* lastStyleChangeEventStyle = styleable.lastStyleChangeEventStyle())
return RenderStyle::clone(*lastStyleChangeEventStyle);
// If we haven't computed styles from animations for this element, the before-change style is the previously resolved style for this element.
return RenderStyle::clone(currentStyle);
}();
// https://drafts.csswg.org/css-transitions-1/#after-change-style
// Likewise, define the after-change style as the computed values of all properties on the element based on the information known at the start
// of that style change event, but using the computed values of the animation-* properties from the before-change style, excluding any styles
// from CSS Transitions in the computation, and inheriting from the after-change style of the parent. Note that this means the after-change
// style does not differ from the before-change style due to newly created or canceled CSS Animations.
auto afterChangeStyle = [&]() -> const RenderStyle {
if (is<CSSAnimation>(animation) && animation->isRelevant()) {
auto animatedStyle = RenderStyle::clone(newStyle);
animation->resolve(animatedStyle, nullptr);
return animatedStyle;
}
return RenderStyle::clone(newStyle);
}();
if (!styleable.hasRunningTransitionForProperty(property)
Refactor parameters to blending functions https://bugs.webkit.org/show_bug.cgi?id=224433 Reviewed by Dean Jackson. Reduce the number of parameters passed to the blending functions such that we package the client and progress together and track whether the animation is discrete instead of computing it several times. This information is now passed as a BlendingContext parameter, and a CSSPropertyBlendingContext private to CSSPropertyAnimation. When we support composite operations, we'll just need to add a new member to that struct instead of modifying all the method signatures. Since we are modifying the method signatures, we also change the RenderStyle pointers to references since we would never pass in a null value. * animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext): (WebCore::blendFunc): (WebCore::blendFilterOperations): (WebCore::blendFilter): (WebCore::crossfadeBlend): (WebCore::AnimationPropertyWrapperBase::canInterpolate const): (WebCore::PropertyWrapperGetter::value const): (WebCore::canInterpolateCaretColor): (WebCore::CSSPropertyAnimation::blendProperties): (WebCore::CSSPropertyAnimation::propertiesEqual): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * animation/CSSPropertyAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): * css/CSSCrossfadeValue.cpp: (WebCore::blendFunc): (WebCore::CSSCrossfadeValue::blend const): * css/CSSCrossfadeValue.h: * css/CSSGradientValue.cpp: (WebCore::RadialGradientAdapter::normalizeStopsAndEndpointsOutsideRange): (WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange): (WebCore::CSSGradientValue::computeStops): * platform/Length.cpp: (WebCore::blendMixedTypes): (WebCore::blend): * platform/Length.h: * platform/LengthPoint.h: (WebCore::blend): * platform/LengthSize.h: (WebCore::blend): * platform/animation/AnimationUtilities.h: (WebCore::blend): * platform/graphics/ColorBlending.cpp: (WebCore::blend): (WebCore::blendWithoutPremultiply): * platform/graphics/ColorBlending.h: * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (WebCore::PlatformCAFilters::colorMatrixValueForFilter): * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicColorMatrixFilterOperation::blend): (WebCore::BasicComponentTransferFilterOperation::blend): (WebCore::InvertLightnessFilterOperation::blend): (WebCore::BlurFilterOperation::blend): (WebCore::DropShadowFilterOperation::blend): * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::blend): * platform/graphics/transforms/IdentityTransformOperation.h: * platform/graphics/transforms/Matrix3DTransformOperation.cpp: (WebCore::createOperation): (WebCore::Matrix3DTransformOperation::blend): * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.cpp: (WebCore::MatrixTransformOperation::blend): * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.cpp: (WebCore::PerspectiveTransformOperation::blend): * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.cpp: (WebCore::RotateTransformOperation::blend): * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.cpp: (WebCore::ScaleTransformOperation::blend): * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.cpp: (WebCore::SkewTransformOperation::blend): * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::blendByMatchingOperations const): (WebCore::TransformOperations::blendByUsingMatrixInterpolation const): (WebCore::TransformOperations::blend const): * platform/graphics/transforms/TransformOperations.h: * platform/graphics/transforms/TranslateTransformOperation.cpp: (WebCore::TranslateTransformOperation::blend): * platform/graphics/transforms/TranslateTransformOperation.h: * rendering/style/BasicShapes.cpp: (WebCore::BasicShapeCircle::blend const): (WebCore::BasicShapeEllipse::blend const): (WebCore::BasicShapePolygon::blend const): (WebCore::BasicShapePath::blend const): (WebCore::BasicShapeInset::blend const): * rendering/style/BasicShapes.h: (WebCore::BasicShapeCenterCoordinate::blend const): (WebCore::BasicShapeRadius::blend const): * style/Styleable.cpp: (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::updateCSSTransitionsForStyleableAndProperty): * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::blend): * svg/SVGPathBlender.cpp: (WebCore::blendFloatPoint): (WebCore::SVGPathBlender::blendAnimatedDimensonalFloat): (WebCore::SVGPathBlender::blendArcToSegment): Canonical link: https://commits.webkit.org/236634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 16:55:43 +00:00
&& !CSSPropertyAnimation::propertiesEqual(property, beforeChangeStyle, afterChangeStyle)
&& CSSPropertyAnimation::canPropertyBeInterpolated(property, beforeChangeStyle, afterChangeStyle)
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
&& !propertyInStyleMatchesValueForTransitionInMap(property, afterChangeStyle, styleable.ensureCompletedTransitionsByProperty())
&& matchingBackingAnimation && transitionCombinedDuration(matchingBackingAnimation) > 0) {
// 1. If all of the following are true:
// - the element does not have a running transition for the property,
// - the before-change style is different from and can be interpolated with the after-change style for that property,
// - the element does not have a completed transition for the property or the end value of the completed transition is different from the after-change style for the property,
// - there is a matching transition-property value, and
// - the combined duration is greater than 0s,
// then implementations must remove the completed transition (if present) from the set of completed transitions
styleable.ensureCompletedTransitionsByProperty().remove(property);
// and start a transition whose:
// - start time is the time of the style change event plus the matching transition delay,
// - end time is the start time plus the matching transition duration,
// - start value is the value of the transitioning property in the before-change style,
// - end value is the value of the transitioning property in the after-change style,
// - reversing-adjusted start value is the same as the start value, and
// - reversing shortening factor is 1.
auto delay = Seconds(matchingBackingAnimation->delay());
auto duration = Seconds(matchingBackingAnimation->duration());
auto& reversingAdjustedStartStyle = beforeChangeStyle;
auto reversingShorteningFactor = 1;
styleable.ensureRunningTransitionsByProperty().set(property, CSSTransition::create(styleable, property, generationTime, *matchingBackingAnimation, &beforeChangeStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));
} else if (styleable.hasCompletedTransitionForProperty(property) && !propertyInStyleMatchesValueForTransitionInMap(property, afterChangeStyle, styleable.ensureCompletedTransitionsByProperty())) {
// 2. Otherwise, if the element has a completed transition for the property and the end value of the completed transition is different from
// the after-change style for the property, then implementations must remove the completed transition from the set of completed transitions.
styleable.ensureCompletedTransitionsByProperty().remove(property);
}
bool hasRunningTransition = styleable.hasRunningTransitionForProperty(property);
if ((hasRunningTransition || styleable.hasCompletedTransitionForProperty(property)) && !matchingBackingAnimation) {
// 3. If the element has a running transition or completed transition for the property, and there is not a matching transition-property
// value, then implementations must cancel the running transition or remove the completed transition from the set of completed transitions.
if (hasRunningTransition)
styleable.ensureRunningTransitionsByProperty().take(property)->cancel();
else
styleable.ensureCompletedTransitionsByProperty().remove(property);
}
if (matchingBackingAnimation && styleable.hasRunningTransitionForProperty(property) && !propertyInStyleMatchesValueForTransitionInMap(property, afterChangeStyle, styleable.ensureRunningTransitionsByProperty())) {
auto previouslyRunningTransition = styleable.ensureRunningTransitionsByProperty().take(property);
auto& previouslyRunningTransitionCurrentStyle = previouslyRunningTransition->currentStyle();
// 4. If the element has a running transition for the property, there is a matching transition-property value, and the end value of the running
// transition is not equal to the value of the property in the after-change style, then:
Refactor parameters to blending functions https://bugs.webkit.org/show_bug.cgi?id=224433 Reviewed by Dean Jackson. Reduce the number of parameters passed to the blending functions such that we package the client and progress together and track whether the animation is discrete instead of computing it several times. This information is now passed as a BlendingContext parameter, and a CSSPropertyBlendingContext private to CSSPropertyAnimation. When we support composite operations, we'll just need to add a new member to that struct instead of modifying all the method signatures. Since we are modifying the method signatures, we also change the RenderStyle pointers to references since we would never pass in a null value. * animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext): (WebCore::blendFunc): (WebCore::blendFilterOperations): (WebCore::blendFilter): (WebCore::crossfadeBlend): (WebCore::AnimationPropertyWrapperBase::canInterpolate const): (WebCore::PropertyWrapperGetter::value const): (WebCore::canInterpolateCaretColor): (WebCore::CSSPropertyAnimation::blendProperties): (WebCore::CSSPropertyAnimation::propertiesEqual): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * animation/CSSPropertyAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): * css/CSSCrossfadeValue.cpp: (WebCore::blendFunc): (WebCore::CSSCrossfadeValue::blend const): * css/CSSCrossfadeValue.h: * css/CSSGradientValue.cpp: (WebCore::RadialGradientAdapter::normalizeStopsAndEndpointsOutsideRange): (WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange): (WebCore::CSSGradientValue::computeStops): * platform/Length.cpp: (WebCore::blendMixedTypes): (WebCore::blend): * platform/Length.h: * platform/LengthPoint.h: (WebCore::blend): * platform/LengthSize.h: (WebCore::blend): * platform/animation/AnimationUtilities.h: (WebCore::blend): * platform/graphics/ColorBlending.cpp: (WebCore::blend): (WebCore::blendWithoutPremultiply): * platform/graphics/ColorBlending.h: * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (WebCore::PlatformCAFilters::colorMatrixValueForFilter): * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicColorMatrixFilterOperation::blend): (WebCore::BasicComponentTransferFilterOperation::blend): (WebCore::InvertLightnessFilterOperation::blend): (WebCore::BlurFilterOperation::blend): (WebCore::DropShadowFilterOperation::blend): * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::blend): * platform/graphics/transforms/IdentityTransformOperation.h: * platform/graphics/transforms/Matrix3DTransformOperation.cpp: (WebCore::createOperation): (WebCore::Matrix3DTransformOperation::blend): * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.cpp: (WebCore::MatrixTransformOperation::blend): * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.cpp: (WebCore::PerspectiveTransformOperation::blend): * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.cpp: (WebCore::RotateTransformOperation::blend): * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.cpp: (WebCore::ScaleTransformOperation::blend): * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.cpp: (WebCore::SkewTransformOperation::blend): * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::blendByMatchingOperations const): (WebCore::TransformOperations::blendByUsingMatrixInterpolation const): (WebCore::TransformOperations::blend const): * platform/graphics/transforms/TransformOperations.h: * platform/graphics/transforms/TranslateTransformOperation.cpp: (WebCore::TranslateTransformOperation::blend): * platform/graphics/transforms/TranslateTransformOperation.h: * rendering/style/BasicShapes.cpp: (WebCore::BasicShapeCircle::blend const): (WebCore::BasicShapeEllipse::blend const): (WebCore::BasicShapePolygon::blend const): (WebCore::BasicShapePath::blend const): (WebCore::BasicShapeInset::blend const): * rendering/style/BasicShapes.h: (WebCore::BasicShapeCenterCoordinate::blend const): (WebCore::BasicShapeRadius::blend const): * style/Styleable.cpp: (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::updateCSSTransitionsForStyleableAndProperty): * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::blend): * svg/SVGPathBlender.cpp: (WebCore::blendFloatPoint): (WebCore::SVGPathBlender::blendAnimatedDimensonalFloat): (WebCore::SVGPathBlender::blendArcToSegment): Canonical link: https://commits.webkit.org/236634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 16:55:43 +00:00
if (CSSPropertyAnimation::propertiesEqual(property, previouslyRunningTransitionCurrentStyle, afterChangeStyle) || !CSSPropertyAnimation::canPropertyBeInterpolated(property, currentStyle, afterChangeStyle)) {
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
// 1. If the current value of the property in the running transition is equal to the value of the property in the after-change style,
// or if these two values cannot be interpolated, then implementations must cancel the running transition.
previouslyRunningTransition->cancelFromStyle();
Refactor parameters to blending functions https://bugs.webkit.org/show_bug.cgi?id=224433 Reviewed by Dean Jackson. Reduce the number of parameters passed to the blending functions such that we package the client and progress together and track whether the animation is discrete instead of computing it several times. This information is now passed as a BlendingContext parameter, and a CSSPropertyBlendingContext private to CSSPropertyAnimation. When we support composite operations, we'll just need to add a new member to that struct instead of modifying all the method signatures. Since we are modifying the method signatures, we also change the RenderStyle pointers to references since we would never pass in a null value. * animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext): (WebCore::blendFunc): (WebCore::blendFilterOperations): (WebCore::blendFilter): (WebCore::crossfadeBlend): (WebCore::AnimationPropertyWrapperBase::canInterpolate const): (WebCore::PropertyWrapperGetter::value const): (WebCore::canInterpolateCaretColor): (WebCore::CSSPropertyAnimation::blendProperties): (WebCore::CSSPropertyAnimation::propertiesEqual): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * animation/CSSPropertyAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): * css/CSSCrossfadeValue.cpp: (WebCore::blendFunc): (WebCore::CSSCrossfadeValue::blend const): * css/CSSCrossfadeValue.h: * css/CSSGradientValue.cpp: (WebCore::RadialGradientAdapter::normalizeStopsAndEndpointsOutsideRange): (WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange): (WebCore::CSSGradientValue::computeStops): * platform/Length.cpp: (WebCore::blendMixedTypes): (WebCore::blend): * platform/Length.h: * platform/LengthPoint.h: (WebCore::blend): * platform/LengthSize.h: (WebCore::blend): * platform/animation/AnimationUtilities.h: (WebCore::blend): * platform/graphics/ColorBlending.cpp: (WebCore::blend): (WebCore::blendWithoutPremultiply): * platform/graphics/ColorBlending.h: * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (WebCore::PlatformCAFilters::colorMatrixValueForFilter): * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicColorMatrixFilterOperation::blend): (WebCore::BasicComponentTransferFilterOperation::blend): (WebCore::InvertLightnessFilterOperation::blend): (WebCore::BlurFilterOperation::blend): (WebCore::DropShadowFilterOperation::blend): * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::blend): * platform/graphics/transforms/IdentityTransformOperation.h: * platform/graphics/transforms/Matrix3DTransformOperation.cpp: (WebCore::createOperation): (WebCore::Matrix3DTransformOperation::blend): * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.cpp: (WebCore::MatrixTransformOperation::blend): * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.cpp: (WebCore::PerspectiveTransformOperation::blend): * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.cpp: (WebCore::RotateTransformOperation::blend): * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.cpp: (WebCore::ScaleTransformOperation::blend): * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.cpp: (WebCore::SkewTransformOperation::blend): * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::blendByMatchingOperations const): (WebCore::TransformOperations::blendByUsingMatrixInterpolation const): (WebCore::TransformOperations::blend const): * platform/graphics/transforms/TransformOperations.h: * platform/graphics/transforms/TranslateTransformOperation.cpp: (WebCore::TranslateTransformOperation::blend): * platform/graphics/transforms/TranslateTransformOperation.h: * rendering/style/BasicShapes.cpp: (WebCore::BasicShapeCircle::blend const): (WebCore::BasicShapeEllipse::blend const): (WebCore::BasicShapePolygon::blend const): (WebCore::BasicShapePath::blend const): (WebCore::BasicShapeInset::blend const): * rendering/style/BasicShapes.h: (WebCore::BasicShapeCenterCoordinate::blend const): (WebCore::BasicShapeRadius::blend const): * style/Styleable.cpp: (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::updateCSSTransitionsForStyleableAndProperty): * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::blend): * svg/SVGPathBlender.cpp: (WebCore::blendFloatPoint): (WebCore::SVGPathBlender::blendAnimatedDimensonalFloat): (WebCore::SVGPathBlender::blendArcToSegment): Canonical link: https://commits.webkit.org/236634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 16:55:43 +00:00
} else if (transitionCombinedDuration(matchingBackingAnimation) <= 0.0 || !CSSPropertyAnimation::canPropertyBeInterpolated(property, previouslyRunningTransitionCurrentStyle, afterChangeStyle)) {
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
// 2. Otherwise, if the combined duration is less than or equal to 0s, or if the current value of the property in the running transition
// cannot be interpolated with the value of the property in the after-change style, then implementations must cancel the running transition.
previouslyRunningTransition->cancelFromStyle();
Refactor parameters to blending functions https://bugs.webkit.org/show_bug.cgi?id=224433 Reviewed by Dean Jackson. Reduce the number of parameters passed to the blending functions such that we package the client and progress together and track whether the animation is discrete instead of computing it several times. This information is now passed as a BlendingContext parameter, and a CSSPropertyBlendingContext private to CSSPropertyAnimation. When we support composite operations, we'll just need to add a new member to that struct instead of modifying all the method signatures. Since we are modifying the method signatures, we also change the RenderStyle pointers to references since we would never pass in a null value. * animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyBlendingContext::CSSPropertyBlendingContext): (WebCore::blendFunc): (WebCore::blendFilterOperations): (WebCore::blendFilter): (WebCore::crossfadeBlend): (WebCore::AnimationPropertyWrapperBase::canInterpolate const): (WebCore::PropertyWrapperGetter::value const): (WebCore::canInterpolateCaretColor): (WebCore::CSSPropertyAnimation::blendProperties): (WebCore::CSSPropertyAnimation::propertiesEqual): (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated): * animation/CSSPropertyAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): * css/CSSCrossfadeValue.cpp: (WebCore::blendFunc): (WebCore::CSSCrossfadeValue::blend const): * css/CSSCrossfadeValue.h: * css/CSSGradientValue.cpp: (WebCore::RadialGradientAdapter::normalizeStopsAndEndpointsOutsideRange): (WebCore::ConicGradientAdapter::normalizeStopsAndEndpointsOutsideRange): (WebCore::CSSGradientValue::computeStops): * platform/Length.cpp: (WebCore::blendMixedTypes): (WebCore::blend): * platform/Length.h: * platform/LengthPoint.h: (WebCore::blend): * platform/LengthSize.h: (WebCore::blend): * platform/animation/AnimationUtilities.h: (WebCore::blend): * platform/graphics/ColorBlending.cpp: (WebCore::blend): (WebCore::blendWithoutPremultiply): * platform/graphics/ColorBlending.h: * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm: (WebCore::PlatformCAFilters::colorMatrixValueForFilter): * platform/graphics/filters/FilterOperation.cpp: (WebCore::BasicColorMatrixFilterOperation::blend): (WebCore::BasicComponentTransferFilterOperation::blend): (WebCore::InvertLightnessFilterOperation::blend): (WebCore::BlurFilterOperation::blend): (WebCore::DropShadowFilterOperation::blend): * platform/graphics/filters/FilterOperation.h: (WebCore::FilterOperation::blend): * platform/graphics/transforms/IdentityTransformOperation.h: * platform/graphics/transforms/Matrix3DTransformOperation.cpp: (WebCore::createOperation): (WebCore::Matrix3DTransformOperation::blend): * platform/graphics/transforms/Matrix3DTransformOperation.h: * platform/graphics/transforms/MatrixTransformOperation.cpp: (WebCore::MatrixTransformOperation::blend): * platform/graphics/transforms/MatrixTransformOperation.h: * platform/graphics/transforms/PerspectiveTransformOperation.cpp: (WebCore::PerspectiveTransformOperation::blend): * platform/graphics/transforms/PerspectiveTransformOperation.h: * platform/graphics/transforms/RotateTransformOperation.cpp: (WebCore::RotateTransformOperation::blend): * platform/graphics/transforms/RotateTransformOperation.h: * platform/graphics/transforms/ScaleTransformOperation.cpp: (WebCore::ScaleTransformOperation::blend): * platform/graphics/transforms/ScaleTransformOperation.h: * platform/graphics/transforms/SkewTransformOperation.cpp: (WebCore::SkewTransformOperation::blend): * platform/graphics/transforms/SkewTransformOperation.h: * platform/graphics/transforms/TransformOperation.h: * platform/graphics/transforms/TransformOperations.cpp: (WebCore::TransformOperations::blendByMatchingOperations const): (WebCore::TransformOperations::blendByUsingMatrixInterpolation const): (WebCore::TransformOperations::blend const): * platform/graphics/transforms/TransformOperations.h: * platform/graphics/transforms/TranslateTransformOperation.cpp: (WebCore::TranslateTransformOperation::blend): * platform/graphics/transforms/TranslateTransformOperation.h: * rendering/style/BasicShapes.cpp: (WebCore::BasicShapeCircle::blend const): (WebCore::BasicShapeEllipse::blend const): (WebCore::BasicShapePolygon::blend const): (WebCore::BasicShapePath::blend const): (WebCore::BasicShapeInset::blend const): * rendering/style/BasicShapes.h: (WebCore::BasicShapeCenterCoordinate::blend const): (WebCore::BasicShapeRadius::blend const): * style/Styleable.cpp: (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::updateCSSTransitionsForStyleableAndProperty): * svg/SVGLengthValue.cpp: (WebCore::SVGLengthValue::blend): * svg/SVGPathBlender.cpp: (WebCore::blendFloatPoint): (WebCore::SVGPathBlender::blendAnimatedDimensonalFloat): (WebCore::SVGPathBlender::blendArcToSegment): Canonical link: https://commits.webkit.org/236634@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-04-16 16:55:43 +00:00
} else if (CSSPropertyAnimation::propertiesEqual(property, previouslyRunningTransition->reversingAdjustedStartStyle(), afterChangeStyle)) {
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
// 3. Otherwise, if the reversing-adjusted start value of the running transition is the same as the value of the property in the after-change
// style (see the section on reversing of transitions for why these case exists), implementations must cancel the running transition
previouslyRunningTransition->cancelFromStyle();
// and start a new transition whose:
// - reversing-adjusted start value is the end value of the running transition,
// - reversing shortening factor is the absolute value, clamped to the range [0, 1], of the sum of:
// 1. the output of the timing function of the old transition at the time of the style change event, times the reversing shortening factor of the old transition
// 2. 1 minus the reversing shortening factor of the old transition.
// - start time is the time of the style change event plus:
// 1. if the matching transition delay is nonnegative, the matching transition delay, or
// 2. if the matching transition delay is negative, the product of the new transitions reversing shortening factor and the matching transition delay,
// - end time is the start time plus the product of the matching transition duration and the new transitions reversing shortening factor,
// - start value is the current value of the property in the running transition,
// - end value is the value of the property in the after-change style
auto& reversingAdjustedStartStyle = previouslyRunningTransition->targetStyle();
double transformedProgress = 1;
if (auto* effect = previouslyRunningTransition->effect()) {
if (auto computedTimingProgress = effect->getComputedTiming().progress)
transformedProgress = *computedTimingProgress;
}
auto reversingShorteningFactor = std::max(std::min(((transformedProgress * previouslyRunningTransition->reversingShorteningFactor()) + (1 - previouslyRunningTransition->reversingShorteningFactor())), 1.0), 0.0);
auto delay = matchingBackingAnimation->delay() < 0 ? Seconds(matchingBackingAnimation->delay()) * reversingShorteningFactor : Seconds(matchingBackingAnimation->delay());
auto duration = Seconds(matchingBackingAnimation->duration()) * reversingShorteningFactor;
styleable.ensureRunningTransitionsByProperty().set(property, CSSTransition::create(styleable, property, generationTime, *matchingBackingAnimation, &previouslyRunningTransitionCurrentStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));
} else {
// 4. Otherwise, implementations must cancel the running transition
previouslyRunningTransition->cancelFromStyle();
// and start a new transition whose:
// - start time is the time of the style change event plus the matching transition delay,
// - end time is the start time plus the matching transition duration,
// - start value is the current value of the property in the running transition,
// - end value is the value of the property in the after-change style,
// - reversing-adjusted start value is the same as the start value, and
// - reversing shortening factor is 1.
auto delay = Seconds(matchingBackingAnimation->delay());
auto duration = Seconds(matchingBackingAnimation->duration());
auto& reversingAdjustedStartStyle = currentStyle;
auto reversingShorteningFactor = 1;
styleable.ensureRunningTransitionsByProperty().set(property, CSSTransition::create(styleable, property, generationTime, *matchingBackingAnimation, &previouslyRunningTransitionCurrentStyle, afterChangeStyle, delay, duration, reversingAdjustedStartStyle, reversingShorteningFactor));
}
}
}
void Styleable::updateCSSTransitions(const RenderStyle& currentStyle, const RenderStyle& newStyle) const
{
// In case this element is newly getting a "display: none" we need to cancel all of its transitions and disregard new ones.
if (currentStyle.hasTransitions() && currentStyle.display() != DisplayType::None && newStyle.display() == DisplayType::None) {
if (hasRunningTransitions()) {
auto runningTransitions = ensureRunningTransitionsByProperty();
for (const auto& cssTransitionsByCSSPropertyIDMapItem : runningTransitions)
cssTransitionsByCSSPropertyIDMapItem.value->cancelFromStyle();
}
return;
}
// Section 3 "Starting of transitions" from the CSS Transitions Level 1 specification.
// https://drafts.csswg.org/css-transitions-1/#starting
auto generationTime = MonotonicTime::now();
// First, let's compile the list of all CSS properties found in the current style and the after-change style.
bool transitionPropertiesContainAll = false;
HashSet<CSSPropertyID> transitionProperties;
compileTransitionPropertiesInStyle(currentStyle, transitionProperties, transitionPropertiesContainAll);
compileTransitionPropertiesInStyle(newStyle, transitionProperties, transitionPropertiesContainAll);
if (transitionPropertiesContainAll) {
auto numberOfProperties = CSSPropertyAnimation::getNumProperties();
for (int propertyIndex = 0; propertyIndex < numberOfProperties; ++propertyIndex) {
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
std::optional<bool> isShorthand;
Move AnimationTimeline methods related to Styleable to Styleable https://bugs.webkit.org/show_bug.cgi?id=224012 Reviewed by Dean Jackson. A number of public methods on AnimationTimeline make no use of any AnimationTimeline instance variables and instead call into Styleable: void elementWasRemoved(const Styleable&); void willChangeRendererForStyleable(const Styleable&); void cancelDeclarativeAnimationsForStyleable(const Styleable&); void animationWasAddedToStyleable(WebAnimation&, const Styleable&); void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&); void removeDeclarativeAnimationFromListsForOwningElement(WebAnimation&, const Styleable&); void updateCSSAnimationsForStyleable(const Styleable&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle, const RenderStyle* parentElementStyle); void updateCSSTransitionsForStyleable(const Styleable&, const RenderStyle& currentStyle, const RenderStyle& newStyle); These really belong on Styleable so we move them all over to that class with a new .cpp class for these non-trivial methods. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::animationWasAddedToStyleable): Deleted. (WebCore::removeCSSTransitionFromMap): Deleted. (WebCore::AnimationTimeline::animationWasRemovedFromStyleable): Deleted. (WebCore::AnimationTimeline::removeDeclarativeAnimationFromListsForOwningElement): Deleted. (WebCore::AnimationTimeline::removeCSSAnimationCreatedByMarkup): Deleted. (WebCore::AnimationTimeline::elementWasRemoved): Deleted. (WebCore::AnimationTimeline::willChangeRendererForStyleable): Deleted. (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable): Deleted. (WebCore::shouldConsiderAnimation): Deleted. (WebCore::AnimationTimeline::updateCSSAnimationsForStyleable): Deleted. (WebCore::keyframeEffectForElementAndProperty): Deleted. (WebCore::propertyInStyleMatchesValueForTransitionInMap): Deleted. (WebCore::transitionCombinedDuration): Deleted. (WebCore::transitionMatchesProperty): Deleted. (WebCore::compileTransitionPropertiesInStyle): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleableAndProperty): Deleted. (WebCore::AnimationTimeline::updateCSSTransitionsForStyleable): Deleted. * animation/AnimationTimeline.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::disassociateFromOwningElement): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::effectTargetDidChange): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * dom/PseudoElement.cpp: (WebCore::PseudoElement::clearHostElement): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): * style/Styleable.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp. (WebCore::Styleable::animationWasAdded const): (WebCore::removeCSSTransitionFromMap): (WebCore::Styleable::removeDeclarativeAnimationFromListsForOwningElement const): (WebCore::Styleable::animationWasRemoved const): (WebCore::removeCSSAnimationCreatedByMarkup): (WebCore::Styleable::elementWasRemoved const): (WebCore::Styleable::willChangeRenderer const): (WebCore::Styleable::cancelDeclarativeAnimations const): (WebCore::shouldConsiderAnimation): (WebCore::Styleable::updateCSSAnimations const): (WebCore::keyframeEffectForElementAndProperty): (WebCore::propertyInStyleMatchesValueForTransitionInMap): (WebCore::transitionCombinedDuration): (WebCore::transitionMatchesProperty): (WebCore::compileTransitionPropertiesInStyle): (WebCore::updateCSSTransitionsForStyleableAndProperty): (WebCore::Styleable::updateCSSTransitions const): * style/Styleable.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275346 268f45cc-cd09-0410-ab3c-d52691b4dbfc Canonical link: https://commits.webkit.org/236017@main
2021-04-01 06:33:21 +00:00
auto property = CSSPropertyAnimation::getPropertyAtIndex(propertyIndex, isShorthand);
if (isShorthand && *isShorthand)
continue;
updateCSSTransitionsForStyleableAndProperty(*this, property, currentStyle, newStyle, generationTime);
}
return;
}
for (auto property : transitionProperties)
updateCSSTransitionsForStyleableAndProperty(*this, property, currentStyle, newStyle, generationTime);
}
} // namespace WebCore