зеркало из https://github.com/mozilla/pjs.git
Tweak loadBindings call, provide hint to optimize possible style re-resolve in XBL, fix spot dbaron forgot. All 3 are r=ben
This commit is contained in:
Родитель
c283db726b
Коммит
3ade57d231
|
@ -1695,14 +1695,15 @@ nsGenericElement::GetScriptObject(nsIScriptContext* aContext,
|
|||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mContent));
|
||||
viewCSS->GetComputedStyle(elt, empty, getter_AddRefs(cssDecl));
|
||||
if (cssDecl) {
|
||||
nsAutoString behavior; behavior.Assign(NS_LITERAL_STRING("behavior"));
|
||||
nsAutoString behavior; behavior.Assign(NS_LITERAL_STRING("-moz-binding"));
|
||||
nsAutoString value;
|
||||
cssDecl->GetPropertyValue(behavior, value);
|
||||
if (!value.IsEmpty()) {
|
||||
// We have a binding that must be installed.
|
||||
nsresult rv;
|
||||
PRBool dummy;
|
||||
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
|
||||
xblService->LoadBindings(mContent, value, PR_FALSE, getter_AddRefs(binding));
|
||||
xblService->LoadBindings(mContent, value, PR_FALSE, getter_AddRefs(binding), &dummy);
|
||||
if (binding) {
|
||||
binding->ExecuteAttachedHandler();
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ public:
|
|||
NS_IMETHOD InstallEventHandlers(nsIContent* aBoundElement, nsIXBLBinding** aBinding) = 0;
|
||||
NS_IMETHOD InstallProperties(nsIContent* aBoundElement) = 0;
|
||||
|
||||
NS_IMETHOD HasStyleSheets(PRBool* aResolveStyle) = 0;
|
||||
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNameSpaceID, nsIAtom** aResult) = 0;
|
||||
|
||||
// Called when an attribute changes on a binding.
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element.
|
||||
NS_IMETHOD LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag,
|
||||
nsIXBLBinding** aBinding) = 0;
|
||||
nsIXBLBinding** aBinding, PRBool* aResolveStyle) = 0;
|
||||
|
||||
// This function clears out the bindings on a given content node.
|
||||
NS_IMETHOD FlushStyleBindings(nsIContent* aContent) = 0;
|
||||
|
|
|
@ -360,7 +360,8 @@ nsBindingManager::AddLayeredBinding(nsIContent* aContent, const nsAReadableStrin
|
|||
|
||||
// Load the bindings.
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
xblService->LoadBindings(aContent, aURL, PR_TRUE, getter_AddRefs(binding));
|
||||
PRBool dummy;
|
||||
xblService->LoadBindings(aContent, aURL, PR_TRUE, getter_AddRefs(binding), &dummy);
|
||||
if (binding) {
|
||||
AddToAttachedQueue(binding);
|
||||
ProcessAttachedQueue();
|
||||
|
|
|
@ -472,6 +472,27 @@ nsXBLBinding::SetBoundElement(nsIContent* aElement)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLBinding::HasStyleSheets(PRBool* aResolveStyle)
|
||||
{
|
||||
// Find out if we need to re-resolve style. We'll need to do this
|
||||
// if we have additional stylesheets in our binding document.
|
||||
nsCOMPtr<nsIXBLDocumentInfo> info;
|
||||
gXBLService->GetXBLDocumentInfo(mDocURI, mBoundElement, getter_AddRefs(info));
|
||||
if (!info)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
info->GetRuleProcessors(getter_AddRefs(rules));
|
||||
if (rules) {
|
||||
*aResolveStyle = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mNextBinding)
|
||||
return mNextBinding->HasStyleSheets(aResolveStyle);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement)
|
||||
{
|
||||
|
@ -1241,20 +1262,23 @@ nsXBLBinding::InheritsStyle(PRBool* aResult)
|
|||
NS_IMETHODIMP
|
||||
nsXBLBinding::WalkRules(nsISupportsArrayEnumFunc aFunc, void* aData)
|
||||
{
|
||||
if (mContent) {
|
||||
nsCOMPtr<nsIXBLDocumentInfo> info;
|
||||
gXBLService->GetXBLDocumentInfo(mDocURI, mBoundElement, getter_AddRefs(info));
|
||||
if (!info)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
info->GetRuleProcessors(getter_AddRefs(rules));
|
||||
if (rules)
|
||||
rules->EnumerateForwards(aFunc, aData);
|
||||
nsresult rv = NS_OK;
|
||||
if (mNextBinding) {
|
||||
rv = mNextBinding->WalkRules(aFunc, aData);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
else if (mNextBinding)
|
||||
return mNextBinding->WalkRules(aFunc, aData);
|
||||
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIXBLDocumentInfo> info;
|
||||
gXBLService->GetXBLDocumentInfo(mDocURI, mBoundElement, getter_AddRefs(info));
|
||||
if (!info)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
info->GetRuleProcessors(getter_AddRefs(rules));
|
||||
if (rules)
|
||||
rules->EnumerateForwards(aFunc, aData);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Internal helper methods ////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -58,6 +58,8 @@ class nsXBLBinding: public nsIXBLBinding
|
|||
NS_IMETHOD InstallEventHandlers(nsIContent* aBoundElement, nsIXBLBinding** aBinding);
|
||||
NS_IMETHOD InstallProperties(nsIContent* aBoundElement);
|
||||
|
||||
NS_IMETHOD HasStyleSheets(PRBool* aResolveStyle);
|
||||
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceID, PRBool aRemoveFlag);
|
||||
|
|
|
@ -590,9 +590,10 @@ nsXBLService::~nsXBLService(void)
|
|||
// onto the element.
|
||||
NS_IMETHODIMP
|
||||
nsXBLService::LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag,
|
||||
nsIXBLBinding** aBinding)
|
||||
nsIXBLBinding** aBinding, PRBool* aResolveStyle)
|
||||
{
|
||||
*aBinding = nsnull;
|
||||
*aResolveStyle = PR_FALSE;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
@ -681,6 +682,8 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsAReadableString& aURL,
|
|||
// Set up our properties
|
||||
newBinding->InstallProperties(aContent);
|
||||
|
||||
newBinding->HasStyleSheets(aResolveStyle);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class nsXBLService : public nsIXBLService, public nsIMemoryPressureObserver
|
|||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element.
|
||||
NS_IMETHOD LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag,
|
||||
nsIXBLBinding** aBinding);
|
||||
nsIXBLBinding** aBinding, PRBool* aResolveStyle);
|
||||
|
||||
// This method loads a binding doc and then builds the specific binding required.
|
||||
NS_IMETHOD GetBinding(nsIContent* aBoundElement, const nsCString& aURLStr, nsIXBLBinding** aResult);
|
||||
|
|
|
@ -5236,7 +5236,8 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
|
|||
|
||||
// Load the bindings.
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
rv = xblService->LoadBindings(aParent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding));
|
||||
PRBool dummy;
|
||||
rv = xblService->LoadBindings(aParent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding), &dummy);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -5470,7 +5471,8 @@ nsCSSFrameConstructor::CreateAnonymousTableCellFrames(nsIPresShell* aPres
|
|||
|
||||
// Load the bindings.
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
rv = xblService->LoadBindings(aParent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding));
|
||||
PRBool dummy;
|
||||
rv = xblService->LoadBindings(aParent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding), &dummy);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -7414,6 +7416,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
// The following code allows the user to specify the base tag
|
||||
// of a XUL object using XBL. XUL objects (like boxes, menus, etc.)
|
||||
// can then be extended arbitrarily.
|
||||
nsCOMPtr<nsIStyleContext> styleContext(do_QueryInterface(aStyleContext));
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
if (!aXBLBaseTag)
|
||||
{
|
||||
|
@ -7429,10 +7432,17 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
return rv;
|
||||
|
||||
// Load the bindings.
|
||||
rv = xblService->LoadBindings(aContent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding));
|
||||
PRBool resolveStyle;
|
||||
rv = xblService->LoadBindings(aContent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding), &resolveStyle);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
if (resolveStyle) {
|
||||
rv = ResolveStyleContext(aPresContext, aParentFrame, aContent, aTag, getter_AddRefs(styleContext));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> baseTag;
|
||||
PRInt32 nameSpaceID;
|
||||
xblService->ResolveTag(aContent, &nameSpaceID, getter_AddRefs(baseTag));
|
||||
|
@ -7446,7 +7456,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
aParentFrame,
|
||||
baseTag,
|
||||
nameSpaceID,
|
||||
aStyleContext,
|
||||
styleContext,
|
||||
aFrameItems,
|
||||
PR_TRUE);
|
||||
if (binding) {
|
||||
|
@ -7465,7 +7475,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
|
||||
// Handle specific frame types
|
||||
nsresult rv = ConstructFrameByTag(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, styleContext, aFrameItems);
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
// Failing to find a matching HTML frame, try creating a specialized
|
||||
|
@ -7475,7 +7485,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
(lastChild == aFrameItems.lastChild))) {
|
||||
PRBool haltProcessing = PR_FALSE;
|
||||
rv = ConstructXULFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems, haltProcessing);
|
||||
aTag, aNameSpaceID, styleContext, aFrameItems, haltProcessing);
|
||||
if (haltProcessing) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -7487,7 +7497,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
|
||||
(lastChild == aFrameItems.lastChild))) {
|
||||
rv = ConstructMathMLFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, styleContext, aFrameItems);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -7496,7 +7506,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
|
||||
(lastChild == aFrameItems.lastChild))) {
|
||||
rv = ConstructSVGFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, styleContext, aFrameItems);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -7505,10 +7515,10 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
// When there is no explicit frame to create, assume it's a
|
||||
// container and let display style dictate the rest
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
styleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
rv = ConstructFrameByDisplayType(aPresShell, aPresContext, aState, display, aContent,
|
||||
aParentFrame, aStyleContext, aFrameItems);
|
||||
aParentFrame, styleContext, aFrameItems);
|
||||
}
|
||||
|
||||
if (binding) {
|
||||
|
|
|
@ -1695,14 +1695,15 @@ nsGenericElement::GetScriptObject(nsIScriptContext* aContext,
|
|||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mContent));
|
||||
viewCSS->GetComputedStyle(elt, empty, getter_AddRefs(cssDecl));
|
||||
if (cssDecl) {
|
||||
nsAutoString behavior; behavior.Assign(NS_LITERAL_STRING("behavior"));
|
||||
nsAutoString behavior; behavior.Assign(NS_LITERAL_STRING("-moz-binding"));
|
||||
nsAutoString value;
|
||||
cssDecl->GetPropertyValue(behavior, value);
|
||||
if (!value.IsEmpty()) {
|
||||
// We have a binding that must be installed.
|
||||
nsresult rv;
|
||||
PRBool dummy;
|
||||
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
|
||||
xblService->LoadBindings(mContent, value, PR_FALSE, getter_AddRefs(binding));
|
||||
xblService->LoadBindings(mContent, value, PR_FALSE, getter_AddRefs(binding), &dummy);
|
||||
if (binding) {
|
||||
binding->ExecuteAttachedHandler();
|
||||
}
|
||||
|
|
|
@ -5236,7 +5236,8 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
|
|||
|
||||
// Load the bindings.
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
rv = xblService->LoadBindings(aParent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding));
|
||||
PRBool dummy;
|
||||
rv = xblService->LoadBindings(aParent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding), &dummy);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -5470,7 +5471,8 @@ nsCSSFrameConstructor::CreateAnonymousTableCellFrames(nsIPresShell* aPres
|
|||
|
||||
// Load the bindings.
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
rv = xblService->LoadBindings(aParent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding));
|
||||
PRBool dummy;
|
||||
rv = xblService->LoadBindings(aParent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding), &dummy);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -7414,6 +7416,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
// The following code allows the user to specify the base tag
|
||||
// of a XUL object using XBL. XUL objects (like boxes, menus, etc.)
|
||||
// can then be extended arbitrarily.
|
||||
nsCOMPtr<nsIStyleContext> styleContext(do_QueryInterface(aStyleContext));
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
if (!aXBLBaseTag)
|
||||
{
|
||||
|
@ -7429,10 +7432,17 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
return rv;
|
||||
|
||||
// Load the bindings.
|
||||
rv = xblService->LoadBindings(aContent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding));
|
||||
PRBool resolveStyle;
|
||||
rv = xblService->LoadBindings(aContent, ui->mBehavior, PR_FALSE, getter_AddRefs(binding), &resolveStyle);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
if (resolveStyle) {
|
||||
rv = ResolveStyleContext(aPresContext, aParentFrame, aContent, aTag, getter_AddRefs(styleContext));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAtom> baseTag;
|
||||
PRInt32 nameSpaceID;
|
||||
xblService->ResolveTag(aContent, &nameSpaceID, getter_AddRefs(baseTag));
|
||||
|
@ -7446,7 +7456,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
aParentFrame,
|
||||
baseTag,
|
||||
nameSpaceID,
|
||||
aStyleContext,
|
||||
styleContext,
|
||||
aFrameItems,
|
||||
PR_TRUE);
|
||||
if (binding) {
|
||||
|
@ -7465,7 +7475,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
|
||||
// Handle specific frame types
|
||||
nsresult rv = ConstructFrameByTag(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, styleContext, aFrameItems);
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
// Failing to find a matching HTML frame, try creating a specialized
|
||||
|
@ -7475,7 +7485,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
(lastChild == aFrameItems.lastChild))) {
|
||||
PRBool haltProcessing = PR_FALSE;
|
||||
rv = ConstructXULFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems, haltProcessing);
|
||||
aTag, aNameSpaceID, styleContext, aFrameItems, haltProcessing);
|
||||
if (haltProcessing) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -7487,7 +7497,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
|
||||
(lastChild == aFrameItems.lastChild))) {
|
||||
rv = ConstructMathMLFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, styleContext, aFrameItems);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -7496,7 +7506,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
|
||||
(lastChild == aFrameItems.lastChild))) {
|
||||
rv = ConstructSVGFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, styleContext, aFrameItems);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -7505,10 +7515,10 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
// When there is no explicit frame to create, assume it's a
|
||||
// container and let display style dictate the rest
|
||||
const nsStyleDisplay* display = (const nsStyleDisplay*)
|
||||
aStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
styleContext->GetStyleData(eStyleStruct_Display);
|
||||
|
||||
rv = ConstructFrameByDisplayType(aPresShell, aPresContext, aState, display, aContent,
|
||||
aParentFrame, aStyleContext, aFrameItems);
|
||||
aParentFrame, styleContext, aFrameItems);
|
||||
}
|
||||
|
||||
if (binding) {
|
||||
|
|
|
@ -64,6 +64,8 @@ public:
|
|||
NS_IMETHOD InstallEventHandlers(nsIContent* aBoundElement, nsIXBLBinding** aBinding) = 0;
|
||||
NS_IMETHOD InstallProperties(nsIContent* aBoundElement) = 0;
|
||||
|
||||
NS_IMETHOD HasStyleSheets(PRBool* aResolveStyle) = 0;
|
||||
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNameSpaceID, nsIAtom** aResult) = 0;
|
||||
|
||||
// Called when an attribute changes on a binding.
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element.
|
||||
NS_IMETHOD LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag,
|
||||
nsIXBLBinding** aBinding) = 0;
|
||||
nsIXBLBinding** aBinding, PRBool* aResolveStyle) = 0;
|
||||
|
||||
// This function clears out the bindings on a given content node.
|
||||
NS_IMETHOD FlushStyleBindings(nsIContent* aContent) = 0;
|
||||
|
|
|
@ -360,7 +360,8 @@ nsBindingManager::AddLayeredBinding(nsIContent* aContent, const nsAReadableStrin
|
|||
|
||||
// Load the bindings.
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
xblService->LoadBindings(aContent, aURL, PR_TRUE, getter_AddRefs(binding));
|
||||
PRBool dummy;
|
||||
xblService->LoadBindings(aContent, aURL, PR_TRUE, getter_AddRefs(binding), &dummy);
|
||||
if (binding) {
|
||||
AddToAttachedQueue(binding);
|
||||
ProcessAttachedQueue();
|
||||
|
|
|
@ -472,6 +472,27 @@ nsXBLBinding::SetBoundElement(nsIContent* aElement)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLBinding::HasStyleSheets(PRBool* aResolveStyle)
|
||||
{
|
||||
// Find out if we need to re-resolve style. We'll need to do this
|
||||
// if we have additional stylesheets in our binding document.
|
||||
nsCOMPtr<nsIXBLDocumentInfo> info;
|
||||
gXBLService->GetXBLDocumentInfo(mDocURI, mBoundElement, getter_AddRefs(info));
|
||||
if (!info)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
info->GetRuleProcessors(getter_AddRefs(rules));
|
||||
if (rules) {
|
||||
*aResolveStyle = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mNextBinding)
|
||||
return mNextBinding->HasStyleSheets(aResolveStyle);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement)
|
||||
{
|
||||
|
@ -1241,20 +1262,23 @@ nsXBLBinding::InheritsStyle(PRBool* aResult)
|
|||
NS_IMETHODIMP
|
||||
nsXBLBinding::WalkRules(nsISupportsArrayEnumFunc aFunc, void* aData)
|
||||
{
|
||||
if (mContent) {
|
||||
nsCOMPtr<nsIXBLDocumentInfo> info;
|
||||
gXBLService->GetXBLDocumentInfo(mDocURI, mBoundElement, getter_AddRefs(info));
|
||||
if (!info)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
info->GetRuleProcessors(getter_AddRefs(rules));
|
||||
if (rules)
|
||||
rules->EnumerateForwards(aFunc, aData);
|
||||
nsresult rv = NS_OK;
|
||||
if (mNextBinding) {
|
||||
rv = mNextBinding->WalkRules(aFunc, aData);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
else if (mNextBinding)
|
||||
return mNextBinding->WalkRules(aFunc, aData);
|
||||
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsIXBLDocumentInfo> info;
|
||||
gXBLService->GetXBLDocumentInfo(mDocURI, mBoundElement, getter_AddRefs(info));
|
||||
if (!info)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsISupportsArray> rules;
|
||||
info->GetRuleProcessors(getter_AddRefs(rules));
|
||||
if (rules)
|
||||
rules->EnumerateForwards(aFunc, aData);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Internal helper methods ////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -58,6 +58,8 @@ class nsXBLBinding: public nsIXBLBinding
|
|||
NS_IMETHOD InstallEventHandlers(nsIContent* aBoundElement, nsIXBLBinding** aBinding);
|
||||
NS_IMETHOD InstallProperties(nsIContent* aBoundElement);
|
||||
|
||||
NS_IMETHOD HasStyleSheets(PRBool* aResolveStyle);
|
||||
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceID, PRBool aRemoveFlag);
|
||||
|
|
|
@ -590,9 +590,10 @@ nsXBLService::~nsXBLService(void)
|
|||
// onto the element.
|
||||
NS_IMETHODIMP
|
||||
nsXBLService::LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag,
|
||||
nsIXBLBinding** aBinding)
|
||||
nsIXBLBinding** aBinding, PRBool* aResolveStyle)
|
||||
{
|
||||
*aBinding = nsnull;
|
||||
*aResolveStyle = PR_FALSE;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
|
@ -681,6 +682,8 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsAReadableString& aURL,
|
|||
// Set up our properties
|
||||
newBinding->InstallProperties(aContent);
|
||||
|
||||
newBinding->HasStyleSheets(aResolveStyle);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class nsXBLService : public nsIXBLService, public nsIMemoryPressureObserver
|
|||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element.
|
||||
NS_IMETHOD LoadBindings(nsIContent* aContent, const nsAReadableString& aURL, PRBool aAugmentFlag,
|
||||
nsIXBLBinding** aBinding);
|
||||
nsIXBLBinding** aBinding, PRBool* aResolveStyle);
|
||||
|
||||
// This method loads a binding doc and then builds the specific binding required.
|
||||
NS_IMETHOD GetBinding(nsIContent* aBoundElement, const nsCString& aURLStr, nsIXBLBinding** aResult);
|
||||
|
|
|
@ -158,8 +158,9 @@ nsGenericXMLElement::GetScriptObject(nsIScriptContext* aContext,
|
|||
if (!value.IsEmpty()) {
|
||||
// We have a binding that must be installed.
|
||||
nsresult rv;
|
||||
PRBool dummy;
|
||||
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
|
||||
xblService->LoadBindings(mContent, value, PR_FALSE, getter_AddRefs(binding));
|
||||
xblService->LoadBindings(mContent, value, PR_FALSE, getter_AddRefs(binding), &dummy);
|
||||
if (binding) {
|
||||
binding->ExecuteAttachedHandler();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче