gecko-dev/layout/style/SVGAttrAnimationRuleProcess...

69 строки
2.4 KiB
C
Исходник Обычный вид История

Bug 1057231 patch 1 - Add a rule processor class for rules from SMIL Animation of SVG attributes. r=dholbert This patch series (to move SVG Animation rules to their own level of the cascade) is needed so that they can participate in the mechanism for updating only animation styles to the present time without touching any other styles. In theory, this should have been done as part of 996796 or even as part of prior work on off main thread animations, except that it doesn't seem possible to have SVG Animations and CSS Transitions interacting on the same element and have that element's style out of date, which means it wasn't necessary for the existing code to update only animation styles. However, bug 960465 will use this similar mechanism as the new mechanism for making sure transitions start in a reasonable way (replacing the mechanism of phases, going from style without animation to style with animation via nsPresContext::IsProcessingAnimationStyleChange). This will require that, for SVG Animations to continue interacting correctly with CSS Transitions, that they have their own cascade level so that they can participate in RestyleManager::UpdateOnlyAnimationStyles. Additionally, this is needed even sooner, for bug 977991, which needs (temporarily, until bug 960465 lands) a mechanism for updating the style attribute style *and* all animation-phase-dependent styles. Yes, it's a little bit annoying to have to have another class, and another object per-document for this, but that's currently what comes with being a level of the cascade. But it's one class and one object per document, and I believe there will be substantial benefits to having all rule processor levels be only-animation-related or not-animation-related (except for the style attribute level, which is simple enough that it isn't needed yet).
2014-09-13 17:17:34 +04:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* style rule processor for rules from SMIL Animation of SVG mapped
* attributes (attributes whose values are mapped into style)
*/
#ifndef mozilla_SVGAttrAnimationRuleProcessor_h_
#define mozilla_SVGAttrAnimationRuleProcessor_h_
#include "nsIStyleRuleProcessor.h"
class nsIDocument;
class nsRuleWalker;
Bug 1057231 patch 1 - Add a rule processor class for rules from SMIL Animation of SVG attributes. r=dholbert This patch series (to move SVG Animation rules to their own level of the cascade) is needed so that they can participate in the mechanism for updating only animation styles to the present time without touching any other styles. In theory, this should have been done as part of 996796 or even as part of prior work on off main thread animations, except that it doesn't seem possible to have SVG Animations and CSS Transitions interacting on the same element and have that element's style out of date, which means it wasn't necessary for the existing code to update only animation styles. However, bug 960465 will use this similar mechanism as the new mechanism for making sure transitions start in a reasonable way (replacing the mechanism of phases, going from style without animation to style with animation via nsPresContext::IsProcessingAnimationStyleChange). This will require that, for SVG Animations to continue interacting correctly with CSS Transitions, that they have their own cascade level so that they can participate in RestyleManager::UpdateOnlyAnimationStyles. Additionally, this is needed even sooner, for bug 977991, which needs (temporarily, until bug 960465 lands) a mechanism for updating the style attribute style *and* all animation-phase-dependent styles. Yes, it's a little bit annoying to have to have another class, and another object per-document for this, but that's currently what comes with being a level of the cascade. But it's one class and one object per document, and I believe there will be substantial benefits to having all rule processor levels be only-animation-related or not-animation-related (except for the style attribute level, which is simple enough that it isn't needed yet).
2014-09-13 17:17:34 +04:00
namespace mozilla {
namespace dom {
class Element;
}
Bug 1057231 patch 1 - Add a rule processor class for rules from SMIL Animation of SVG attributes. r=dholbert This patch series (to move SVG Animation rules to their own level of the cascade) is needed so that they can participate in the mechanism for updating only animation styles to the present time without touching any other styles. In theory, this should have been done as part of 996796 or even as part of prior work on off main thread animations, except that it doesn't seem possible to have SVG Animations and CSS Transitions interacting on the same element and have that element's style out of date, which means it wasn't necessary for the existing code to update only animation styles. However, bug 960465 will use this similar mechanism as the new mechanism for making sure transitions start in a reasonable way (replacing the mechanism of phases, going from style without animation to style with animation via nsPresContext::IsProcessingAnimationStyleChange). This will require that, for SVG Animations to continue interacting correctly with CSS Transitions, that they have their own cascade level so that they can participate in RestyleManager::UpdateOnlyAnimationStyles. Additionally, this is needed even sooner, for bug 977991, which needs (temporarily, until bug 960465 lands) a mechanism for updating the style attribute style *and* all animation-phase-dependent styles. Yes, it's a little bit annoying to have to have another class, and another object per-document for this, but that's currently what comes with being a level of the cascade. But it's one class and one object per document, and I believe there will be substantial benefits to having all rule processor levels be only-animation-related or not-animation-related (except for the style attribute level, which is simple enough that it isn't needed yet).
2014-09-13 17:17:34 +04:00
class SVGAttrAnimationRuleProcessor MOZ_FINAL : public nsIStyleRuleProcessor
{
public:
SVGAttrAnimationRuleProcessor();
private:
~SVGAttrAnimationRuleProcessor();
public:
NS_DECL_ISUPPORTS
// nsIStyleRuleProcessor API
virtual void RulesMatching(ElementRuleProcessorData* aData) MOZ_OVERRIDE;
virtual void RulesMatching(PseudoElementRuleProcessorData* aData) MOZ_OVERRIDE;
virtual void RulesMatching(AnonBoxRuleProcessorData* aData) MOZ_OVERRIDE;
#ifdef MOZ_XUL
virtual void RulesMatching(XULTreeRuleProcessorData* aData) MOZ_OVERRIDE;
#endif
virtual nsRestyleHint HasStateDependentStyle(StateRuleProcessorData* aData) MOZ_OVERRIDE;
virtual nsRestyleHint HasStateDependentStyle(PseudoElementStateRuleProcessorData* aData) MOZ_OVERRIDE;
virtual bool HasDocumentStateDependentStyle(StateRuleProcessorData* aData) MOZ_OVERRIDE;
virtual nsRestyleHint
HasAttributeDependentStyle(AttributeRuleProcessorData* aData) MOZ_OVERRIDE;
virtual bool MediumFeaturesChanged(nsPresContext* aPresContext) MOZ_OVERRIDE;
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const MOZ_MUST_OVERRIDE MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
const MOZ_MUST_OVERRIDE MOZ_OVERRIDE;
size_t DOMSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
// A shortcut for nsStyleSet to call RulesMatching with less setup.
void ElementRulesMatching(mozilla::dom::Element* aElement,
nsRuleWalker* aRuleWalker);
Bug 1057231 patch 1 - Add a rule processor class for rules from SMIL Animation of SVG attributes. r=dholbert This patch series (to move SVG Animation rules to their own level of the cascade) is needed so that they can participate in the mechanism for updating only animation styles to the present time without touching any other styles. In theory, this should have been done as part of 996796 or even as part of prior work on off main thread animations, except that it doesn't seem possible to have SVG Animations and CSS Transitions interacting on the same element and have that element's style out of date, which means it wasn't necessary for the existing code to update only animation styles. However, bug 960465 will use this similar mechanism as the new mechanism for making sure transitions start in a reasonable way (replacing the mechanism of phases, going from style without animation to style with animation via nsPresContext::IsProcessingAnimationStyleChange). This will require that, for SVG Animations to continue interacting correctly with CSS Transitions, that they have their own cascade level so that they can participate in RestyleManager::UpdateOnlyAnimationStyles. Additionally, this is needed even sooner, for bug 977991, which needs (temporarily, until bug 960465 lands) a mechanism for updating the style attribute style *and* all animation-phase-dependent styles. Yes, it's a little bit annoying to have to have another class, and another object per-document for this, but that's currently what comes with being a level of the cascade. But it's one class and one object per document, and I believe there will be substantial benefits to having all rule processor levels be only-animation-related or not-animation-related (except for the style attribute level, which is simple enough that it isn't needed yet).
2014-09-13 17:17:34 +04:00
private:
SVGAttrAnimationRuleProcessor(const SVGAttrAnimationRuleProcessor& aCopy) = delete;
SVGAttrAnimationRuleProcessor& operator=(const SVGAttrAnimationRuleProcessor& aCopy) = delete;
Bug 1057231 patch 1 - Add a rule processor class for rules from SMIL Animation of SVG attributes. r=dholbert This patch series (to move SVG Animation rules to their own level of the cascade) is needed so that they can participate in the mechanism for updating only animation styles to the present time without touching any other styles. In theory, this should have been done as part of 996796 or even as part of prior work on off main thread animations, except that it doesn't seem possible to have SVG Animations and CSS Transitions interacting on the same element and have that element's style out of date, which means it wasn't necessary for the existing code to update only animation styles. However, bug 960465 will use this similar mechanism as the new mechanism for making sure transitions start in a reasonable way (replacing the mechanism of phases, going from style without animation to style with animation via nsPresContext::IsProcessingAnimationStyleChange). This will require that, for SVG Animations to continue interacting correctly with CSS Transitions, that they have their own cascade level so that they can participate in RestyleManager::UpdateOnlyAnimationStyles. Additionally, this is needed even sooner, for bug 977991, which needs (temporarily, until bug 960465 lands) a mechanism for updating the style attribute style *and* all animation-phase-dependent styles. Yes, it's a little bit annoying to have to have another class, and another object per-document for this, but that's currently what comes with being a level of the cascade. But it's one class and one object per document, and I believe there will be substantial benefits to having all rule processor levels be only-animation-related or not-animation-related (except for the style attribute level, which is simple enough that it isn't needed yet).
2014-09-13 17:17:34 +04:00
};
} // namespace mozilla
#endif /* !defined(mozilla_SVGAttrAnimationRuleProcessor_h_) */