Fix for 73695. r=danm, sr=waterson
git-svn-id: svn://10.0.0.236/trunk@90721 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -20,6 +20,9 @@ class nsIStyleRuleSupplier : public nsISupports {
|
||||
nsISupportsArrayEnumFunc aFunc, void* aData,
|
||||
nsIContent* aContent)=0;
|
||||
NS_IMETHOD MatchesScopedRoot(nsIContent* aContent, PRBool* aResult)=0;
|
||||
|
||||
NS_IMETHOD AttributeAffectsStyle(nsISupportsArrayEnumFunc aFunc, void* aData, nsIContent* aContent,
|
||||
PRBool* aAffects)=0;
|
||||
};
|
||||
|
||||
#endif /* _nsIStyleRuleSupplier_h */
|
||||
|
||||
@@ -1937,15 +1937,22 @@ StyleSetImpl::AttributeAffectsStyle(nsIAtom *aAttribute, nsIContent *aContent,
|
||||
pair.attribute = aAttribute;
|
||||
pair.content = aContent;
|
||||
|
||||
/* check until we find a sheet that will be affected */
|
||||
if ((mDocSheets && !mDocSheets->EnumerateForwards(EnumAffectsStyle, &pair)) ||
|
||||
(mOverrideSheets && !mOverrideSheets->EnumerateForwards(EnumAffectsStyle,
|
||||
&pair)) ||
|
||||
(mBackstopSheets && !mBackstopSheets->EnumerateForwards(EnumAffectsStyle,
|
||||
&pair))) {
|
||||
aAffects = PR_TRUE;
|
||||
} else {
|
||||
aAffects = PR_FALSE;
|
||||
/* scoped sheets should be checked first, since - if present - they will contain
|
||||
the bulk of the applicable rules for the content node. */
|
||||
if (mStyleRuleSupplier)
|
||||
mStyleRuleSupplier->AttributeAffectsStyle(EnumAffectsStyle, &pair, aContent, &aAffects);
|
||||
|
||||
if (!aAffects) {
|
||||
/* check until we find a sheet that will be affected */
|
||||
if ((mDocSheets && !mDocSheets->EnumerateForwards(EnumAffectsStyle, &pair)) ||
|
||||
(mOverrideSheets && !mOverrideSheets->EnumerateForwards(EnumAffectsStyle,
|
||||
&pair)) ||
|
||||
(mBackstopSheets && !mBackstopSheets->EnumerateForwards(EnumAffectsStyle,
|
||||
&pair))) {
|
||||
aAffects = PR_TRUE;
|
||||
} else {
|
||||
aAffects = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@@ -102,6 +102,7 @@ public:
|
||||
|
||||
NS_IMETHOD InheritsStyle(PRBool* aResult)=0;
|
||||
NS_IMETHOD WalkRules(nsISupportsArrayEnumFunc aFunc, void* aData)=0;
|
||||
NS_IMETHOD AttributeAffectsStyle(nsISupportsArrayEnumFunc aFunc, void* aData, PRBool* aAffects)=0;
|
||||
|
||||
NS_IMETHOD MarkForDeath()=0;
|
||||
NS_IMETHOD MarkedForDeath(PRBool* aResult)=0;
|
||||
|
||||
@@ -77,6 +77,7 @@ public:
|
||||
NS_IMETHOD SetInitialAttributes(nsIContent* aBoundElement, nsIContent* aAnonymousContent)=0;
|
||||
|
||||
NS_IMETHOD GetRuleProcessors(nsISupportsArray** aResult)=0;
|
||||
NS_IMETHOD GetStyleSheets(nsISupportsArray** aResult)=0;
|
||||
|
||||
NS_IMETHOD HasInsertionPoints(PRBool* aResult)=0;
|
||||
NS_IMETHOD HasStyleSheets(PRBool* aResult)=0;
|
||||
|
||||
@@ -348,6 +348,7 @@ public:
|
||||
nsISupportsArrayEnumFunc aFunc, void* aData,
|
||||
nsIContent* aContent);
|
||||
NS_IMETHOD MatchesScopedRoot(nsIContent* aContent, PRBool* aResult);
|
||||
NS_IMETHOD AttributeAffectsStyle(nsISupportsArrayEnumFunc aFunc, void* aData, nsIContent* aContent, PRBool* aAffects);
|
||||
|
||||
// nsIDocumentObserver
|
||||
NS_IMETHOD BeginUpdate(nsIDocument* aDocument) { return NS_OK; }
|
||||
@@ -411,6 +412,9 @@ protected:
|
||||
void WalkRules(nsISupportsArrayEnumFunc aFunc, void* aData,
|
||||
nsIContent* aParent, nsIContent* aCurrContent);
|
||||
|
||||
void AttributeAffectsStyle(nsISupportsArrayEnumFunc aFunc, void* aData,
|
||||
nsIContent* aParent, nsIContent* aCurrContent, PRBool* aAffects);
|
||||
|
||||
nsresult GetNestedInsertionPoint(nsIContent* aParent, nsIContent* aChild, nsIContent** aResult);
|
||||
|
||||
// MEMBER VARIABLES
|
||||
@@ -1246,6 +1250,47 @@ nsBindingManager::WalkRules(nsIStyleSet* aStyleSet,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsBindingManager::AttributeAffectsStyle(nsISupportsArrayEnumFunc aFunc, void* aData,
|
||||
nsIContent* aParent, nsIContent* aCurrContent, PRBool* aAffects)
|
||||
{
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
GetBinding(aCurrContent, getter_AddRefs(binding));
|
||||
if (binding) {
|
||||
binding->AttributeAffectsStyle(aFunc, aData, aAffects);
|
||||
}
|
||||
|
||||
if (*aAffects)
|
||||
return;
|
||||
|
||||
if (aParent != aCurrContent) {
|
||||
nsCOMPtr<nsIContent> par;
|
||||
GetEnclosingScope(aCurrContent, getter_AddRefs(par));
|
||||
if (par)
|
||||
AttributeAffectsStyle(aFunc, aData, aParent, par, aAffects);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBindingManager::AttributeAffectsStyle(nsISupportsArrayEnumFunc aFunc, void* aData,
|
||||
nsIContent* aContent, PRBool* aAffects)
|
||||
{
|
||||
*aAffects = PR_FALSE;
|
||||
if (!aContent)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIContent> parent;
|
||||
GetOutermostStyleScope(aContent, getter_AddRefs(parent));
|
||||
|
||||
AttributeAffectsStyle(aFunc, aData, parent, aContent, aAffects);
|
||||
|
||||
if (*aAffects)
|
||||
return NS_OK;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBindingManager::ShouldBuildChildFrames(nsIContent* aContent, PRBool* aResult)
|
||||
{
|
||||
|
||||
@@ -1490,6 +1490,31 @@ nsXBLBinding::WalkRules(nsISupportsArrayEnumFunc aFunc, void* aData)
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLBinding::AttributeAffectsStyle(nsISupportsArrayEnumFunc aFunc, void* aData, PRBool* aAffects)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (mNextBinding) {
|
||||
rv = mNextBinding->AttributeAffectsStyle(aFunc, aData, aAffects);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (*aAffects)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupportsArray> sheets;
|
||||
mPrototypeBinding->GetStyleSheets(getter_AddRefs(sheets));
|
||||
if (sheets) {
|
||||
if (!sheets->EnumerateForwards(aFunc, aData))
|
||||
*aAffects = PR_TRUE;
|
||||
else
|
||||
*aAffects = PR_FALSE;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Internal helper methods ////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
@@ -95,6 +95,7 @@ class nsXBLBinding: public nsIXBLBinding
|
||||
|
||||
NS_IMETHOD InheritsStyle(PRBool* aResult);
|
||||
NS_IMETHOD WalkRules(nsISupportsArrayEnumFunc aFunc, void* aData);
|
||||
NS_IMETHOD AttributeAffectsStyle(nsISupportsArrayEnumFunc aFunc, void* aData, PRBool* aAffects);
|
||||
|
||||
NS_IMETHOD MarkForDeath();
|
||||
NS_IMETHOD MarkedForDeath(PRBool* aResult);
|
||||
|
||||
@@ -1043,6 +1043,14 @@ nsXBLPrototypeBinding::GetRuleProcessors(nsISupportsArray** aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeBinding::GetStyleSheets(nsISupportsArray** aResult)
|
||||
{
|
||||
*aResult = mStyleSheetList;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeBinding::ShouldBuildChildFrames(PRBool* aResult)
|
||||
{
|
||||
|
||||
@@ -81,6 +81,7 @@ class nsXBLPrototypeBinding: public nsIXBLPrototypeBinding, public nsICSSLoaderO
|
||||
NS_IMETHOD SetInitialAttributes(nsIContent* aBoundElement, nsIContent* aAnonymousContent);
|
||||
|
||||
NS_IMETHOD GetRuleProcessors(nsISupportsArray** aResult);
|
||||
NS_IMETHOD GetStyleSheets(nsISupportsArray** aResult);
|
||||
|
||||
NS_IMETHOD HasInsertionPoints(PRBool* aResult) { *aResult = (mInsertionPointTable != nsnull); return NS_OK; };
|
||||
NS_IMETHOD HasStyleSheets(PRBool* aResult) { *aResult = (mStyleSheetList != nsnull); return NS_OK; };
|
||||
|
||||
@@ -20,6 +20,9 @@ class nsIStyleRuleSupplier : public nsISupports {
|
||||
nsISupportsArrayEnumFunc aFunc, void* aData,
|
||||
nsIContent* aContent)=0;
|
||||
NS_IMETHOD MatchesScopedRoot(nsIContent* aContent, PRBool* aResult)=0;
|
||||
|
||||
NS_IMETHOD AttributeAffectsStyle(nsISupportsArrayEnumFunc aFunc, void* aData, nsIContent* aContent,
|
||||
PRBool* aAffects)=0;
|
||||
};
|
||||
|
||||
#endif /* _nsIStyleRuleSupplier_h */
|
||||
|
||||
@@ -1937,15 +1937,22 @@ StyleSetImpl::AttributeAffectsStyle(nsIAtom *aAttribute, nsIContent *aContent,
|
||||
pair.attribute = aAttribute;
|
||||
pair.content = aContent;
|
||||
|
||||
/* check until we find a sheet that will be affected */
|
||||
if ((mDocSheets && !mDocSheets->EnumerateForwards(EnumAffectsStyle, &pair)) ||
|
||||
(mOverrideSheets && !mOverrideSheets->EnumerateForwards(EnumAffectsStyle,
|
||||
&pair)) ||
|
||||
(mBackstopSheets && !mBackstopSheets->EnumerateForwards(EnumAffectsStyle,
|
||||
&pair))) {
|
||||
aAffects = PR_TRUE;
|
||||
} else {
|
||||
aAffects = PR_FALSE;
|
||||
/* scoped sheets should be checked first, since - if present - they will contain
|
||||
the bulk of the applicable rules for the content node. */
|
||||
if (mStyleRuleSupplier)
|
||||
mStyleRuleSupplier->AttributeAffectsStyle(EnumAffectsStyle, &pair, aContent, &aAffects);
|
||||
|
||||
if (!aAffects) {
|
||||
/* check until we find a sheet that will be affected */
|
||||
if ((mDocSheets && !mDocSheets->EnumerateForwards(EnumAffectsStyle, &pair)) ||
|
||||
(mOverrideSheets && !mOverrideSheets->EnumerateForwards(EnumAffectsStyle,
|
||||
&pair)) ||
|
||||
(mBackstopSheets && !mBackstopSheets->EnumerateForwards(EnumAffectsStyle,
|
||||
&pair))) {
|
||||
aAffects = PR_TRUE;
|
||||
} else {
|
||||
aAffects = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
Reference in New Issue
Block a user