Bug 1294299 part 2 - Use DeclarationBlock for SMIL override style. r=heycam
MozReview-Commit-ID: 573o5vmC81z
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -52,16 +52,17 @@
#include "nsDOMString.h"
#include "nsIScriptSecurityManager.h"
#include "nsIDOMMutationEvent.h"
#include "mozilla/dom/AnimatableBinding.h"
#include "mozilla/dom/KeyframeAnimationOptionsBinding.h"
#include "mozilla/AnimationComparator.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/ContentEvents.h"
+#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/EffectSet.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/InternalMutationEvent.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/TextEvents.h"
@@ -1962,25 +1963,25 @@ Element::GetSMILOverrideStyle()
if (!slots->mSMILOverrideStyle) {
slots->mSMILOverrideStyle = new nsDOMCSSAttributeDeclaration(this, true);
}
return slots->mSMILOverrideStyle;
}
-css::Declaration*
+DeclarationBlock*
Element::GetSMILOverrideStyleDeclaration()
{
Element::nsDOMSlots *slots = GetExistingDOMSlots();
return slots ? slots->mSMILOverrideStyleDeclaration.get() : nullptr;
}
nsresult
-Element::SetSMILOverrideStyleDeclaration(css::Declaration* aDeclaration,
+Element::SetSMILOverrideStyleDeclaration(DeclarationBlock* aDeclaration,
bool aNotify)
{
Element::nsDOMSlots *slots = DOMSlots();
slots->mSMILOverrideStyleDeclaration = aDeclaration;
if (aNotify) {
nsIDocument* doc = GetComposedDoc();
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -266,25 +266,25 @@ public:
virtual nsresult SetInlineStyleDeclaration(DeclarationBlock* aDeclaration,
const nsAString* aSerialized,
bool aNotify);
/**
* Get the SMIL override style declaration for this element. If the
* rule hasn't been created, this method simply returns null.
*/
- virtual css::Declaration* GetSMILOverrideStyleDeclaration();
+ virtual DeclarationBlock* GetSMILOverrideStyleDeclaration();
/**
* Set the SMIL override style declaration for this element. If
* aNotify is true, this method will notify the document's pres
* context, so that the style changes will be noticed.
*/
- virtual nsresult SetSMILOverrideStyleDeclaration(css::Declaration* aDeclaration,
- bool aNotify);
+ virtual nsresult SetSMILOverrideStyleDeclaration(
+ DeclarationBlock* aDeclaration, bool aNotify);
/**
* Returns a new nsISMILAttr that allows the caller to animate the given
* attribute on this element.
*
* The CALLER OWNS the result and is responsible for deleting it.
*/
virtual nsISMILAttr* GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName)
--- a/dom/base/FragmentOrElement.h
+++ b/dom/base/FragmentOrElement.h
@@ -28,19 +28,17 @@ class nsDOMAttributeMap;
class nsDOMTokenList;
class nsIControllers;
class nsICSSDeclaration;
class nsIDocument;
class nsDOMStringMap;
class nsIURI;
namespace mozilla {
-namespace css {
-class Declaration;
-} // namespace css
+class DeclarationBlock;
namespace dom {
class DOMIntersectionObserver;
class Element;
} // namespace dom
} // namespace mozilla
/**
* A class that implements nsIWeakReference
@@ -279,17 +277,17 @@ public:
* SMIL Overridde style rules (for SMIL animation of CSS properties)
* @see nsIContent::GetSMILOverrideStyle
*/
nsCOMPtr<nsICSSDeclaration> mSMILOverrideStyle;
/**
* Holds any SMIL override style declaration for this element.
*/
- RefPtr<mozilla::css::Declaration> mSMILOverrideStyleDeclaration;
+ RefPtr<mozilla::DeclarationBlock> mSMILOverrideStyleDeclaration;
/**
* An object implementing nsIDOMMozNamedAttrMap for this content (attributes)
* @see FragmentOrElement::GetAttributes
*/
RefPtr<nsDOMAttributeMap> mAttributeMap;
union {
--- a/layout/style/nsDOMCSSAttrDeclaration.cpp
+++ b/layout/style/nsDOMCSSAttrDeclaration.cpp
@@ -68,17 +68,17 @@ NS_IMPL_QUERY_TAIL_INHERITING(nsDOMCSSDe
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSAttributeDeclaration)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSAttributeDeclaration)
nsresult
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
{
NS_ASSERTION(mElement, "Must have Element to set the declaration!");
return mIsSMILOverride
- ? mElement->SetSMILOverrideStyleDeclaration(aDecl->AsGecko(), true)
+ ? mElement->SetSMILOverrideStyleDeclaration(aDecl, true)
: mElement->SetInlineStyleDeclaration(aDecl, nullptr, true);
}
nsIDocument*
nsDOMCSSAttributeDeclaration::DocToUpdate()
{
// We need OwnerDoc() rather than GetUncomposedDoc() because it might
// be the BeginUpdate call that inserts mElement into the document.
--- a/layout/style/nsHTMLCSSStyleSheet.cpp
+++ b/layout/style/nsHTMLCSSStyleSheet.cpp
@@ -61,32 +61,33 @@ nsHTMLCSSStyleSheet::RulesMatching(Eleme
}
void
nsHTMLCSSStyleSheet::ElementRulesMatching(nsPresContext* aPresContext,
Element* aElement,
nsRuleWalker* aRuleWalker)
{
// just get the one and only style rule from the content's STYLE attribute
- if (DeclarationBlock* declaration = aElement->GetInlineStyleDeclaration()) {
+ DeclarationBlock* declaration = aElement->GetInlineStyleDeclaration();
+ if (declaration) {
declaration->SetImmutable();
aRuleWalker->Forward(declaration->AsGecko());
}
- css::Declaration* declaration = aElement->GetSMILOverrideStyleDeclaration();
+ declaration = aElement->GetSMILOverrideStyleDeclaration();
if (declaration) {
MOZ_ASSERT(aPresContext->RestyleManager()->IsGecko(),
"stylo: ElementRulesMatching must not be called when we have "
"a Servo-backed style system");
RestyleManager* restyleManager = aPresContext->RestyleManager()->AsGecko();
if (!restyleManager->SkipAnimationRules()) {
// Animation restyle (or non-restyle traversal of rules)
// Now we can walk SMIL overrride style, without triggering transitions.
declaration->SetImmutable();
- aRuleWalker->Forward(declaration);
+ aRuleWalker->Forward(declaration->AsGecko());
}
}
}
void
nsHTMLCSSStyleSheet::PseudoElementRulesMatching(Element* aPseudoElement,
CSSPseudoElementType
aPseudoType,