Bug 1294299 part 1 - Make nsDOMCSSDeclaration use DeclarationBlock. r=heycam
MozReview-Commit-ID: B2eHrpxOMJ8
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -6,16 +6,17 @@
/*
* representation of CSS style rules (selectors+declaration), CSS
* selectors, and DOM objects for style rules, selectors, and
* declarations
*/
#include "mozilla/css/StyleRule.h"
+#include "mozilla/DeclarationBlockInlines.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/GroupRule.h"
#include "mozilla/css/Declaration.h"
#include "nsIDocument.h"
#include "nsIAtom.h"
#include "nsString.h"
#include "nsStyleUtil.h"
@@ -1057,18 +1058,18 @@ class DOMCSSDeclarationImpl : public nsD
protected:
virtual ~DOMCSSDeclarationImpl(void);
public:
explicit DOMCSSDeclarationImpl(css::StyleRule *aRule);
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
void DropReference(void);
- virtual css::Declaration* GetCSSDeclaration(Operation aOperation) override;
- virtual nsresult SetCSSDeclaration(css::Declaration* aDecl) override;
+ virtual DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
+ virtual nsresult SetCSSDeclaration(DeclarationBlock* aDecl) override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
virtual nsIDocument* DocToUpdate() override;
// Override |AddRef| and |Release| for being a member of
// |DOMCSSStyleRule|. Also, we need to forward QI for cycle
// collection things to DOMCSSStyleRule.
NS_DECL_ISUPPORTS_INHERITED
@@ -1161,17 +1162,17 @@ NS_INTERFACE_MAP_BEGIN(DOMCSSDeclaration
NS_IMPL_QUERY_TAIL_INHERITING(nsDOMCSSDeclaration)
void
DOMCSSDeclarationImpl::DropReference(void)
{
mRule = nullptr;
}
-css::Declaration*
+DeclarationBlock*
DOMCSSDeclarationImpl::GetCSSDeclaration(Operation aOperation)
{
if (mRule) {
if (aOperation != eOperation_Read) {
RefPtr<CSSStyleSheet> sheet = mRule->GetStyleSheet();
if (sheet) {
sheet->WillDirty();
}
@@ -1198,30 +1199,30 @@ DOMCSSDeclarationImpl::GetParentRule(nsI
return NS_OK;
}
NS_IF_ADDREF(*aParent = mRule->GetDOMRule());
return NS_OK;
}
nsresult
-DOMCSSDeclarationImpl::SetCSSDeclaration(css::Declaration* aDecl)
+DOMCSSDeclarationImpl::SetCSSDeclaration(DeclarationBlock* aDecl)
{
NS_PRECONDITION(mRule,
"can only be called when |GetCSSDeclaration| returned a declaration");
nsCOMPtr<nsIDocument> owningDoc;
RefPtr<CSSStyleSheet> sheet = mRule->GetStyleSheet();
if (sheet) {
owningDoc = sheet->GetOwningDocument();
}
mozAutoDocUpdate updateBatch(owningDoc, UPDATE_STYLE, true);
- mRule->SetDeclaration(aDecl);
+ mRule->SetDeclaration(aDecl->AsGecko());
if (sheet) {
sheet->DidDirty();
}
if (owningDoc) {
owningDoc->StyleRuleChanged(sheet, mRule);
}
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -24,17 +24,17 @@
#include "nsIMediaList.h"
#include "mozilla/dom/CSSRuleList.h"
#include "nsIDocument.h"
#include "nsPresContext.h"
#include "nsContentUtils.h"
#include "nsError.h"
#include "nsStyleUtil.h"
-#include "mozilla/css/Declaration.h"
+#include "mozilla/DeclarationBlockInlines.h"
#include "nsCSSParser.h"
#include "nsDOMClassInfoID.h"
#include "mozilla/dom/CSSStyleDeclarationBinding.h"
#include "StyleRule.h"
#include "nsFont.h"
#include "nsIURI.h"
#include "mozAutoDocUpdate.h"
@@ -1918,17 +1918,17 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsCSSKey
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCSSKeyframeStyleDeclaration)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsCSSKeyframeStyleDeclaration)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCSSKeyframeStyleDeclaration)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_END_INHERITING(nsDOMCSSDeclaration)
-css::Declaration*
+DeclarationBlock*
nsCSSKeyframeStyleDeclaration::GetCSSDeclaration(Operation aOperation)
{
if (mRule) {
return mRule->Declaration();
} else {
return nullptr;
}
}
@@ -1944,20 +1944,20 @@ nsCSSKeyframeStyleDeclaration::GetParent
{
NS_ENSURE_ARG_POINTER(aParent);
NS_IF_ADDREF(*aParent = mRule);
return NS_OK;
}
nsresult
-nsCSSKeyframeStyleDeclaration::SetCSSDeclaration(css::Declaration* aDecl)
+nsCSSKeyframeStyleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
{
MOZ_ASSERT(aDecl, "must be non-null");
- mRule->ChangeDeclaration(aDecl);
+ mRule->ChangeDeclaration(aDecl->AsGecko());
return NS_OK;
}
nsIDocument*
nsCSSKeyframeStyleDeclaration::DocToUpdate()
{
return nullptr;
}
@@ -2465,17 +2465,17 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsCSSPag
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsCSSPageStyleDeclaration)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(nsCSSPageStyleDeclaration)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsCSSPageStyleDeclaration)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_END_INHERITING(nsDOMCSSDeclaration)
-css::Declaration*
+DeclarationBlock*
nsCSSPageStyleDeclaration::GetCSSDeclaration(Operation aOperation)
{
if (mRule) {
return mRule->Declaration();
} else {
return nullptr;
}
}
@@ -2491,20 +2491,20 @@ nsCSSPageStyleDeclaration::GetParentRule
{
NS_ENSURE_ARG_POINTER(aParent);
NS_IF_ADDREF(*aParent = mRule);
return NS_OK;
}
nsresult
-nsCSSPageStyleDeclaration::SetCSSDeclaration(css::Declaration* aDecl)
+nsCSSPageStyleDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
{
MOZ_ASSERT(aDecl, "must be non-null");
- mRule->ChangeDeclaration(aDecl);
+ mRule->ChangeDeclaration(aDecl->AsGecko());
return NS_OK;
}
nsIDocument*
nsCSSPageStyleDeclaration::DocToUpdate()
{
return nullptr;
}
--- a/layout/style/nsCSSRules.h
+++ b/layout/style/nsCSSRules.h
@@ -350,18 +350,18 @@ class nsCSSKeyframeRule;
class nsCSSKeyframeStyleDeclaration final : public nsDOMCSSDeclaration
{
public:
explicit nsCSSKeyframeStyleDeclaration(nsCSSKeyframeRule *aRule);
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
void DropReference() { mRule = nullptr; }
- virtual mozilla::css::Declaration* GetCSSDeclaration(Operation aOperation) override;
- virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) override;
+ virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
+ virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl) override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
virtual nsIDocument* DocToUpdate() override;
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsCSSKeyframeStyleDeclaration,
nsICSSDeclaration)
virtual nsINode* GetParentObject() override;
@@ -480,18 +480,18 @@ class nsCSSPageRule;
class nsCSSPageStyleDeclaration final : public nsDOMCSSDeclaration
{
public:
explicit nsCSSPageStyleDeclaration(nsCSSPageRule *aRule);
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
void DropReference() { mRule = nullptr; }
- virtual mozilla::css::Declaration* GetCSSDeclaration(Operation aOperation) override;
- virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) override;
+ virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
+ virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl) override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
virtual nsIDocument* DocToUpdate() override;
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsCSSPageStyleDeclaration,
nsICSSDeclaration)
virtual nsINode *GetParentObject() override;
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -554,25 +554,25 @@ nsComputedDOMStyle::GetPresShellForConte
return nullptr;
return composedDoc->GetShell();
}
// nsDOMCSSDeclaration abstract methods which should never be called
// on a nsComputedDOMStyle object, but must be defined to avoid
// compile errors.
-css::Declaration*
+DeclarationBlock*
nsComputedDOMStyle::GetCSSDeclaration(Operation)
{
NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSDeclaration");
return nullptr;
}
nsresult
-nsComputedDOMStyle::SetCSSDeclaration(css::Declaration*)
+nsComputedDOMStyle::SetCSSDeclaration(DeclarationBlock*)
{
NS_RUNTIMEABORT("called nsComputedDOMStyle::SetCSSDeclaration");
return NS_ERROR_FAILURE;
}
nsIDocument*
nsComputedDOMStyle::DocToUpdate()
{
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -100,18 +100,18 @@ public:
void SetExposeVisitedStyle(bool aExpose) {
NS_ASSERTION(aExpose != mExposeVisitedStyle, "should always be changing");
mExposeVisitedStyle = aExpose;
}
// nsDOMCSSDeclaration abstract methods which should never be called
// on a nsComputedDOMStyle object, but must be defined to avoid
// compile errors.
- virtual mozilla::css::Declaration* GetCSSDeclaration(Operation) override;
- virtual nsresult SetCSSDeclaration(mozilla::css::Declaration*) override;
+ virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation) override;
+ virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock*) override;
virtual nsIDocument* DocToUpdate() override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
static already_AddRefed<nsROCSSPrimitiveValue>
MatrixToCSSValue(const mozilla::gfx::Matrix4x4& aMatrix);
static void RegisterPrefChangeCallbacks();
static void UnregisterPrefChangeCallbacks();
--- a/layout/style/nsDOMCSSAttrDeclaration.cpp
+++ b/layout/style/nsDOMCSSAttrDeclaration.cpp
@@ -64,44 +64,43 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_E
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCSSAttributeDeclaration)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_IMPL_QUERY_TAIL_INHERITING(nsDOMCSSDeclaration)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSAttributeDeclaration)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSAttributeDeclaration)
nsresult
-nsDOMCSSAttributeDeclaration::SetCSSDeclaration(css::Declaration* aDecl)
+nsDOMCSSAttributeDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
{
NS_ASSERTION(mElement, "Must have Element to set the declaration!");
- return
- mIsSMILOverride ? mElement->SetSMILOverrideStyleDeclaration(aDecl, true) :
- mElement->SetInlineStyleDeclaration(aDecl, nullptr, true);
+ return mIsSMILOverride
+ ? mElement->SetSMILOverrideStyleDeclaration(aDecl->AsGecko(), 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.
return mElement->OwnerDoc();
}
-css::Declaration*
+DeclarationBlock*
nsDOMCSSAttributeDeclaration::GetCSSDeclaration(Operation aOperation)
{
if (!mElement)
return nullptr;
- css::Declaration* declaration;
+ DeclarationBlock* declaration;
if (mIsSMILOverride) {
declaration = mElement->GetSMILOverrideStyleDeclaration();
} else {
- DeclarationBlock* decl = mElement->GetInlineStyleDeclaration();
- declaration = decl && decl->IsGecko() ? decl->AsGecko() : nullptr;
+ declaration = mElement->GetInlineStyleDeclaration();
}
// Notify observers that our style="" attribute is going to change
// unless:
// * this is a declaration that holds SMIL animation values (which
// aren't reflected in the DOM style="" attribute), or
// * we're getting the declaration for reading, or
// * we're getting it for property removal but we don't currently have
@@ -129,20 +128,21 @@ nsDOMCSSAttributeDeclaration::GetCSSDecl
}
// cannot fail
RefPtr<css::Declaration> decl = new css::Declaration();
decl->InitializeEmpty();
// this *can* fail (inside SetAttrAndNotify, at least).
nsresult rv;
- if (mIsSMILOverride)
+ if (mIsSMILOverride) {
rv = mElement->SetSMILOverrideStyleDeclaration(decl, false);
- else
+ } else {
rv = mElement->SetInlineStyleDeclaration(decl, nullptr, false);
+ }
if (NS_FAILED(rv)) {
return nullptr; // the decl will be destroyed along with the style rule
}
return decl;
}
--- a/layout/style/nsDOMCSSAttrDeclaration.h
+++ b/layout/style/nsDOMCSSAttrDeclaration.h
@@ -25,29 +25,29 @@ public:
nsDOMCSSAttributeDeclaration(Element* aContent, bool aIsSMILOverride);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMCSSAttributeDeclaration,
nsICSSDeclaration)
// If GetCSSDeclaration returns non-null, then the decl it returns
// is owned by our current style rule.
- virtual mozilla::css::Declaration* GetCSSDeclaration(Operation aOperation) override;
+ virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation aOperation) override;
virtual void GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv) override;
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent) override;
virtual nsINode* GetParentObject() override;
NS_IMETHOD SetPropertyValue(const nsCSSPropertyID aPropID,
const nsAString& aValue) override;
protected:
~nsDOMCSSAttributeDeclaration();
- virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) override;
+ virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl) override;
virtual nsIDocument* DocToUpdate() override;
RefPtr<Element> mElement;
/* If true, this indicates that this nsDOMCSSAttributeDeclaration
* should interact with mContent's SMIL override style rule (rather
* than the inline style rule).
*/
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -3,16 +3,17 @@
* 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/. */
/* base class for DOM objects for element.style and cssStyleRule.style */
#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/dom/CSS2PropertiesBinding.h"
#include "nsCSSProps.h"
#include "nsCOMPtr.h"
#include "mozAutoDocUpdate.h"
#include "nsIURI.h"
@@ -42,33 +43,33 @@ NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsDOMCSSDeclaration::GetPropertyValue(const nsCSSPropertyID aPropID,
nsAString& aValue)
{
NS_PRECONDITION(aPropID != eCSSProperty_UNKNOWN,
"Should never pass eCSSProperty_UNKNOWN around");
- css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
+ css::Declaration* decl = GetCSSDeclaration(eOperation_Read)->AsGecko();
aValue.Truncate();
if (decl) {
decl->GetValue(aPropID, aValue);
}
return NS_OK;
}
void
nsDOMCSSDeclaration::GetCustomPropertyValue(const nsAString& aPropertyName,
nsAString& aValue)
{
MOZ_ASSERT(Substring(aPropertyName, 0,
CSS_CUSTOM_NAME_PREFIX_LENGTH).EqualsLiteral("--"));
- css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
+ css::Declaration* decl = GetCSSDeclaration(eOperation_Read)->AsGecko();
if (!decl) {
aValue.Truncate();
return;
}
decl->GetVariableDeclaration(Substring(aPropertyName,
CSS_CUSTOM_NAME_PREFIX_LENGTH),
aValue);
@@ -110,32 +111,32 @@ nsDOMCSSDeclaration::SetPropertyValue(co
return ParsePropertyValue(aPropID, aValue, false);
}
NS_IMETHODIMP
nsDOMCSSDeclaration::GetCssText(nsAString& aCssText)
{
- css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
+ css::Declaration* decl = GetCSSDeclaration(eOperation_Read)->AsGecko();
aCssText.Truncate();
if (decl) {
decl->ToString(aCssText);
}
return NS_OK;
}
NS_IMETHODIMP
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.
- css::Declaration* olddecl = GetCSSDeclaration(eOperation_Modify);
+ css::Declaration* olddecl = GetCSSDeclaration(eOperation_Modify)->AsGecko();
if (!olddecl) {
return NS_ERROR_NOT_AVAILABLE;
}
CSSParsingEnvironment env;
GetCSSParsingEnvironment(env);
if (!env.mPrincipal) {
return NS_ERROR_NOT_AVAILABLE;
@@ -160,17 +161,17 @@ nsDOMCSSDeclaration::SetCssText(const ns
}
return SetCSSDeclaration(decl);
}
NS_IMETHODIMP
nsDOMCSSDeclaration::GetLength(uint32_t* aLength)
{
- css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
+ css::Declaration* decl = GetCSSDeclaration(eOperation_Read)->AsGecko();
if (decl) {
*aLength = decl->Count();
} else {
*aLength = 0;
}
return NS_OK;
@@ -182,17 +183,17 @@ nsDOMCSSDeclaration::GetPropertyCSSValue
// We don't support CSSValue yet so we'll just return null...
return nullptr;
}
void
nsDOMCSSDeclaration::IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName)
{
- css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
+ css::Declaration* decl = GetCSSDeclaration(eOperation_Read)->AsGecko();
aFound = decl && decl->GetNthProperty(aIndex, aPropName);
}
NS_IMETHODIMP
nsDOMCSSDeclaration::GetPropertyValue(const nsAString& aPropertyName,
nsAString& aReturn)
{
const nsCSSPropertyID propID =
@@ -221,30 +222,30 @@ nsDOMCSSDeclaration::GetAuthoredProperty
return NS_OK;
}
if (propID == eCSSPropertyExtra_variable) {
GetCustomPropertyValue(aPropertyName, aReturn);
return NS_OK;
}
- css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
+ css::Declaration* decl = GetCSSDeclaration(eOperation_Read)->AsGecko();
if (!decl) {
return NS_ERROR_FAILURE;
}
decl->GetAuthoredValue(propID, aReturn);
return NS_OK;
}
NS_IMETHODIMP
nsDOMCSSDeclaration::GetPropertyPriority(const nsAString& aPropertyName,
nsAString& aReturn)
{
- css::Declaration* decl = GetCSSDeclaration(eOperation_Read);
+ css::Declaration* decl = GetCSSDeclaration(eOperation_Read)->AsGecko();
aReturn.Truncate();
if (decl && decl->GetValueIsImportant(aPropertyName)) {
aReturn.AssignLiteral("important");
}
return NS_OK;
}
@@ -326,17 +327,17 @@ nsDOMCSSDeclaration::GetCSSParsingEnviro
aCSSParseEnv.mCSSLoader = document ? document->CSSLoader() : nullptr;
}
nsresult
nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSPropertyID aPropID,
const nsAString& aPropValue,
bool aIsImportant)
{
- css::Declaration* olddecl = GetCSSDeclaration(eOperation_Modify);
+ css::Declaration* olddecl = GetCSSDeclaration(eOperation_Modify)->AsGecko();
if (!olddecl) {
return NS_ERROR_NOT_AVAILABLE;
}
CSSParsingEnvironment env;
GetCSSParsingEnvironment(env);
if (!env.mPrincipal) {
return NS_ERROR_NOT_AVAILABLE;
@@ -364,17 +365,17 @@ nsDOMCSSDeclaration::ParsePropertyValue(
nsresult
nsDOMCSSDeclaration::ParseCustomPropertyValue(const nsAString& aPropertyName,
const nsAString& aPropValue,
bool aIsImportant)
{
MOZ_ASSERT(nsCSSProps::IsCustomPropertyName(aPropertyName));
- css::Declaration* olddecl = GetCSSDeclaration(eOperation_Modify);
+ css::Declaration* olddecl = GetCSSDeclaration(eOperation_Modify)->AsGecko();
if (!olddecl) {
return NS_ERROR_NOT_AVAILABLE;
}
CSSParsingEnvironment env;
GetCSSParsingEnvironment(env);
if (!env.mPrincipal) {
return NS_ERROR_NOT_AVAILABLE;
@@ -401,17 +402,18 @@ nsDOMCSSDeclaration::ParseCustomProperty
}
return SetCSSDeclaration(decl);
}
nsresult
nsDOMCSSDeclaration::RemoveProperty(const nsCSSPropertyID aPropID)
{
- css::Declaration* olddecl = GetCSSDeclaration(eOperation_RemoveProperty);
+ css::Declaration* olddecl =
+ GetCSSDeclaration(eOperation_RemoveProperty)->AsGecko();
if (!olddecl) {
return NS_OK; // no decl, so nothing to remove
}
// For nsDOMCSSAttributeDeclaration, SetCSSDeclaration will lead to
// Attribute setting code, which leads in turn to BeginUpdate. We
// need to start the update now so that the old rule doesn't get used
// between when we mutate the declaration and when we set the new
@@ -424,17 +426,18 @@ nsDOMCSSDeclaration::RemoveProperty(cons
}
nsresult
nsDOMCSSDeclaration::RemoveCustomProperty(const nsAString& aPropertyName)
{
MOZ_ASSERT(Substring(aPropertyName, 0,
CSS_CUSTOM_NAME_PREFIX_LENGTH).EqualsLiteral("--"));
- css::Declaration* olddecl = GetCSSDeclaration(eOperation_RemoveProperty);
+ css::Declaration* olddecl =
+ GetCSSDeclaration(eOperation_RemoveProperty)->AsGecko();
if (!olddecl) {
return NS_OK; // no decl, so nothing to remove
}
// For nsDOMCSSAttributeDeclaration, SetCSSDeclaration will lead to
// Attribute setting code, which leads in turn to BeginUpdate. We
// need to start the update now so that the old rule doesn't get used
// between when we mutate the declaration and when we set the new
--- a/layout/style/nsDOMCSSDeclaration.h
+++ b/layout/style/nsDOMCSSDeclaration.h
@@ -15,18 +15,18 @@
#include "nsCOMPtr.h"
class nsIPrincipal;
class nsIDocument;
struct JSContext;
class JSObject;
namespace mozilla {
+class DeclarationBlock;
namespace css {
-class Declaration;
class Loader;
class Rule;
} // namespace css
} // namespace mozilla
class nsDOMCSSDeclaration : public nsICSSDeclaration
{
public:
@@ -114,18 +114,18 @@ protected:
eOperation_Modify,
// We are calling GetCSSDeclaration so that we can remove a property from
// it. Does not allocates a new declaration if we don't have one yet;
// returns nullptr in this case. If we do have a declaration, calls
// AttributeWillChange.
eOperation_RemoveProperty
};
- virtual mozilla::css::Declaration* GetCSSDeclaration(Operation aOperation) = 0;
- virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) = 0;
+ virtual mozilla::DeclarationBlock* GetCSSDeclaration(Operation aOperation) = 0;
+ virtual nsresult SetCSSDeclaration(mozilla::DeclarationBlock* aDecl) = 0;
// Document that we must call BeginUpdate/EndUpdate on around the
// calls to SetCSSDeclaration and the style rule mutation that leads
// to it.
virtual nsIDocument* DocToUpdate() = 0;
// Information neded to parse a declaration. We need the mSheetURI
// for error reporting, mBaseURI to resolve relative URIs,
// mPrincipal for subresource loads, and mCSSLoader for determining