mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 569719 part 14: replace DeclarationChanged() with SetCSSDeclaration(), which takes the new declaration as an argument. r=dbaron
This commit is contained in:
parent
39c4539636
commit
d16aea72e1
@ -959,12 +959,12 @@ public:
|
||||
|
||||
NS_IMETHOD GetParentRule(nsIDOMCSSRule **aParent);
|
||||
void DropReference(void);
|
||||
virtual mozilla::css::Declaration* GetCSSDeclaration(PRBool aAllocate);
|
||||
virtual css::Declaration* GetCSSDeclaration(PRBool aAllocate);
|
||||
virtual nsresult SetCSSDeclaration(css::Declaration* aDecl);
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI** aSheetURI,
|
||||
nsIURI** aBaseURI,
|
||||
nsIPrincipal** aSheetPrincipal,
|
||||
mozilla::css::Loader** aCSSLoader);
|
||||
virtual nsresult DeclarationChanged();
|
||||
virtual nsIDocument* DocToUpdate();
|
||||
|
||||
// Override |AddRef| and |Release| for being a member of
|
||||
@ -1116,7 +1116,7 @@ DOMCSSDeclarationImpl::GetParentRule(nsIDOMCSSRule **aParent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
DOMCSSDeclarationImpl::DeclarationChanged()
|
||||
DOMCSSDeclarationImpl::SetCSSDeclaration(css::Declaration* aDecl)
|
||||
{
|
||||
NS_PRECONDITION(mRule,
|
||||
"can only be called when |GetCSSDeclaration| returned a declaration");
|
||||
@ -1130,7 +1130,7 @@ DOMCSSDeclarationImpl::DeclarationChanged()
|
||||
mozAutoDocUpdate updateBatch(owningDoc, UPDATE_STYLE, PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsICSSStyleRule> oldRule = mRule;
|
||||
mRule = oldRule->DeclarationChanged(PR_TRUE).get();
|
||||
mRule = oldRule->DeclarationChanged(aDecl, PR_TRUE).get();
|
||||
if (!mRule)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsrefcnt cnt = mRule->Release();
|
||||
@ -1311,7 +1311,7 @@ public:
|
||||
nsIDOMCSSRule* GetDOMRuleWeak(nsresult* aResult);
|
||||
|
||||
virtual already_AddRefed<nsICSSStyleRule>
|
||||
DeclarationChanged(PRBool aHandleContainer);
|
||||
DeclarationChanged(css::Declaration* aDecl, PRBool aHandleContainer);
|
||||
|
||||
// The new mapping function.
|
||||
virtual void MapRuleInfoInto(nsRuleData* aRuleData);
|
||||
@ -1362,7 +1362,7 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(const CSSStyleRuleImpl& aCopy)
|
||||
// rest is constructed lazily on existing data
|
||||
}
|
||||
|
||||
// for |DeclarationChanged|
|
||||
// for |SetCSSDeclaration|
|
||||
CSSStyleRuleImpl::CSSStyleRuleImpl(CSSStyleRuleImpl& aCopy,
|
||||
css::Declaration* aDeclaration)
|
||||
: nsCSSRule(aCopy),
|
||||
@ -1376,7 +1376,6 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(CSSStyleRuleImpl& aCopy,
|
||||
// the reverse pointer as well (and transfer ownership).
|
||||
aCopy.mDOMRule = nsnull;
|
||||
|
||||
NS_ASSERTION(aDeclaration == aCopy.mDeclaration, "declaration mismatch");
|
||||
// Transfer ownership of selector and declaration:
|
||||
// NOTE that transferring ownership of the declaration relies on the
|
||||
// code in RuleMatched caching what we need from mDeclaration so that
|
||||
@ -1387,11 +1386,14 @@ CSSStyleRuleImpl::CSSStyleRuleImpl(CSSStyleRuleImpl& aCopy,
|
||||
// necessary data blocks from its declaration, so any later
|
||||
// MapRuleInfoInto calls (see stack in bug 209575; also needed for CSS
|
||||
// Transitions) and GetImportantRule calls will also work.
|
||||
if (mDeclaration != aCopy.mDeclaration) {
|
||||
NS_ADDREF(mDeclaration);
|
||||
NS_RELEASE(aCopy.mDeclaration);
|
||||
}
|
||||
aCopy.mSelector = nsnull;
|
||||
aCopy.mDeclaration = nsnull;
|
||||
}
|
||||
|
||||
|
||||
CSSStyleRuleImpl::~CSSStyleRuleImpl(void)
|
||||
{
|
||||
if (mSelector) {
|
||||
@ -1524,9 +1526,10 @@ CSSStyleRuleImpl::GetDOMRuleWeak(nsresult *aResult)
|
||||
}
|
||||
|
||||
/* virtual */ already_AddRefed<nsICSSStyleRule>
|
||||
CSSStyleRuleImpl::DeclarationChanged(PRBool aHandleContainer)
|
||||
CSSStyleRuleImpl::DeclarationChanged(css::Declaration* aDecl,
|
||||
PRBool aHandleContainer)
|
||||
{
|
||||
CSSStyleRuleImpl* clone = new CSSStyleRuleImpl(*this, mDeclaration);
|
||||
CSSStyleRuleImpl* clone = new CSSStyleRuleImpl(*this, aDecl);
|
||||
if (!clone) {
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -418,9 +418,9 @@ nsComputedDOMStyle::GetCSSDeclaration(PRBool)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::DeclarationChanged()
|
||||
nsComputedDOMStyle::SetCSSDeclaration(css::Declaration*)
|
||||
{
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::DeclarationChanged");
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::SetCSSDeclaration");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -433,7 +433,7 @@ nsComputedDOMStyle::DocToUpdate()
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetCSSParsingEnvironment(nsIURI**, nsIURI**, nsIPrincipal**,
|
||||
mozilla::css::Loader**)
|
||||
css::Loader**)
|
||||
{
|
||||
NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSParsingEnvironment");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
// on a nsComputedDOMStyle object, but must be defined to avoid
|
||||
// compile errors.
|
||||
virtual mozilla::css::Declaration* GetCSSDeclaration(PRBool);
|
||||
virtual nsresult DeclarationChanged();
|
||||
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration*);
|
||||
virtual nsIDocument* DocToUpdate();
|
||||
virtual nsresult GetCSSParsingEnvironment(nsIURI**, nsIURI**, nsIPrincipal**,
|
||||
mozilla::css::Loader**);
|
||||
|
@ -85,7 +85,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSAttributeDeclaration)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSAttributeDeclaration)
|
||||
|
||||
nsresult
|
||||
nsDOMCSSAttributeDeclaration::DeclarationChanged()
|
||||
nsDOMCSSAttributeDeclaration::SetCSSDeclaration(css::Declaration* aDecl)
|
||||
{
|
||||
NS_ASSERTION(mContent, "Must have content node to set the decl!");
|
||||
nsICSSStyleRule* oldRule =
|
||||
@ -95,7 +95,8 @@ nsDOMCSSAttributeDeclaration::DeclarationChanged()
|
||||
mContent->GetInlineStyleRule();
|
||||
NS_ASSERTION(oldRule, "content must have rule");
|
||||
|
||||
nsCOMPtr<nsICSSStyleRule> newRule = oldRule->DeclarationChanged(PR_FALSE);
|
||||
nsCOMPtr<nsICSSStyleRule> newRule =
|
||||
oldRule->DeclarationChanged(aDecl, PR_FALSE);
|
||||
if (!newRule) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual nsresult DeclarationChanged();
|
||||
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl);
|
||||
virtual nsIDocument* DocToUpdate();
|
||||
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
|
@ -137,7 +137,7 @@ nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText)
|
||||
return result;
|
||||
}
|
||||
|
||||
// For nsDOMCSSAttributeDeclaration, DeclarationChanged will lead to
|
||||
// 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
|
||||
@ -152,7 +152,7 @@ nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText)
|
||||
return result;
|
||||
}
|
||||
|
||||
return DeclarationChanged();
|
||||
return SetCSSDeclaration(decl);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -290,7 +290,7 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
|
||||
return result;
|
||||
}
|
||||
|
||||
// For nsDOMCSSAttributeDeclaration, DeclarationChanged will lead to
|
||||
// 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
|
||||
@ -306,7 +306,7 @@ nsDOMCSSDeclaration::ParsePropertyValue(const nsCSSProperty aPropID,
|
||||
return result;
|
||||
}
|
||||
|
||||
return DeclarationChanged();
|
||||
return SetCSSDeclaration(decl);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -317,7 +317,7 @@ nsDOMCSSDeclaration::RemoveProperty(const nsCSSProperty aPropID)
|
||||
return NS_OK; // no decl, so nothing to remove
|
||||
}
|
||||
|
||||
// For nsDOMCSSAttributeDeclaration, DeclarationChanged will lead to
|
||||
// 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
|
||||
@ -325,7 +325,7 @@ nsDOMCSSDeclaration::RemoveProperty(const nsCSSProperty aPropID)
|
||||
mozAutoDocConditionalContentUpdateBatch autoUpdate(DocToUpdate(), PR_TRUE);
|
||||
|
||||
decl->RemoveProperty(aPropID);
|
||||
return DeclarationChanged();
|
||||
return SetCSSDeclaration(decl);
|
||||
}
|
||||
|
||||
// nsIDOMCSS2Properties
|
||||
|
@ -95,9 +95,9 @@ protected:
|
||||
// however, a null return should only be considered a failure
|
||||
// if aAllocate is true.
|
||||
virtual mozilla::css::Declaration* GetCSSDeclaration(PRBool aAllocate) = 0;
|
||||
virtual nsresult DeclarationChanged() = 0;
|
||||
virtual nsresult SetCSSDeclaration(mozilla::css::Declaration* aDecl) = 0;
|
||||
// Document that we must call BeginUpdate/EndUpdate on around the
|
||||
// calls to DeclarationChanged and the style rule mutation that leads
|
||||
// calls to SetCSSDeclaration and the style rule mutation that leads
|
||||
// to it.
|
||||
virtual nsIDocument* DocToUpdate() = 0;
|
||||
|
||||
|
@ -292,11 +292,10 @@ private:
|
||||
nsCSSSelectorList& operator=(const nsCSSSelectorList& aCopy);
|
||||
};
|
||||
|
||||
// 86354e96-99a5-4e73-89ad-e17f7771c47b
|
||||
// 0512253d-ff15-45e7-abe8-f086ddb56762
|
||||
#define NS_ICSS_STYLE_RULE_IID \
|
||||
{ 0x86354e96, 0x99a5, 0x4e73, \
|
||||
{ 0x89, 0xad, 0xe1, 0x7f, 0x77, 0x71, 0xc4, 0x7b } }
|
||||
|
||||
{ 0x0512253d, 0xff15, 0x45e7, \
|
||||
{ 0xab, 0xe8, 0xf0, 0x86, 0xdd, 0xb5, 0x67, 0x62 } }
|
||||
|
||||
class nsICSSStyleRule : public nsICSSRule {
|
||||
public:
|
||||
@ -311,16 +310,17 @@ public:
|
||||
virtual mozilla::css::Declaration* GetDeclaration(void) const = 0;
|
||||
|
||||
/**
|
||||
* Return a new |nsIStyleRule| instance that replaces the current one,
|
||||
* due to a change in the declaration. Due to the |nsIStyleRule|
|
||||
* contract of immutability, this must be called if the declaration
|
||||
* is modified.
|
||||
* Return a new |nsIStyleRule| instance that replaces the current
|
||||
* one, with |aDecl| replacing the previous declaration. Due to the
|
||||
* |nsIStyleRule| contract of immutability, this must be called if
|
||||
* the declaration is modified.
|
||||
*
|
||||
* |DeclarationChanged| handles replacing the object in the container
|
||||
* sheet or group rule if |aHandleContainer| is true.
|
||||
*/
|
||||
virtual already_AddRefed<nsICSSStyleRule>
|
||||
DeclarationChanged(PRBool aHandleContainer) = 0;
|
||||
DeclarationChanged(mozilla::css::Declaration* aDecl,
|
||||
PRBool aHandleContainer) = 0;
|
||||
|
||||
/**
|
||||
* The rule processor must call this method before calling
|
||||
|
Loading…
Reference in New Issue
Block a user