From dbd394ae9e012e73b35e2743f48a36a94e9d74ee Mon Sep 17 00:00:00 2001 From: Andreea Pavel Date: Tue, 27 Nov 2018 15:33:29 +0200 Subject: [PATCH] Backed out 2 changesets (bug 1504065) for failing Win reftest at child-in-animating-element-display-none.html on a CLOSED TREE Backed out changeset 129188370231 (bug 1504065) Backed out changeset 359e81b35cfb (bug 1504065) --- dom/animation/KeyframeEffect.cpp | 17 --- .../chrome/test_running_on_compositor.html | 40 +----- dom/animation/test/mochitest.ini | 1 - dom/base/nsDOMWindowUtils.cpp | 8 -- gfx/layers/AnimationHelper.cpp | 30 +---- gfx/layers/AnimationHelper.h | 13 -- .../composite/AsyncCompositionManager.cpp | 36 ++---- gfx/layers/ipc/LayersMessages.ipdlh | 3 - layout/painting/nsDisplayList.cpp | 39 +----- layout/painting/nsDisplayList.h | 2 - layout/style/LayerAnimationInfo.cpp | 3 - layout/style/LayerAnimationInfo.h | 6 - layout/style/ServoBindings.h | 5 - layout/style/StyleAnimationValue.cpp | 7 -- layout/style/StyleAnimationValue.h | 4 - layout/style/nsComputedDOMStyle.cpp | 2 +- layout/style/nsComputedDOMStyle.h | 2 +- layout/style/test/animation_utils.js | 29 ++--- layout/style/test/mochitest.ini | 1 - layout/style/test/test_animations_omta.html | 117 ------------------ modules/libpref/init/StaticPrefList.h | 12 -- .../properties/longhands/background.mako.rs | 3 +- servo/ports/geckolib/glue.rs | 45 ------- 23 files changed, 28 insertions(+), 397 deletions(-) diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index 472a1006d62e..bf758bab3f8f 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -1894,23 +1894,6 @@ KeyframeEffect::IsMatchForCompositor( return KeyframeEffect::MatchForCompositor::NoAndBlockThisProperty; } - if (aProperty == eCSSProperty_background_color) { - if (!StaticPrefs::gfx_omta_background_color()) { - return KeyframeEffect::MatchForCompositor::No; - } - - if (nsIContent* content = aFrame->GetContent()) { - RefPtr layerManager = - nsContentUtils::LayerManagerForContent(content); - if (layerManager && - layerManager->GetBackendType() == layers::LayersBackend::LAYERS_WR) { - // Bug 1510030: We don't yet support background-color animations on the - // compositor for WebRender. - return KeyframeEffect::MatchForCompositor::No; - } - } - } - return mAnimation->IsPlaying() ? KeyframeEffect::MatchForCompositor::Yes : KeyframeEffect::MatchForCompositor::IfNeeded; diff --git a/dom/animation/test/chrome/test_running_on_compositor.html b/dom/animation/test/chrome/test_running_on_compositor.html index 7bc948ef687f..a0a67ca0955a 100644 --- a/dom/animation/test/chrome/test_running_on_compositor.html +++ b/dom/animation/test/chrome/test_running_on_compositor.html @@ -50,9 +50,7 @@ div { /** Test for bug 1045994 - Add a chrome-only property to inspect if an animation is running on the compositor or not **/ -const omtaEnabled = isOMTAEnabled(); -const isWebRender = - SpecialPowers.DOMWindowUtils.layerManagerType == 'WebRender'; +var omtaEnabled = isOMTAEnabled(); function assert_animation_is_running_on_compositor(animation, desc) { assert_equals(animation.isRunningOnCompositor, omtaEnabled, @@ -990,41 +988,5 @@ promise_test(async t => { 'Transform animation on table element should be running on the compositor'); }, 'Transform animation on table element runs on the compositor'); -promise_test(async t => { - const div = addDiv(t); - const animation = div.animate({ backgroundColor: ['blue', 'green'] }, - 100 * MS_PER_SEC); - - await waitForAnimationReadyToRestyle(animation); - await waitForPaints(); - - if (!isWebRender) { - assert_animation_is_running_on_compositor(animation, - 'background-color animation should be running on the compositor'); - } else { - assert_animation_is_not_running_on_compositor(animation, - 'background-color animation is not yet able to run on the compositor ' + - 'on WebRender'); - } -}, 'backgound-color animation runs on the compositor'); - -promise_test(async t => { - await SpecialPowers.pushPrefEnv({ - set: [["gfx.omta.background-color", false]] - }); - - const div = addDiv(t); - const animation = div.animate({ backgroundColor: ['blue', 'green'] }, - 100 * MS_PER_SEC); - - await waitForAnimationReadyToRestyle(animation); - await waitForPaints(); - - assert_animation_is_not_running_on_compositor(animation, - 'background-color animation should NOT be running on the compositor ' + - 'if the pref is disabled'); -}, 'backgound-color animation does not run on the compositor if the pref ' + - 'is disabled'); - diff --git a/dom/animation/test/mochitest.ini b/dom/animation/test/mochitest.ini index abde89be5c24..7a40e2463958 100644 --- a/dom/animation/test/mochitest.ini +++ b/dom/animation/test/mochitest.ini @@ -5,7 +5,6 @@ prefs = dom.animations-api.getAnimations.enabled=true dom.animations-api.implicit-keyframes.enabled=true dom.animations-api.timelines.enabled=true - gfx.omta.background-color=true layout.css.motion-path.enabled=true layout.css.individual-transform.enabled=true # Support files for chrome tests that we want to load over HTTP need diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 887489762717..cd7fe5e04d67 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -3720,14 +3720,6 @@ nsDOMWindowUtils::GetOMTAStyle(Element* aElement, if (value.type() == OMTAValue::TMatrix4x4) { cssValue = nsComputedDOMStyle::MatrixToCSSValue(value.get_Matrix4x4()); } - } else if (aProperty.EqualsLiteral("background-color")) { - OMTAValue value = GetOMTAValue(frame, - DisplayItemType::TYPE_BACKGROUND_COLOR, - GetWebRenderBridge()); - if (value.type() == OMTAValue::Tnscolor) { - cssValue = new nsROCSSPrimitiveValue; - nsComputedDOMStyle::SetToRGBAColor(cssValue, value.get_nscolor()); - } } } diff --git a/gfx/layers/AnimationHelper.cpp b/gfx/layers/AnimationHelper.cpp index 9eeedc29eab3..ab189b7e1640 100644 --- a/gfx/layers/AnimationHelper.cpp +++ b/gfx/layers/AnimationHelper.cpp @@ -55,9 +55,6 @@ CompositorAnimationStorage::GetOMTAValue(const uint64_t& aId) const } switch (animatedValue->mType) { - case AnimatedValue::COLOR: - omtaValue = animatedValue->mColor; - break; case AnimatedValue::OPACITY: omtaValue = animatedValue->mOpacity; break; @@ -121,18 +118,6 @@ CompositorAnimationStorage::SetAnimatedValue(uint64_t aId, dontCare); } -void -CompositorAnimationStorage::SetAnimatedValue(uint64_t aId, nscolor aColor) -{ - MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread()); - auto count = mAnimatedValues.Count(); - AnimatedValue* value = mAnimatedValues.LookupOrAdd(aId, aColor); - if (count == mAnimatedValues.Count()) { - MOZ_ASSERT(value->mType == AnimatedValue::COLOR); - value->mColor = aColor; - } -} - void CompositorAnimationStorage::SetAnimatedValue(uint64_t aId, const float& aOpacity) @@ -534,7 +519,7 @@ CreateCSSValueList(const InfallibleTArray& aFunctions) } static already_AddRefed -ToAnimationValue(nsCSSPropertyID aProperty, const Animatable& aAnimatable) +ToAnimationValue(const Animatable& aAnimatable) { RefPtr result; @@ -555,10 +540,6 @@ ToAnimationValue(nsCSSPropertyID aProperty, const Animatable& aAnimatable) case Animatable::Tfloat: result = Servo_AnimationValue_Opacity(aAnimatable.get_float()).Consume(); break; - case Animatable::Tnscolor: - result = Servo_AnimationValue_Color(aProperty, - aAnimatable.get_nscolor()).Consume(); - break; default: MOZ_ASSERT_UNREACHABLE("Unsupported type"); } @@ -599,8 +580,7 @@ AnimationHelper::SetAnimations( } if (animation.baseStyle().type() != Animatable::Tnull_t) { - aBaseAnimationStyle = ToAnimationValue(animation.property(), - animation.baseStyle()); + aBaseAnimationStyle = ToAnimationValue(animation.baseStyle()); } AnimData* data = aAnimData.AppendElement(); @@ -625,10 +605,8 @@ AnimationHelper::SetAnimations( const InfallibleTArray& segments = animation.segments(); for (const AnimationSegment& segment : segments) { - startValues.AppendElement(ToAnimationValue(animation.property(), - segment.startState())); - endValues.AppendElement(ToAnimationValue(animation.property(), - segment.endState())); + startValues.AppendElement(ToAnimationValue(segment.startState())); + endValues.AppendElement(ToAnimationValue(segment.endState())); TimingFunction tf = segment.sampleFn(); Maybe ctf = diff --git a/gfx/layers/AnimationHelper.h b/gfx/layers/AnimationHelper.h index 5da73932a072..8e557c29fdfd 100644 --- a/gfx/layers/AnimationHelper.h +++ b/gfx/layers/AnimationHelper.h @@ -55,14 +55,12 @@ struct AnimatedValue { enum { TRANSFORM, OPACITY, - COLOR, NONE } mType {NONE}; union { AnimationTransform mTransform; float mOpacity; - nscolor mColor; }; AnimatedValue(gfx::Matrix4x4&& aTransformInDevSpace, @@ -82,12 +80,6 @@ struct AnimatedValue { { } - explicit AnimatedValue(nscolor aValue) - : mType(AnimatedValue::COLOR) - , mColor(aValue) - { - } - ~AnimatedValue() {} private: @@ -136,11 +128,6 @@ public: */ void SetAnimatedValue(uint64_t aId, const float& aOpacity); - /** - * Set the animation color based on the unique id - */ - void SetAnimatedValue(uint64_t aId, nscolor aColor); - /** * Return the animated value if a given id can map to its animated value */ diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 754a84cfb877..60c89dc1945d 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -633,19 +633,6 @@ ApplyAnimatedValue(Layer* aLayer, HostLayer* layerCompositor = aLayer->AsHostLayer(); switch (aProperty) { - case eCSSProperty_background_color: { - // We don't support 'color' animations on the compositor yet so we never - // meet currentColor on the compositor. - nscolor color = Servo_AnimationValue_GetColor(aValue, NS_RGBA(0, 0, 0, 0)); - aLayer->AsColorLayer()->SetColor(gfx::Color::FromABGR(color)); - aStorage->SetAnimatedValue(aLayer->GetCompositorAnimationsId(), color); - - layerCompositor->SetShadowOpacity(aLayer->GetOpacity()); - layerCompositor->SetShadowOpacitySetByAnimation(false); - layerCompositor->SetShadowBaseTransform(aLayer->GetBaseTransform()); - layerCompositor->SetShadowTransformSetByAnimation(false); - break; - } case eCSSProperty_opacity: { float opacity = Servo_AnimationValue_GetOpacity(aValue); layerCompositor->SetShadowOpacity(opacity); @@ -722,22 +709,19 @@ SampleAnimations(Layer* aLayer, } case AnimationHelper::SampleResult::Skipped: switch (animations[0].property()) { - case eCSSProperty_background_color: case eCSSProperty_opacity: { - if (animations[0].property() == eCSSProperty_opacity) { - MOZ_ASSERT( - layer->AsHostLayer()->GetShadowOpacitySetByAnimation()); + MOZ_ASSERT( + layer->AsHostLayer()->GetShadowOpacitySetByAnimation()); #ifdef DEBUG - // Disable this assertion until the root cause is fixed in bug - // 1459775. - // MOZ_ASSERT(FuzzyEqualsMultiplicative( - // Servo_AnimationValue_GetOpacity(animationValue), - // *(aStorage->GetAnimationOpacity(layer->GetCompositorAnimationsId())))); + // Disable this assertion until the root cause is fixed in bug + // 1459775. + // MOZ_ASSERT(FuzzyEqualsMultiplicative( + // Servo_AnimationValue_GetOpacity(animationValue), + // *(aStorage->GetAnimationOpacity(layer->GetCompositorAnimationsId())))); #endif - } - // Even if opacity or background-color animation value has - // unchanged, we have to set the shadow base transform value - // here since the value might have been changed by APZC. + // Even if opacity animation value has unchanged, we have to set + // the shadow base transform value here since the value might + // have been changed by APZC. HostLayer* layerCompositor = layer->AsHostLayer(); layerCompositor->SetShadowBaseTransform( layer->GetBaseTransform()); diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh index ac26b386cb15..abb2ff6f251d 100644 --- a/gfx/layers/ipc/LayersMessages.ipdlh +++ b/gfx/layers/ipc/LayersMessages.ipdlh @@ -19,7 +19,6 @@ using struct mozilla::gfx::Color from "mozilla/gfx/2D.h"; using struct mozilla::gfx::Point3D from "mozilla/gfx/Point.h"; using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h"; using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h"; -using nscolor from "nsColor.h"; using nscoord from "nsCoord.h"; using struct nsRect from "nsRect.h"; using struct nsPoint from "nsPoint.h"; @@ -161,7 +160,6 @@ union MaybeTimeDuration { union Animatable { null_t; float; - nscolor; TransformFunction[]; }; @@ -567,7 +565,6 @@ union MaybeTransform { union OMTAValue { null_t; - nscolor; float; Matrix4x4; }; diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index abb647847b3a..058e0d57ef8c 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -438,23 +438,6 @@ SetAnimatable(nsCSSPropertyID aProperty, } switch (aProperty) { - case eCSSProperty_background_color: { - // We don't support color animation on the compositor yet so that we can - // resolve currentColor at this moment. - nscolor foreground; - if (aFrame->Style()->RelevantLinkVisited()) { - if (ComputedStyle* styleIfVisited = - aFrame->Style()->GetStyleIfVisited()) { - foreground = styleIfVisited->StyleColor()->mColor; - } else { - foreground = aFrame->Style()->StyleColor()->mColor; - } - } else { - foreground = aFrame->Style()->StyleColor()->mColor; - } - aAnimatable = aAnimationValue.GetColor(foreground); - break; - } case eCSSProperty_opacity: aAnimatable = aAnimationValue.GetOpacity(); break; @@ -690,7 +673,7 @@ AddAnimationsForProperty(nsIFrame* aFrame, scaleX, scaleY, hasPerspectiveParent); - } else { + } else if (aProperty == eCSSProperty_opacity) { data = null_t(); } @@ -3546,7 +3529,6 @@ nsDisplaySolidColor::GetLayerState(nsDisplayListBuilder* aBuilder, if (ForceActiveLayers()) { return LAYER_ACTIVE; } - return LAYER_NONE; } @@ -5040,12 +5022,6 @@ nsDisplayBackgroundColor::GetLayerState( if (ForceActiveLayers() && clip != StyleGeometryBox::Text) { return LAYER_ACTIVE; } - - if (EffectCompositor::HasAnimationsForCompositor( - mFrame, eCSSProperty_background_color)) { - return LAYER_ACTIVE_FORCE; - } - return LAYER_NONE; } @@ -5073,11 +5049,6 @@ nsDisplayBackgroundColor::BuildLayer( layer->SetBaseTransform(gfx::Matrix4x4::Translation( aContainerParameters.mOffset.x, aContainerParameters.mOffset.y, 0)); - nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer( - layer, aBuilder, - this, mFrame, - eCSSProperty_background_color); - return layer.forget(); } @@ -8600,14 +8571,6 @@ nsDisplayTransform::CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) return mAllowAsyncAnimation; } -bool -nsDisplayBackgroundColor::CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) -{ - LayerManager* layerManager = aBuilder->GetWidgetLayerManager(); - return layerManager && - layerManager->GetBackendType() != layers::LayersBackend::LAYERS_WR; -} - /* static */ auto nsDisplayTransform::ShouldPrerenderTransformedContent( nsDisplayListBuilder* aBuilder, diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index d47c52c518bf..d4708c479311 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -5074,8 +5074,6 @@ public: void WriteDebugInfo(std::stringstream& aStream) override; - bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) override; - protected: const nsRect mBackgroundRect; RefPtr mBackgroundStyle; diff --git a/layout/style/LayerAnimationInfo.cpp b/layout/style/LayerAnimationInfo.cpp index e3b958f61b8c..f0ebbecf2dd9 100644 --- a/layout/style/LayerAnimationInfo.cpp +++ b/layout/style/LayerAnimationInfo.cpp @@ -14,7 +14,6 @@ namespace mozilla { /* static */ const Array LayerAnimationInfo::sDisplayItemTypes = { - DisplayItemType::TYPE_BACKGROUND_COLOR, DisplayItemType::TYPE_OPACITY, DisplayItemType::TYPE_TRANSFORM, }; @@ -23,8 +22,6 @@ namespace mozilla { LayerAnimationInfo::GetDisplayItemTypeForProperty(nsCSSPropertyID aProperty) { switch (aProperty) { - case eCSSProperty_background_color: - return DisplayItemType::TYPE_BACKGROUND_COLOR; case eCSSProperty_opacity: return DisplayItemType::TYPE_OPACITY; case eCSSProperty_transform: diff --git a/layout/style/LayerAnimationInfo.h b/layout/style/LayerAnimationInfo.h index 7163e4d9d71d..adc34b86851c 100644 --- a/layout/style/LayerAnimationInfo.h +++ b/layout/style/LayerAnimationInfo.h @@ -34,13 +34,9 @@ struct LayerAnimationInfo { nsCSSPropertyIDSet{ eCSSProperty_transform }; static const nsCSSPropertyIDSet opacityProperties = nsCSSPropertyIDSet{ eCSSProperty_opacity }; - static const nsCSSPropertyIDSet backgroundColorProperties = - nsCSSPropertyIDSet{ eCSSProperty_background_color }; static const nsCSSPropertyIDSet empty = nsCSSPropertyIDSet(); switch (aDisplayItemType) { - case DisplayItemType::TYPE_BACKGROUND_COLOR: - return backgroundColorProperties; case DisplayItemType::TYPE_OPACITY: return opacityProperties; case DisplayItemType::TYPE_TRANSFORM: @@ -62,8 +58,6 @@ struct LayerAnimationInfo { GetChangeHintFor(DisplayItemType aDisplayItemType) { switch (aDisplayItemType) { - case DisplayItemType::TYPE_BACKGROUND_COLOR: - return nsChangeHint_RepaintFrame; case DisplayItemType::TYPE_OPACITY: return nsChangeHint_UpdateOpacityLayer; case DisplayItemType::TYPE_TRANSFORM: diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 9b1a1373aef0..31be74f3d862 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -676,11 +676,6 @@ void Servo_AnimationValue_Serialize( nsCSSPropertyID property, nsAString* buffer); -nscolor Servo_AnimationValue_GetColor(RawServoAnimationValueBorrowed value, - nscolor foregroundColor); -RawServoAnimationValueStrong Servo_AnimationValue_Color(nsCSSPropertyID, - nscolor); - float Servo_AnimationValue_GetOpacity(RawServoAnimationValueBorrowed value); RawServoAnimationValueStrong Servo_AnimationValue_Opacity(float); diff --git a/layout/style/StyleAnimationValue.cpp b/layout/style/StyleAnimationValue.cpp index 7a875dd02fdf..4f43e4de0686 100644 --- a/layout/style/StyleAnimationValue.cpp +++ b/layout/style/StyleAnimationValue.cpp @@ -120,13 +120,6 @@ AnimationValue::GetOpacity() const return Servo_AnimationValue_GetOpacity(mServo); } -nscolor -AnimationValue::GetColor(nscolor aForegroundColor) const -{ - MOZ_ASSERT(mServo); - return Servo_AnimationValue_GetColor(mServo, aForegroundColor); -} - already_AddRefed AnimationValue::GetTransformList() const { diff --git a/layout/style/StyleAnimationValue.h b/layout/style/StyleAnimationValue.h index 4e6dd8d2fd79..53fb7ab30a87 100644 --- a/layout/style/StyleAnimationValue.h +++ b/layout/style/StyleAnimationValue.h @@ -78,10 +78,6 @@ struct AnimationValue float GetOpacity() const; - // Returns nscolor value in this AnimationValue. - // Currently only background-color is supported. - nscolor GetColor(nscolor aForegroundColor) const; - // Return the transform list as a RefPtr. already_AddRefed GetTransformList() const; diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 870bad330195..4d494f5a0f1d 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -1117,7 +1117,7 @@ nsComputedDOMStyle::DoGetBottom() return GetOffsetWidthFor(eSideBottom); } -/* static */ void +void nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor) { diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 341621eb8db3..3c1358ade79e 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -131,7 +131,6 @@ public: static already_AddRefed MatrixToCSSValue(const mozilla::gfx::Matrix4x4& aMatrix); - static void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor); static void RegisterPrefChangeCallbacks(); static void UnregisterPrefChangeCallbacks(); @@ -429,6 +428,7 @@ private: already_AddRefed DummyGetter(); /* Helper functions */ + void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor); void SetValueFromComplexColor(nsROCSSPrimitiveValue* aValue, const mozilla::StyleComplexColor& aColor); void SetValueToPositionCoord(const mozilla::Position::Coord& aCoord, diff --git a/layout/style/test/animation_utils.js b/layout/style/test/animation_utils.js index c57d2f3cc505..63d6d7578cfb 100644 --- a/layout/style/test/animation_utils.js +++ b/layout/style/test/animation_utils.js @@ -422,30 +422,19 @@ const ExpectComparisonTo = { runningOn, desc, expectedComparisonResult, pseudo) { // Check input - // FIXME: Auto generate this array. - const omtaProperties = [ "transform", "opacity", "background-color" ]; + const omtaProperties = [ "transform", "opacity" ]; if (!omtaProperties.includes(property)) { ok(false, property + " is not an OMTA property"); return; } - var normalize; - var compare; - var normalizedToString = JSON.stringify; - switch (property) { - case "transform": - normalize = convertTo3dMatrix; - compare = matricesRoughlyEqual; - normalizedToString = convert3dMatrixToString; - break; - case "opacity": - normalize = parseFloat; - compare = function(a, b, error) { return Math.abs(a - b) <= error; }; - break; - default: - normalize = function(value) { return value; }; - compare = function(a, b, error) { return a == b; }; - break; - } + var isTransform = property == "transform"; + var normalize = isTransform ? convertTo3dMatrix : parseFloat; + var compare = isTransform ? + matricesRoughlyEqual : + function(a, b, error) { return Math.abs(a - b) <= error; }; + var normalizedToString = isTransform ? + convert3dMatrixToString : + JSON.stringify; // Get actual values var compositorStr = diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini index 9fd849e7dde5..33833fdcfe27 100644 --- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -5,7 +5,6 @@ prefs = dom.animations-api.getAnimations.enabled=true dom.animations-api.implicit-keyframes.enabled=true dom.animations-api.timelines.enabled=true - gfx.omta.background-color=true layout.css.step-position-jump.enabled=true support-files = animation_utils.js diff --git a/layout/style/test/test_animations_omta.html b/layout/style/test/test_animations_omta.html index 2e2a221595cc..da5e774029cf 100644 --- a/layout/style/test/test_animations_omta.html +++ b/layout/style/test/test_animations_omta.html @@ -2391,122 +2391,5 @@ addAsyncAnimTest(async function() { done_div(); }); -if (SpecialPowers.DOMWindowUtils.layerManagerType != 'WebRender') { - // Normal background-color animation. - addAsyncAnimTest(async function() { - new_div("background-color: rgb(255, 0, 0); " + - "transition: background-color 10s linear"); - await waitForPaintsFlushed(); - - gDiv.style.backgroundColor = "rgb(0, 255, 0)"; - await waitForPaintsFlushed(); - - omta_is("background-color", "rgb(255, 0, 0)", RunningOn.Compositor, - "background-color transition runs on compositor thread"); - - advance_clock(5000); - omta_is("background-color", "rgb(128, 128, 0)", RunningOn.Compositor, - "background-color on compositor at 5s"); - - done_div(); - }); - - // background-color animation with currentColor. - addAsyncAnimTest(async function() { - new_div("color: rgb(255, 0, 0); " + - "background-color: currentColor; " + - "transition: background-color 10s linear"); - await waitForPaintsFlushed(); - - gDiv.style.backgroundColor = "rgb(0, 255, 0)"; - await waitForPaintsFlushed(); - - omta_is("background-color", "rgb(255, 0, 0)", RunningOn.Compositor, - "background-color transition starting with current-color runs on " + - "compositor thread"); - - advance_clock(5000); - omta_is("background-color", "rgb(128, 128, 0)", RunningOn.Compositor, - "background-color on compositor at 5s"); - - done_div(); - }); - - // Tests that a background-color animation from inherited currentColor to - // a normal color on the compositor is updated when the parent color is - // changed. - addAsyncAnimTest(async function() { - new_div(""); - const parent = document.createElement("div"); - gDiv.parentNode.insertBefore(parent, gDiv); - parent.style.color = "rgb(255, 0, 0)"; - parent.appendChild(gDiv); - - gDiv.animate({ backgroundColor: [ "currentColor", "rgb(0, 255, 0)" ] }, 1000); - - await waitForPaintsFlushed(); - - omta_is("background-color", "rgb(255, 0, 0)", RunningOn.Compositor, - "background-color animation starting with current-color runs on " + - "compositor thread"); - - advance_clock(500); - - omta_is("background-color", "rgb(128, 128, 0)", RunningOn.Compositor, - "background-color on compositor at 5s"); - - // Change the parent's color in the middle of the animation. - parent.style.color = "rgb(0, 0, 255)"; - await waitForPaintsFlushed(); - - omta_is("background-color", "rgb(0, 128, 128)", RunningOn.Compositor, - "background-color on compositor is reflected by the parent's " + - "color change"); - - done_div(); - parent.remove(); - }); - - // Tests that a background-color animation from currentColor to a normal color - // on element is updated when the link is visited. - addAsyncAnimTest(async function() { - [ gDiv ] = new_element("a", "display: block"); - gDiv.setAttribute("href", "not-exist.html"); - gDiv.classList.add("visited"); - - const extraStyle = document.createElement('style'); - document.head.appendChild(extraStyle); - extraStyle.sheet.insertRule(".visited:visited { color: rgb(0, 0, 255); }", 0); - extraStyle.sheet.insertRule(".visited:link { color: rgb(255, 0, 0); }", 1); - - gDiv.animate({ backgroundColor: [ "currentColor", "rgb(0, 255, 0)" ] }, 1000); - await waitForPaintsFlushed(); - - omta_is("background-color", "rgb(255, 0, 0)", RunningOn.Compositor, - "background-color animation starting with current-color runs on " + - "compositor thread"); - - advance_clock(500); - - omta_is("background-color", "rgb(128, 128, 0)", RunningOn.Compositor, - "background-color on compositor at 5s"); - - gDiv.setAttribute("href", window.top.location.href); - await waitForVisitedLinkColoring(gDiv, "color", "rgb(0, 0, 255)"); - await waitForPaintsFlushed(); - - // `omta_is` checks that the result on the compositor equals to the value by - // getComputedValue() but getComputedValue lies for visited link values so - // we use getOMTAStyle directly instead. - is(SpecialPowers.DOMWindowUtils.getOMTAStyle(gDiv, "background-color"), - "rgb(0, 128, 128)", - "background-color on element after the link is visited"); - - extraStyle.remove(); - done_element(); - gDiv = null; - }); -} - diff --git a/modules/libpref/init/StaticPrefList.h b/modules/libpref/init/StaticPrefList.h index 8c0db394779d..97ed961f68c6 100644 --- a/modules/libpref/init/StaticPrefList.h +++ b/modules/libpref/init/StaticPrefList.h @@ -494,18 +494,6 @@ VARCACHE_PREF( RelaxedAtomicBool, false ) -#ifdef RELEASE_OR_BETA -# define PREF_VALUE false -#else -# define PREF_VALUE true -#endif -VARCACHE_PREF( - "gfx.omta.background-color", - gfx_omta_background_color, - bool, PREF_VALUE -) -#undef PREF_VALUE - //--------------------------------------------------------------------------- // HTML5 parser prefs //--------------------------------------------------------------------------- diff --git a/servo/components/style/properties/longhands/background.mako.rs b/servo/components/style/properties/longhands/background.mako.rs index 3cba4cc9a28a..65df61a2e711 100644 --- a/servo/components/style/properties/longhands/background.mako.rs +++ b/servo/components/style/properties/longhands/background.mako.rs @@ -15,8 +15,7 @@ ${helpers.predefined_type( animation_value_type="AnimatedColor", ignored_when_colors_disabled=True, allow_quirks=True, - flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER \ - CAN_ANIMATE_ON_COMPOSITOR", + flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER", )} ${helpers.predefined_type( diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs index a551892bf3fd..ba0da71729dd 100644 --- a/servo/ports/geckolib/glue.rs +++ b/servo/ports/geckolib/glue.rs @@ -797,27 +797,6 @@ pub extern "C" fn Servo_AnimationValue_Serialize( debug_assert!(rv.is_ok()); } -#[no_mangle] -pub extern "C" fn Servo_AnimationValue_GetColor( - value: RawServoAnimationValueBorrowed, - foreground_color: structs::nscolor, -) -> structs::nscolor { - use style::gecko::values::convert_nscolor_to_rgba; - use style::gecko::values::convert_rgba_to_nscolor; - use style::values::animated::ToAnimatedValue; - use style::values::computed::color::Color as ComputedColor; - - let value = AnimationValue::as_arc(&value); - match **value { - AnimationValue::BackgroundColor(color) => { - let computed: ComputedColor = ToAnimatedValue::from_animated_value(color); - let foreground_color = convert_nscolor_to_rgba(foreground_color); - convert_rgba_to_nscolor(&computed.to_rgba(foreground_color)) - } - _ => panic!("Other color properties are not supported yet"), - } -} - #[no_mangle] pub extern "C" fn Servo_AnimationValue_GetOpacity(value: RawServoAnimationValueBorrowed) -> f32 { let value = AnimationValue::as_arc(&value); @@ -833,30 +812,6 @@ pub extern "C" fn Servo_AnimationValue_Opacity(opacity: f32) -> RawServoAnimatio Arc::new(AnimationValue::Opacity(opacity)).into_strong() } -#[no_mangle] -pub extern "C" fn Servo_AnimationValue_Color( - color_property: nsCSSPropertyID, - color: structs::nscolor -) -> RawServoAnimationValueStrong { - use style::gecko::values::convert_nscolor_to_rgba; - use style::values::animated::color::RGBA as AnimatedRGBA; - - let property = LonghandId::from_nscsspropertyid(color_property) - .expect("We don't have shorthand property animation value"); - - let rgba = convert_nscolor_to_rgba(color); - - let animatedRGBA = AnimatedRGBA::new(rgba.red_f32(), - rgba.green_f32(), - rgba.blue_f32(), - rgba.alpha_f32()); - match property { - LonghandId::BackgroundColor => - Arc::new(AnimationValue::BackgroundColor(animatedRGBA.into())).into_strong(), - _ => panic!("Should be background-color property"), - } -} - #[no_mangle] pub extern "C" fn Servo_AnimationValue_GetTransform( value: RawServoAnimationValueBorrowed,