Issue #2488 - Part 2: Remove the DeclarationBlock class and use Declaration directly

This commit is contained in:
FranklinDM 2024-03-28 19:04:36 +08:00 committed by roytam1
commit 4d7bdedade
27 changed files with 210 additions and 356 deletions

View file

@ -56,7 +56,6 @@
#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"
@ -108,6 +107,7 @@
#include "nsViewManager.h"
#include "nsIScrollableFrame.h"
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
#include "mozilla/css/Declaration.h"
#include "nsCSSRuleProcessor.h"
#include "nsRuleProcessorData.h"
#include "nsTextNode.h"
@ -2024,7 +2024,7 @@ Element::GetSMILOverrideStyle()
return slots->mSMILOverrideStyle;
}
DeclarationBlock*
css::Declaration*
Element::GetSMILOverrideStyleDeclaration()
{
Element::nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
@ -2032,7 +2032,7 @@ Element::GetSMILOverrideStyleDeclaration()
}
nsresult
Element::SetSMILOverrideStyleDeclaration(DeclarationBlock* aDeclaration,
Element::SetSMILOverrideStyleDeclaration(css::Declaration* aDeclaration,
bool aNotify)
{
Element::nsExtendedDOMSlots* slots = ExtendedDOMSlots();
@ -2072,14 +2072,14 @@ Element::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
return false;
}
DeclarationBlock*
css::Declaration*
Element::GetInlineStyleDeclaration()
{
return nullptr;
}
nsresult
Element::SetInlineStyleDeclaration(DeclarationBlock* aDeclaration,
Element::SetInlineStyleDeclaration(css::Declaration* aDeclaration,
const nsAString* aSerialized,
bool aNotify)
{

View file

@ -57,7 +57,9 @@ class nsDocument;
class nsDOMStringMap;
namespace mozilla {
class DeclarationBlock;
namespace css {
class Declaration;
} // namespace css
namespace dom {
struct AnimationFilter;
struct ScrollIntoViewOptions;
@ -274,13 +276,13 @@ public:
/**
* Get the inline style declaration, if any, for this element.
*/
virtual DeclarationBlock* GetInlineStyleDeclaration();
virtual css::Declaration* GetInlineStyleDeclaration();
/**
* Set the inline style declaration for this element. This will send
* an appropriate AttributeChanged notification if aNotify is true.
*/
virtual nsresult SetInlineStyleDeclaration(DeclarationBlock* aDeclaration,
virtual nsresult SetInlineStyleDeclaration(css::Declaration* aDeclaration,
const nsAString* aSerialized,
bool aNotify);
@ -288,7 +290,7 @@ public:
* Get the SMIL override style declaration for this element. If the
* rule hasn't been created, this method simply returns null.
*/
virtual DeclarationBlock* GetSMILOverrideStyleDeclaration();
virtual css::Declaration* GetSMILOverrideStyleDeclaration();
/**
* Set the SMIL override style declaration for this element. If
@ -296,7 +298,7 @@ public:
* context, so that the style changes will be noticed.
*/
virtual nsresult SetSMILOverrideStyleDeclaration(
DeclarationBlock* aDeclaration, bool aNotify);
css::Declaration* aDeclaration, bool aNotify);
/**
* Returns a new nsISMILAttr that allows the caller to animate the given

View file

@ -17,7 +17,6 @@
#include "mozilla/dom/FragmentOrElement.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/EffectSet.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
@ -99,6 +98,7 @@
#include "nsIScrollableFrame.h"
#include "ChildIterator.h"
#include "mozilla/css/StyleRule.h" /* For nsCSSSelectorList */
#include "mozilla/css/Declaration.h"
#include "nsRuleProcessorData.h"
#include "nsTextNode.h"
#include "mozilla/dom/NodeListBinding.h"

View file

@ -35,7 +35,9 @@ class nsDOMStringMap;
class nsIURI;
namespace mozilla {
class DeclarationBlock;
namespace css {
class Declaration;
}
namespace dom {
struct CustomElementData;
class DOMIntersectionObserver;
@ -265,7 +267,7 @@ public:
/**
* Holds any SMIL override style declaration for this element.
*/
RefPtr<mozilla::DeclarationBlock> mSMILOverrideStyleDeclaration;
RefPtr<mozilla::css::Declaration> mSMILOverrideStyleDeclaration;
/**
* The nearest enclosing content node with a binding that created us.

View file

@ -16,7 +16,7 @@
#include "nsIAtom.h"
#include "nsUnicharUtils.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/css/Declaration.h"
#include "nsContentUtils.h"
#include "nsReadableUtils.h"
#include "prprf.h"
@ -149,7 +149,7 @@ nsAttrValue::nsAttrValue(nsIAtom* aValue)
SetTo(aValue);
}
nsAttrValue::nsAttrValue(already_AddRefed<DeclarationBlock> aValue,
nsAttrValue::nsAttrValue(already_AddRefed<css::Declaration> aValue,
const nsAString* aSerialized)
: mBits(0)
{
@ -419,7 +419,7 @@ nsAttrValue::SetTo(double aValue, const nsAString* aSerialized)
}
void
nsAttrValue::SetTo(already_AddRefed<DeclarationBlock> aValue,
nsAttrValue::SetTo(already_AddRefed<css::Declaration> aValue,
const nsAString* aSerialized)
{
MiscContainer* cont = EnsureEmptyMiscContainer();
@ -642,7 +642,7 @@ nsAttrValue::ToString(nsAString& aResult) const
{
aResult.Truncate();
MiscContainer *container = GetMiscContainer();
if (DeclarationBlock* decl = container->mValue.mCSSDeclaration) {
if (css::Declaration* decl = container->mValue.mCSSDeclaration) {
decl->ToString(aResult);
}
const_cast<nsAttrValue*>(this)->SetMiscAtomOrString(&aResult);
@ -1747,7 +1747,7 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString,
}
}
RefPtr<DeclarationBlock> decl;
RefPtr<css::Declaration> decl;
css::Loader* cssLoader = ownerDoc->CSSLoader();
nsCSSParser cssParser(cssLoader);
decl = cssParser.ParseStyleAttribute(aString, docURI, baseURI,

View file

@ -36,8 +36,8 @@ class nsStyledElement;
struct MiscContainer;
namespace mozilla {
class DeclarationBlock;
namespace css {
class Declaration;
struct URLValue;
struct ImageValue;
} // namespace css
@ -122,7 +122,7 @@ public:
nsAttrValue(const nsAttrValue& aOther);
explicit nsAttrValue(const nsAString& aValue);
explicit nsAttrValue(nsIAtom* aValue);
nsAttrValue(already_AddRefed<mozilla::DeclarationBlock> aValue,
nsAttrValue(already_AddRefed<mozilla::css::Declaration> aValue,
const nsAString* aSerialized);
explicit nsAttrValue(const nsIntMargin& aValue);
~nsAttrValue();
@ -148,7 +148,7 @@ public:
void SetTo(int16_t aInt);
void SetTo(int32_t aInt, const nsAString* aSerialized);
void SetTo(double aValue, const nsAString* aSerialized);
void SetTo(already_AddRefed<mozilla::DeclarationBlock> aValue,
void SetTo(already_AddRefed<mozilla::css::Declaration> aValue,
const nsAString* aSerialized);
void SetTo(mozilla::css::URLValue* aValue, const nsAString* aSerialized);
void SetTo(const nsIntMargin& aValue);
@ -200,7 +200,7 @@ public:
inline int16_t GetEnumValue() const;
inline float GetPercentValue() const;
inline AtomArray* GetAtomArrayValue() const;
inline mozilla::DeclarationBlock* GetCSSDeclarationValue() const;
inline mozilla::css::Declaration* GetCSSDeclarationValue() const;
inline mozilla::css::URLValue* GetURLValue() const;
inline mozilla::css::ImageValue* GetImageValue() const;
inline double GetDoubleValue() const;

View file

@ -30,7 +30,7 @@ struct MiscContainer final
nscolor mColor;
uint32_t mEnumValue;
int32_t mPercent;
mozilla::DeclarationBlock* mCSSDeclaration;
mozilla::css::Declaration* mCSSDeclaration;
mozilla::css::URLValue* mURL;
mozilla::css::ImageValue* mImage;
nsAttrValue::AtomArray* mAtomArray;
@ -145,7 +145,7 @@ nsAttrValue::GetAtomArrayValue() const
return GetMiscContainer()->mValue.mAtomArray;
}
inline mozilla::DeclarationBlock*
inline mozilla::css::Declaration*
nsAttrValue::GetCSSDeclarationValue() const
{
NS_PRECONDITION(Type() == eCSSDeclaration, "wrong type");

View file

@ -14,9 +14,9 @@
#include "nsDOMCSSAttrDeclaration.h"
#include "nsServiceManagerUtils.h"
#include "nsIDocument.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "nsCSSParser.h"
#include "mozilla/css/Loader.h"
#include "mozilla/css/Declaration.h"
#include "nsIDOMMutationEvent.h"
#include "nsXULElement.h"
#include "nsContentUtils.h"
@ -64,7 +64,7 @@ nsStyledElement::BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
}
nsresult
nsStyledElement::SetInlineStyleDeclaration(DeclarationBlock* aDeclaration,
nsStyledElement::SetInlineStyleDeclaration(css::Declaration* aDeclaration,
const nsAString* aSerialized,
bool aNotify)
{
@ -113,7 +113,7 @@ nsStyledElement::SetInlineStyleDeclaration(DeclarationBlock* aDeclaration,
document, updateBatch);
}
DeclarationBlock*
css::Declaration*
nsStyledElement::GetInlineStyleDeclaration()
{
if (!MayHaveStyle()) {

View file

@ -17,7 +17,9 @@
#include "mozilla/dom/Element.h"
namespace mozilla {
class DeclarationBlock;
namespace css {
class Declaration;
} // namespace css
} // namespace mozilla
// IID for nsStyledElement interface
@ -43,8 +45,8 @@ public:
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
// Element interface methods
virtual mozilla::DeclarationBlock* GetInlineStyleDeclaration() override;
virtual nsresult SetInlineStyleDeclaration(mozilla::DeclarationBlock* aDeclaration,
virtual mozilla::css::Declaration* GetInlineStyleDeclaration() override;
virtual nsresult SetInlineStyleDeclaration(mozilla::css::Declaration* aDeclaration,
const nsAString* aSerialized,
bool aNotify) override;

View file

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ArrayUtils.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStateManager.h"
@ -189,11 +188,11 @@ nsGenericHTMLElement::CopyInnerTo(Element* aDst)
if (name->Equals(nsGkAtoms::style, kNameSpaceID_None) &&
value->Type() == nsAttrValue::eCSSDeclaration) {
DeclarationBlock* decl = value->GetCSSDeclarationValue();
css::Declaration* decl = value->GetCSSDeclarationValue();
// We can't just set this as a string, because that will fail
// to reparse the string into style data until the node is
// inserted into the document. Clone the Rule instead.
RefPtr<DeclarationBlock> declClone = decl->Clone();
RefPtr<css::Declaration> declClone = decl->Clone();
rv = aDst->SetInlineStyleDeclaration(declClone, &valStr, false);
NS_ENSURE_SUCCESS(rv, rv);

View file

@ -38,7 +38,6 @@
#include "mozilla/EventListenerManager.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "nsFocusManager.h"
#include "nsHTMLStyleSheet.h"
#include "nsNameSpaceManager.h"
@ -54,6 +53,7 @@
#include "nsIScriptSecurityManager.h"
#include "nsIServiceManager.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/css/Declaration.h"
#include "nsIURL.h"
#include "nsViewManager.h"
#include "nsIWidget.h"
@ -348,9 +348,9 @@ nsXULElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
// Style rules need to be cloned.
if (originalValue->Type() == nsAttrValue::eCSSDeclaration) {
DeclarationBlock* decl = originalValue->GetCSSDeclarationValue();
css::Declaration* decl = originalValue->GetCSSDeclarationValue();
RefPtr<css::Declaration>
declClone = new css::Declaration(*decl->AsGecko());
declClone = new css::Declaration(*decl);
nsString stringValue;
originalValue->ToString(stringValue);
@ -1900,9 +1900,9 @@ nsXULElement::MakeHeavyweight(nsXULPrototypeElement* aPrototype)
// Style rules need to be cloned.
if (protoattr->mValue.Type() == nsAttrValue::eCSSDeclaration) {
DeclarationBlock* decl = protoattr->mValue.GetCSSDeclarationValue();
css::Declaration* decl = protoattr->mValue.GetCSSDeclarationValue();
RefPtr<css::Declaration>
declClone = new css::Declaration(*decl->AsGecko());
declClone = new css::Declaration(*decl);
nsString stringValue;
protoattr->mValue.ToString(stringValue);

View file

@ -9,8 +9,8 @@
#include "mozilla/ChangeStyleTransaction.h"
#include "mozilla/HTMLEditor.h"
#include "mozilla/Preferences.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/css/Declaration.h"
#include "mozilla/dom/Element.h"
#include "mozilla/mozalloc.h"
#include "nsAString.h"
@ -548,7 +548,7 @@ CSSEditUtils::GetCSSInlinePropertyBase(nsINode* aNode,
}
MOZ_ASSERT(aStyleType == eSpecified);
RefPtr<DeclarationBlock> decl = element->GetInlineStyleDeclaration();
RefPtr<css::Declaration> decl = element->GetInlineStyleDeclaration();
if (!decl) {
return NS_OK;
}
@ -556,7 +556,7 @@ CSSEditUtils::GetCSSInlinePropertyBase(nsINode* aNode,
nsCSSProps::LookupProperty(nsDependentAtomString(aProperty),
CSSEnabledState::eForAllContent);
MOZ_ASSERT(prop != eCSSProperty_UNKNOWN);
decl->AsGecko()->GetPropertyValueByID(prop, aValue);
decl->GetPropertyValueByID(prop, aValue);
return NS_OK;
}

View file

@ -59,9 +59,14 @@ ImportantStyleData::List(FILE* out, int32_t aIndent) const
}
#endif
Declaration::Declaration()
: mImmutable(false)
{
mContainer.mRaw = 0;
}
Declaration::Declaration(const Declaration& aCopy)
: DeclarationBlock(aCopy),
mOrder(aCopy.mOrder),
: mOrder(aCopy.mOrder),
mVariableOrder(aCopy.mVariableOrder),
mData(aCopy.mData ? aCopy.mData->Clone() : nullptr),
mImportantData(aCopy.mImportantData ?
@ -71,7 +76,8 @@ Declaration::Declaration(const Declaration& aCopy)
nullptr),
mImportantVariables(aCopy.mImportantVariables ?
new CSSVariableDeclarations(*aCopy.mImportantVariables) :
nullptr)
nullptr),
mImmutable(false)
{
}
@ -1827,6 +1833,24 @@ Declaration::InitializeEmpty()
mData = nsCSSCompressedDataBlock::CreateEmptyBlock();
}
already_AddRefed<Declaration>
Declaration::Clone() const
{
RefPtr<Declaration> result;
result = new Declaration(*this);
return result.forget();
}
already_AddRefed<Declaration>
Declaration::EnsureMutable()
{
AssertNotExpanded();
if (!IsMutable()) {
return Clone();
}
return do_AddRef(this);
}
size_t
Declaration::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
{

View file

@ -18,7 +18,6 @@
#endif
#include "mozilla/Attributes.h"
#include "mozilla/DeclarationBlock.h"
#include "mozilla/MemoryReporting.h"
#include "CSSVariableDeclarations.h"
#include "nsCSSDataBlock.h"
@ -83,8 +82,7 @@ private:
// be copied before it can be modified, which is taken care of by
// |EnsureMutable|.
class Declaration final : public DeclarationBlock
, public nsIStyleRule
class Declaration final : public nsIStyleRule
{
public:
/**
@ -92,7 +90,7 @@ public:
* |mData|) and cannot be used until its |CompressFrom| method or
* |InitializeEmpty| method is called.
*/
Declaration() : DeclarationBlock() {}
Declaration();
Declaration(const Declaration& aCopy);
@ -104,6 +102,63 @@ private:
~Declaration();
public:
/**
* Return whether |this| may be modified.
*/
bool IsMutable() const {
return !mImmutable;
}
/**
* Crash if |this| cannot be modified.
*/
void AssertMutable() const {
MOZ_ASSERT(IsMutable(), "someone forgot to call EnsureMutable");
}
/**
* Mark this declaration as unmodifiable. It's 'const' so it can
* be called from ToString.
*/
void SetImmutable() const { mImmutable = true; }
/**
* Copy |this|, if necessary to ensure that it can be modified.
*/
already_AddRefed<Declaration> EnsureMutable();
void SetOwningRule(css::Rule* aRule) {
MOZ_ASSERT(!mContainer.mOwningRule || !aRule,
"should never overwrite one rule with another");
mContainer.mOwningRule = aRule;
}
css::Rule* GetOwningRule() const {
if (mContainer.mRaw & 0x1) {
return nullptr;
}
return mContainer.mOwningRule;
}
void SetHTMLCSSStyleSheet(nsHTMLCSSStyleSheet* aHTMLCSSStyleSheet) {
MOZ_ASSERT(!mContainer.mHTMLCSSStyleSheet || !aHTMLCSSStyleSheet,
"should never overwrite one sheet with another");
mContainer.mHTMLCSSStyleSheet = aHTMLCSSStyleSheet;
if (aHTMLCSSStyleSheet) {
mContainer.mRaw |= uintptr_t(1);
}
}
nsHTMLCSSStyleSheet* GetHTMLCSSStyleSheet() const {
if (!(mContainer.mRaw & 0x1)) {
return nullptr;
}
auto c = mContainer;
c.mRaw &= ~uintptr_t(1);
return c.mHTMLCSSStyleSheet;
}
already_AddRefed<Declaration> Clone() const;
// nsIStyleRule implementation
virtual void MapRuleInfoInto(nsRuleData *aRuleData) override;
@ -367,6 +422,27 @@ public:
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
private:
union {
// We only ever have one of these since we have an
// nsHTMLCSSStyleSheet only for style attributes, and style
// attributes never have an owning rule.
// It's an nsHTMLCSSStyleSheet if the low bit is set.
uintptr_t mRaw;
// The style rule that owns this declaration. May be null.
css::Rule* mOwningRule;
// The nsHTMLCSSStyleSheet that is responsible for this declaration.
// Only non-null for style attributes.
nsHTMLCSSStyleSheet* mHTMLCSSStyleSheet;
} mContainer;
// set when declaration put in the rule tree;
// also by ToString (hence the 'mutable').
mutable bool mImmutable;
// The order of properties in this declaration. Longhand properties are
// represented by their nsCSSPropertyID value, and each custom property (--*)
// is represented by a value that begins at eCSSProperty_COUNT.

View file

@ -1,140 +0,0 @@
/* -*- Mode: C++; tab-width: 8; 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/. */
/*
* representation of a declaration block in a CSS stylesheet, or of
* a style attribute
*/
#ifndef mozilla_DeclarationBlock_h
#define mozilla_DeclarationBlock_h
#include "mozilla/DeprecatedUtils.h"
#include "nsCSSPropertyID.h"
class nsHTMLCSSStyleSheet;
namespace mozilla {
namespace css {
class Declaration;
class Rule;
} // namespace css
class DeclarationBlock
{
protected:
explicit DeclarationBlock()
: mImmutable(false) { mContainer.mRaw = 0; }
DeclarationBlock(const DeclarationBlock& aCopy)
: DeclarationBlock() {}
public:
MOZ_DECL_DEPRECATED_METHODS(css::Declaration)
inline MozExternalRefCountType AddRef();
inline MozExternalRefCountType Release();
inline already_AddRefed<DeclarationBlock> Clone() const;
/**
* Return whether |this| may be modified.
*/
bool IsMutable() const {
return !mImmutable;
}
/**
* Crash if |this| cannot be modified.
*/
void AssertMutable() const {
MOZ_ASSERT(IsMutable(), "someone forgot to call EnsureMutable");
}
/**
* Mark this declaration as unmodifiable. It's 'const' so it can
* be called from ToString.
*/
void SetImmutable() const { mImmutable = true; }
/**
* Copy |this|, if necessary to ensure that it can be modified.
*/
inline already_AddRefed<DeclarationBlock> EnsureMutable();
void SetOwningRule(css::Rule* aRule) {
MOZ_ASSERT(!mContainer.mOwningRule || !aRule,
"should never overwrite one rule with another");
mContainer.mOwningRule = aRule;
}
css::Rule* GetOwningRule() const {
if (mContainer.mRaw & 0x1) {
return nullptr;
}
return mContainer.mOwningRule;
}
void SetHTMLCSSStyleSheet(nsHTMLCSSStyleSheet* aHTMLCSSStyleSheet) {
MOZ_ASSERT(!mContainer.mHTMLCSSStyleSheet || !aHTMLCSSStyleSheet,
"should never overwrite one sheet with another");
mContainer.mHTMLCSSStyleSheet = aHTMLCSSStyleSheet;
if (aHTMLCSSStyleSheet) {
mContainer.mRaw |= uintptr_t(1);
}
}
nsHTMLCSSStyleSheet* GetHTMLCSSStyleSheet() const {
if (!(mContainer.mRaw & 0x1)) {
return nullptr;
}
auto c = mContainer;
c.mRaw &= ~uintptr_t(1);
return c.mHTMLCSSStyleSheet;
}
inline void ToString(nsAString& aString) const;
inline uint32_t Count() const;
inline bool GetNthProperty(uint32_t aIndex, nsAString& aReturn) const;
inline void GetPropertyValue(const nsAString& aProperty,
nsAString& aValue) const;
inline void GetPropertyValueByID(nsCSSPropertyID aPropID,
nsAString& aValue) const;
inline void GetAuthoredPropertyValue(const nsAString& aProperty,
nsAString& aValue) const;
inline bool GetPropertyIsImportant(const nsAString& aProperty) const;
inline void RemoveProperty(const nsAString& aProperty);
inline void RemovePropertyByID(nsCSSPropertyID aProperty);
private:
union {
// We only ever have one of these since we have an
// nsHTMLCSSStyleSheet only for style attributes, and style
// attributes never have an owning rule.
// It's an nsHTMLCSSStyleSheet if the low bit is set.
uintptr_t mRaw;
// The style rule that owns this declaration. May be null.
css::Rule* mOwningRule;
// The nsHTMLCSSStyleSheet that is responsible for this declaration.
// Only non-null for style attributes.
nsHTMLCSSStyleSheet* mHTMLCSSStyleSheet;
} mContainer;
// set when declaration put in the rule tree;
// also by ToString (hence the 'mutable').
mutable bool mImmutable;
};
} // namespace mozilla
#endif // mozilla_DeclarationBlock_h

View file

@ -1,106 +0,0 @@
/* -*- Mode: C++; tab-width: 8; 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/. */
#ifndef mozilla_DeclarationBlockInlines_h
#define mozilla_DeclarationBlockInlines_h
#include "mozilla/css/Declaration.h"
namespace mozilla {
MOZ_DEFINE_DEPRECATED_METHODS(DeclarationBlock, css::Declaration)
MozExternalRefCountType
DeclarationBlock::AddRef()
{
return AsGecko()->AddRef();
}
MozExternalRefCountType
DeclarationBlock::Release()
{
return AsGecko()->Release();
}
already_AddRefed<DeclarationBlock>
DeclarationBlock::Clone() const
{
RefPtr<DeclarationBlock> result;
result = new css::Declaration(*AsGecko());
return result.forget();
}
already_AddRefed<DeclarationBlock>
DeclarationBlock::EnsureMutable()
{
#ifdef DEBUG
AsGecko()->AssertNotExpanded();
#endif
if (!IsMutable()) {
return Clone();
}
return do_AddRef(this);
}
void
DeclarationBlock::ToString(nsAString& aString) const
{
AsGecko()->ToString(aString);
}
uint32_t
DeclarationBlock::Count() const
{
return AsGecko()->Count();
}
bool
DeclarationBlock::GetNthProperty(uint32_t aIndex, nsAString& aReturn) const
{
return AsGecko()->GetNthProperty(aIndex, aReturn);
}
void
DeclarationBlock::GetPropertyValue(const nsAString& aProperty,
nsAString& aValue) const
{
AsGecko()->GetPropertyValue(aProperty, aValue);
}
void
DeclarationBlock::GetPropertyValueByID(nsCSSPropertyID aPropID,
nsAString& aValue) const
{
AsGecko()->GetPropertyValueByID(aPropID, aValue);
}
void
DeclarationBlock::GetAuthoredPropertyValue(const nsAString& aProperty,
nsAString& aValue) const
{
AsGecko()->GetAuthoredPropertyValue(aProperty, aValue);
}
bool
DeclarationBlock::GetPropertyIsImportant(const nsAString& aProperty) const
{
return AsGecko()->GetPropertyIsImportant(aProperty);
}
void
DeclarationBlock::RemoveProperty(const nsAString& aProperty)
{
AsGecko()->RemoveProperty(aProperty);
}
void
DeclarationBlock::RemovePropertyByID(nsCSSPropertyID aProperty)
{
AsGecko()->RemovePropertyByID(aProperty);
}
} // namespace mozilla
#endif // mozilla_DeclarationBlockInlines_h

View file

@ -11,7 +11,6 @@
#include "mozilla/css/StyleRule.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/GroupRule.h"
@ -1113,8 +1112,8 @@ public:
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
void DropReference(void);
virtual DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
virtual nsresult SetCSSDeclaration(DeclarationBlock* aDecl) override;
virtual css::Declaration* GetCSSDeclaration(Operation aOperation) override;
virtual nsresult SetCSSDeclaration(css::Declaration* aDecl) override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
virtual nsIDocument* DocToUpdate() override;
@ -1227,7 +1226,7 @@ DOMCSSDeclarationImpl::DropReference(void)
mRule = nullptr;
}
DeclarationBlock*
css::Declaration*
DOMCSSDeclarationImpl::GetCSSDeclaration(Operation aOperation)
{
if (mRule) {
@ -1264,7 +1263,7 @@ DOMCSSDeclarationImpl::GetParentRule(nsIDOMCSSRule **aParent)
}
nsresult
DOMCSSDeclarationImpl::SetCSSDeclaration(DeclarationBlock* aDecl)
DOMCSSDeclarationImpl::SetCSSDeclaration(css::Declaration* aDecl)
{
NS_PRECONDITION(mRule,
"can only be called when |GetCSSDeclaration| returned a declaration");
@ -1277,7 +1276,7 @@ DOMCSSDeclarationImpl::SetCSSDeclaration(DeclarationBlock* aDecl)
mozAutoDocUpdate updateBatch(doc, UPDATE_STYLE, true);
mRule->SetDeclaration(aDecl->AsGecko());
mRule->SetDeclaration(aDecl);
if (sheet) {
sheet->DidDirty();

View file

@ -79,8 +79,6 @@ EXPORTS.mozilla += [
'CSSVariableDeclarations.h',
'CSSVariableResolver.h',
'CSSVariableValues.h',
'DeclarationBlock.h',
'DeclarationBlockInlines.h',
'DeprecatedUtils.h',
'HandleRefPtr.h',
'IncrementalClearCOMRuleArray.h',

View file

@ -29,7 +29,7 @@
#include "nsContentUtils.h"
#include "nsError.h"
#include "nsStyleUtil.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/css/Declaration.h"
#include "nsCSSParser.h"
#include "nsDOMClassInfoID.h"
#include "mozilla/dom/CSSStyleDeclarationBinding.h"
@ -1953,7 +1953,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCSSKeyframeStyleDeclaration)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_END_INHERITING(nsDOMCSSDeclaration)
DeclarationBlock*
css::Declaration*
nsCSSKeyframeStyleDeclaration::GetCSSDeclaration(Operation aOperation)
{
if (mRule) {
@ -1979,10 +1979,10 @@ nsCSSKeyframeStyleDeclaration::GetParentRule(nsIDOMCSSRule **aParent)
}
nsresult
nsCSSKeyframeStyleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
nsCSSKeyframeStyleDeclaration::SetCSSDeclaration(css::Declaration* aDecl)
{
MOZ_ASSERT(aDecl, "must be non-null");
mRule->ChangeDeclaration(aDecl->AsGecko());
mRule->ChangeDeclaration(aDecl);
return NS_OK;
}
@ -2511,7 +2511,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCSSPageStyleDeclaration)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_END_INHERITING(nsDOMCSSDeclaration)
DeclarationBlock*
css::Declaration*
nsCSSPageStyleDeclaration::GetCSSDeclaration(Operation aOperation)
{
if (mRule) {
@ -2537,10 +2537,10 @@ nsCSSPageStyleDeclaration::GetParentRule(nsIDOMCSSRule** aParent)
}
nsresult
nsCSSPageStyleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
nsCSSPageStyleDeclaration::SetCSSDeclaration(css::Declaration* aDecl)
{
MOZ_ASSERT(aDecl, "must be non-null");
mRule->ChangeDeclaration(aDecl->AsGecko());
mRule->ChangeDeclaration(aDecl);
return NS_OK;
}

View file

@ -360,8 +360,8 @@ public:
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
void DropReference() { mRule = nullptr; }
virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl) override;
virtual mozilla::css::Declaration* GetCSSDeclaration(Operation aOperation) override;
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
virtual nsIDocument* DocToUpdate() override;
@ -491,8 +491,8 @@ public:
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
void DropReference() { mRule = nullptr; }
virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl) override;
virtual mozilla::css::Declaration* GetCSSDeclaration(Operation aOperation) override;
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
virtual nsIDocument* DocToUpdate() override;

View file

@ -578,7 +578,7 @@ nsComputedDOMStyle::GetPresShellForContent(nsIContent* aContent)
// nsDOMCSSDeclaration abstract methods which should never be called
// on a nsComputedDOMStyle object, but must be defined to avoid
// compile errors.
DeclarationBlock*
mozilla::css::Declaration*
nsComputedDOMStyle::GetCSSDeclaration(Operation)
{
NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSDeclaration");
@ -586,7 +586,7 @@ nsComputedDOMStyle::GetCSSDeclaration(Operation)
}
nsresult
nsComputedDOMStyle::SetCSSDeclaration(DeclarationBlock*)
nsComputedDOMStyle::SetCSSDeclaration(mozilla::css::Declaration*)
{
NS_RUNTIMEABORT("called nsComputedDOMStyle::SetCSSDeclaration");
return NS_ERROR_FAILURE;

View file

@ -113,8 +113,8 @@ public:
// nsDOMCSSDeclaration abstract methods which should never be called
// on a nsComputedDOMStyle object, but must be defined to avoid
// compile errors.
virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation) override;
virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock*) override;
virtual mozilla::css::Declaration* GetCSSDeclaration(Operation) override;
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration*) override;
virtual nsIDocument* DocToUpdate() override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;

View file

@ -19,7 +19,6 @@
#include "nsIFrame.h"
#include "ActiveLayerTracker.h"
#include "StyleSetHandle.h"
#include "DeclarationBlockInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -73,7 +72,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSAttributeDeclaration)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSAttributeDeclaration)
nsresult
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(css::Declaration* aDecl)
{
NS_ASSERTION(mElement, "Must have Element to set the declaration!");
return mIsSMILOverride
@ -89,13 +88,13 @@ nsDOMCSSAttributeDeclaration::DocToUpdate()
return mElement->OwnerDoc();
}
DeclarationBlock*
css::Declaration*
nsDOMCSSAttributeDeclaration::GetCSSDeclaration(Operation aOperation)
{
if (!mElement)
return nullptr;
DeclarationBlock* declaration;
css::Declaration* declaration;
if (mIsSMILOverride) {
declaration = mElement->GetSMILOverrideStyleDeclaration();
} else {
@ -132,9 +131,9 @@ nsDOMCSSAttributeDeclaration::GetCSSDeclaration(Operation aOperation)
}
// cannot fail
RefPtr<DeclarationBlock> decl;
RefPtr<css::Declaration> decl;
decl = new css::Declaration();
decl->AsGecko()->InitializeEmpty();
decl->InitializeEmpty();
// this *can* fail (inside SetAttrAndNotify, at least).
nsresult rv;

View file

@ -30,7 +30,7 @@ public:
// If GetCSSDeclaration returns non-null, then the decl it returns
// is owned by our current style rule.
virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
virtual mozilla::css::Declaration* GetCSSDeclaration(Operation aOperation) override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
@ -44,7 +44,7 @@ public:
protected:
~nsDOMCSSAttributeDeclaration();
virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl) override;
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) override;
virtual nsIDocument* DocToUpdate() override;
RefPtr<Element> mElement;

View file

@ -8,10 +8,9 @@
#include "nsDOMCSSDeclaration.h"
#include "nsCSSParser.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Rule.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/css/Declaration.h"
#include "mozilla/dom/CSS2PropertiesBinding.h"
#include "nsCSSProps.h"
#include "nsCOMPtr.h"
@ -49,7 +48,7 @@ nsDOMCSSDeclaration::GetPropertyValue(const nsCSSPropertyID aPropID,
"Should never pass eCSSProperty_UNKNOWN around");
aValue.Truncate();
if (DeclarationBlock* decl = GetCSSDeclaration(eOperation_Read)) {
if (css::Declaration* decl = GetCSSDeclaration(eOperation_Read)) {
decl->GetPropertyValueByID(aPropID, aValue);
}
return NS_OK;
@ -97,7 +96,7 @@ nsDOMCSSDeclaration::SetPropertyValue(const nsCSSPropertyID aPropID,
NS_IMETHODIMP
nsDOMCSSDeclaration::GetCssText(nsAString& aCssText)
{
DeclarationBlock* decl = GetCSSDeclaration(eOperation_Read);
css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
aCssText.Truncate();
if (decl) {
@ -112,7 +111,7 @@ nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText)
{
// We don't need to *do* anything with the old declaration, but we need
// to ensure that it exists, or else SetCSSDeclaration may crash.
DeclarationBlock* olddecl = GetCSSDeclaration(eOperation_Modify);
css::Declaration* olddecl = GetCSSDeclaration(eOperation_Modify);
if (!olddecl) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -130,7 +129,7 @@ nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText)
// rule (see stack in bug 209575).
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
RefPtr<DeclarationBlock> newdecl;
RefPtr<css::Declaration> newdecl;
RefPtr<css::Declaration> decl(new css::Declaration());
decl->InitializeEmpty();
nsCSSParser cssParser(env.mCSSLoader);
@ -149,7 +148,7 @@ nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText)
NS_IMETHODIMP
nsDOMCSSDeclaration::GetLength(uint32_t* aLength)
{
DeclarationBlock* decl = GetCSSDeclaration(eOperation_Read);
css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
if (decl) {
*aLength = decl->Count();
@ -171,7 +170,7 @@ nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorRe
void
nsDOMCSSDeclaration::IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName)
{
DeclarationBlock* decl = GetCSSDeclaration(eOperation_Read);
css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
aFound = decl && decl->GetNthProperty(aIndex, aPropName);
}
@ -180,7 +179,7 @@ nsDOMCSSDeclaration::GetPropertyValue(const nsAString& aPropertyName,
nsAString& aReturn)
{
aReturn.Truncate();
if (DeclarationBlock* decl = GetCSSDeclaration(eOperation_Read)) {
if (css::Declaration* decl = GetCSSDeclaration(eOperation_Read)) {
decl->GetPropertyValue(aPropertyName, aReturn);
}
return NS_OK;
@ -190,7 +189,7 @@ NS_IMETHODIMP
nsDOMCSSDeclaration::GetAuthoredPropertyValue(const nsAString& aPropertyName,
nsAString& aReturn)
{
if (DeclarationBlock* decl = GetCSSDeclaration(eOperation_Read)) {
if (css::Declaration* decl = GetCSSDeclaration(eOperation_Read)) {
decl->GetAuthoredPropertyValue(aPropertyName, aReturn);
}
return NS_OK;
@ -200,7 +199,7 @@ NS_IMETHODIMP
nsDOMCSSDeclaration::GetPropertyPriority(const nsAString& aPropertyName,
nsAString& aReturn)
{
DeclarationBlock* decl = GetCSSDeclaration(eOperation_Read);
css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
aReturn.Truncate();
if (decl && decl->GetPropertyIsImportant(aPropertyName)) {
@ -276,7 +275,7 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSPropertyID aPropID,
const nsAString& aPropValue,
bool aIsImportant)
{
DeclarationBlock* olddecl = GetCSSDeclaration(eOperation_Modify);
css::Declaration* olddecl = GetCSSDeclaration(eOperation_Modify);
if (!olddecl) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -293,13 +292,13 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSPropertyID aPropID,
// between when we mutate the declaration and when we set the new
// rule (see stack in bug 209575).
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
RefPtr<DeclarationBlock> decl = olddecl->EnsureMutable();
RefPtr<css::Declaration> decl = olddecl->EnsureMutable();
bool changed;
nsCSSParser cssParser(env.mCSSLoader);
cssParser.ParseProperty(aPropID, aPropValue,
env.mSheetURI, env.mBaseURI, env.mPrincipal,
decl->AsGecko(), &changed, aIsImportant);
decl, &changed, aIsImportant);
if (!changed) {
// Parsing failed -- but we don't throw an exception for that.
return NS_OK;
@ -315,7 +314,7 @@ nsDOMCSSDeclaration::ParseCustomPropertyValue(const nsAString& aPropertyName,
{
MOZ_ASSERT(nsCSSProps::IsCustomPropertyName(aPropertyName));
DeclarationBlock* olddecl = GetCSSDeclaration(eOperation_Modify);
css::Declaration* olddecl = GetCSSDeclaration(eOperation_Modify);
if (!olddecl) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -332,13 +331,13 @@ nsDOMCSSDeclaration::ParseCustomPropertyValue(const nsAString& aPropertyName,
// between when we mutate the declaration and when we set the new
// rule (see stack in bug 209575).
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
RefPtr<DeclarationBlock> decl = olddecl->EnsureMutable();
RefPtr<css::Declaration> decl = olddecl->EnsureMutable();
bool changed;
auto propName = Substring(aPropertyName, CSS_CUSTOM_NAME_PREFIX_LENGTH);
nsCSSParser cssParser(env.mCSSLoader);
cssParser.ParseVariable(propName, aPropValue, env.mSheetURI,
env.mBaseURI, env.mPrincipal, decl->AsGecko(),
env.mBaseURI, env.mPrincipal, decl,
&changed, aIsImportant);
if (!changed) {
// Parsing failed -- but we don't throw an exception for that.
@ -351,7 +350,7 @@ nsDOMCSSDeclaration::ParseCustomPropertyValue(const nsAString& aPropertyName,
nsresult
nsDOMCSSDeclaration::RemovePropertyInternal(nsCSSPropertyID aPropID)
{
DeclarationBlock* olddecl = GetCSSDeclaration(eOperation_RemoveProperty);
css::Declaration* olddecl = GetCSSDeclaration(eOperation_RemoveProperty);
if (!olddecl) {
return NS_OK; // no decl, so nothing to remove
}
@ -363,7 +362,7 @@ nsDOMCSSDeclaration::RemovePropertyInternal(nsCSSPropertyID aPropID)
// rule (see stack in bug 209575).
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
RefPtr<DeclarationBlock> decl = olddecl->EnsureMutable();
RefPtr<css::Declaration> decl = olddecl->EnsureMutable();
decl->RemovePropertyByID(aPropID);
return SetCSSDeclaration(decl);
}
@ -371,7 +370,7 @@ nsDOMCSSDeclaration::RemovePropertyInternal(nsCSSPropertyID aPropID)
nsresult
nsDOMCSSDeclaration::RemovePropertyInternal(const nsAString& aPropertyName)
{
DeclarationBlock* olddecl = GetCSSDeclaration(eOperation_RemoveProperty);
css::Declaration* olddecl = GetCSSDeclaration(eOperation_RemoveProperty);
if (!olddecl) {
return NS_OK; // no decl, so nothing to remove
}
@ -383,7 +382,7 @@ nsDOMCSSDeclaration::RemovePropertyInternal(const nsAString& aPropertyName)
// rule (see stack in bug 209575).
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), true);
RefPtr<DeclarationBlock> decl = olddecl->EnsureMutable();
RefPtr<css::Declaration> decl = olddecl->EnsureMutable();
decl->RemoveProperty(aPropertyName);
return SetCSSDeclaration(decl);
}

View file

@ -20,10 +20,10 @@ struct JSContext;
class JSObject;
namespace mozilla {
class DeclarationBlock;
namespace css {
class Loader;
class Rule;
class Declaration;
} // namespace css
} // namespace mozilla
@ -119,8 +119,8 @@ protected:
// AttributeWillChange.
eOperation_RemoveProperty
};
virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation aOperation) = 0;
virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl) = 0;
virtual mozilla::css::Declaration* GetCSSDeclaration(Operation aOperation) = 0;
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) = 0;
// Document that we must call BeginUpdate/EndUpdate on around the
// calls to SetCSSDeclaration and the style rule mutation that leads
// to it.

View file

@ -10,7 +10,7 @@
#include "nsHTMLCSSStyleSheet.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/css/Declaration.h"
#include "nsIStyleRuleProcessor.h"
#include "nsPresContext.h"
#include "nsRuleWalker.h"
@ -39,7 +39,7 @@ nsHTMLCSSStyleSheet::~nsHTMLCSSStyleSheet()
// Ideally we'd just call MiscContainer::Evict, but we can't do that since
// we're iterating the hashtable.
if (value->mType == nsAttrValue::eCSSDeclaration) {
DeclarationBlock* declaration = value->mValue.mCSSDeclaration;
css::Declaration* declaration = value->mValue.mCSSDeclaration;
declaration->SetHTMLCSSStyleSheet(nullptr);
} else {
MOZ_ASSERT_UNREACHABLE("unexpected cached nsAttrValue type");
@ -65,10 +65,10 @@ nsHTMLCSSStyleSheet::ElementRulesMatching(nsPresContext* aPresContext,
nsRuleWalker* aRuleWalker)
{
// just get the one and only style rule from the content's STYLE attribute
DeclarationBlock* declaration = aElement->GetInlineStyleDeclaration();
css::Declaration* declaration = aElement->GetInlineStyleDeclaration();
if (declaration) {
declaration->SetImmutable();
aRuleWalker->Forward(declaration->AsGecko());
aRuleWalker->Forward(declaration);
}
declaration = aElement->GetSMILOverrideStyleDeclaration();
@ -78,7 +78,7 @@ nsHTMLCSSStyleSheet::ElementRulesMatching(nsPresContext* aPresContext,
// Animation restyle (or non-restyle traversal of rules)
// Now we can walk SMIL overrride style, without triggering transitions.
declaration->SetImmutable();
aRuleWalker->Forward(declaration->AsGecko());
aRuleWalker->Forward(declaration);
}
}
}
@ -94,10 +94,10 @@ nsHTMLCSSStyleSheet::PseudoElementRulesMatching(Element* aPseudoElement,
MOZ_ASSERT(aPseudoElement);
// just get the one and only style rule from the content's STYLE attribute
DeclarationBlock* declaration = aPseudoElement->GetInlineStyleDeclaration();
css::Declaration* declaration = aPseudoElement->GetInlineStyleDeclaration();
if (declaration) {
declaration->SetImmutable();
aRuleWalker->Forward(declaration->AsGecko());
aRuleWalker->Forward(declaration);
}
}