Bug 577976 - Part 5: Remove AddRef from GetStyleSheet, r=bzbarsky

This commit is contained in:
Craig Topper 2010-08-07 22:33:15 -07:00
Родитель 5d21e90225
Коммит 247eec6f18
5 изменённых файлов: 7 добавлений и 16 удалений

Просмотреть файл

@ -83,7 +83,7 @@ protected:
NS_DECL_OWNINGTHREAD
public:
virtual already_AddRefed<nsIStyleSheet> GetStyleSheet() const;
virtual nsIStyleSheet* GetStyleSheet() const;
virtual void SetStyleSheet(nsCSSStyleSheet* aSheet);
virtual void SetParentRule(GroupRule* aRule);

Просмотреть файл

@ -1074,9 +1074,8 @@ DOMCSSDeclarationImpl::GetCSSParsingEnvironment(nsIURI** aSheetURI,
*aSheetPrincipal = nsnull;
*aCSSLoader = nsnull;
nsCOMPtr<nsIStyleSheet> sheet;
if (mRule) {
sheet = mRule->GetStyleSheet();
nsIStyleSheet* sheet = mRule->GetStyleSheet();
if (sheet) {
NS_IF_ADDREF(*aSheetURI = sheet->GetSheetURI());
NS_IF_ADDREF(*aBaseURI = sheet->GetBaseURI());

Просмотреть файл

@ -86,10 +86,9 @@ namespace css {
NS_IMPL_ADDREF(Rule)
NS_IMPL_RELEASE(Rule)
/* virtual */ already_AddRefed<nsIStyleSheet>
/* virtual */ nsIStyleSheet*
Rule::GetStyleSheet() const
{
NS_IF_ADDREF(mSheet);
return mSheet;
}

Просмотреть файл

@ -1943,8 +1943,7 @@ nsCSSStyleSheet::DeleteRuleFromGroup(css::GroupRule* aGroup, PRUint32 aIndex)
NS_ENSURE_TRUE(rule, NS_ERROR_ILLEGAL_VALUE);
// check that the rule actually belongs to this sheet!
nsCOMPtr<nsIStyleSheet> ruleSheet = rule->GetStyleSheet();
if (this != ruleSheet) {
if (this != rule->GetStyleSheet()) {
return NS_ERROR_INVALID_ARG;
}
@ -1976,8 +1975,7 @@ nsCSSStyleSheet::InsertRuleIntoGroup(const nsAString & aRule,
nsresult result;
NS_ASSERTION(mInner->mComplete, "No inserting into an incomplete sheet!");
// check that the group actually belongs to this sheet!
nsCOMPtr<nsIStyleSheet> groupSheet = aGroup->GetStyleSheet();
if (this != groupSheet) {
if (this != aGroup->GetStyleSheet()) {
return NS_ERROR_INVALID_ARG;
}
@ -2047,12 +2045,7 @@ nsCSSStyleSheet::ReplaceRuleInGroup(css::GroupRule* aGroup,
{
nsresult result;
NS_PRECONDITION(mInner->mComplete, "No replacing in an incomplete sheet!");
#ifdef DEBUG
{
nsCOMPtr<nsIStyleSheet> groupSheet = aGroup->GetStyleSheet();
NS_ASSERTION(this == groupSheet, "group doesn't belong to this sheet");
}
#endif
NS_ASSERTION(this == aGroup->GetStyleSheet(), "group doesn't belong to this sheet");
result = WillDirty();
NS_ENSURE_SUCCESS(result, result);

Просмотреть файл

@ -83,7 +83,7 @@ public:
virtual PRInt32 GetType() const = 0;
virtual already_AddRefed<nsIStyleSheet> GetStyleSheet() const = 0;
virtual nsIStyleSheet* GetStyleSheet() const = 0;
virtual void SetStyleSheet(nsCSSStyleSheet* aSheet) = 0;
virtual void SetParentRule(mozilla::css::GroupRule* aRule) = 0;