зеркало из https://github.com/mozilla/gecko-dev.git
XBL Fixes r=ben
This commit is contained in:
Родитель
c8d446d250
Коммит
481e0fdf9a
|
@ -1523,7 +1523,19 @@ nsGenericElement::GetScriptObject(nsIScriptContext* aContext,
|
|||
"nsGenericElement::mScriptObject");
|
||||
}
|
||||
}
|
||||
*aScriptObject = slots->mScriptObject;
|
||||
|
||||
void* object = nsnull;
|
||||
if (mDocument) {
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
bindingManager->GetBinding(mContent, getter_AddRefs(binding));
|
||||
if (binding) {
|
||||
nsCOMPtr<nsIScriptObjectOwner> owner(do_QueryInterface(binding));
|
||||
owner->GetScriptObject(aContext, &object);
|
||||
}
|
||||
}
|
||||
*aScriptObject = object ? object : slots->mScriptObject;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
NS_IMETHOD GetBinding(nsIContent* aContent, nsIXBLBinding** aResult) = 0;
|
||||
NS_IMETHOD SetBinding(nsIContent* aContent, nsIXBLBinding* aBinding) = 0;
|
||||
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, nsIAtom** aResult) = 0;
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetInsertionPoint(nsIContent* aParent, nsIContent* aChild, nsIContent** aResult) = 0;
|
||||
NS_IMETHOD GetSingleInsertionPoint(nsIContent* aParent, nsIContent** aResult,
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
NS_IMETHOD InstallEventHandlers(nsIContent* aBoundElement) = 0;
|
||||
NS_IMETHOD InstallProperties(nsIContent* aBoundElement) = 0;
|
||||
|
||||
NS_IMETHOD GetBaseTag(nsIAtom** aResult) = 0;
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNameSpaceID, nsIAtom** aResult) = 0;
|
||||
|
||||
// Called when an attribute changes on a binding.
|
||||
NS_IMETHOD AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceID, PRBool aRemoveFlag) = 0;
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
PRBool* aMultipleInsertionPoints) = 0;
|
||||
|
||||
// Retrieves our base class (e.g., tells us what type of frame and content node to build)
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, nsIAtom** aResult) = 0;
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult) = 0;
|
||||
|
||||
NS_IMETHOD AllowScripts(nsIContent* aContent, PRBool* aAllowScripts) = 0;
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
NS_IMETHOD GetBinding(nsIContent* aContent, nsIXBLBinding** aResult);
|
||||
NS_IMETHOD SetBinding(nsIContent* aContent, nsIXBLBinding* aBinding);
|
||||
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, nsIAtom** aResult);
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD GetInsertionPoint(nsIContent* aParent, nsIContent* aChild, nsIContent** aResult);
|
||||
NS_IMETHOD GetSingleInsertionPoint(nsIContent* aParent, nsIContent** aResult,
|
||||
|
@ -130,14 +130,14 @@ nsBindingManager::SetBinding(nsIContent* aContent, nsIXBLBinding* aBinding )
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBindingManager::ResolveTag(nsIContent* aContent, nsIAtom** aResult)
|
||||
nsBindingManager::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
GetBinding(aContent, getter_AddRefs(binding));
|
||||
|
||||
if (binding) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
binding->GetBaseTag(getter_AddRefs(tag));
|
||||
binding->GetBaseTag(aNameSpaceID, getter_AddRefs(tag));
|
||||
if (tag) {
|
||||
*aResult = tag;
|
||||
NS_ADDREF(*aResult);
|
||||
|
@ -145,6 +145,7 @@ nsBindingManager::ResolveTag(nsIContent* aContent, nsIAtom** aResult)
|
|||
}
|
||||
}
|
||||
|
||||
aContent->GetNameSpaceID(*aNameSpaceID);
|
||||
return aContent->GetTag(*aResult);
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ class nsXBLBinding: public nsIXBLBinding, public nsIScriptObjectOwner
|
|||
NS_IMETHOD InstallEventHandlers(nsIContent* aBoundElement);
|
||||
NS_IMETHOD InstallProperties(nsIContent* aBoundElement);
|
||||
|
||||
NS_IMETHOD GetBaseTag(nsIAtom** aResult);
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceID, PRBool aRemoveFlag);
|
||||
|
||||
|
@ -912,10 +912,10 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLBinding::GetBaseTag(nsIAtom** aResult)
|
||||
nsXBLBinding::GetBaseTag(PRInt32* aNameSpaceID, nsIAtom** aResult)
|
||||
{
|
||||
if (mNextBinding)
|
||||
return mNextBinding->GetBaseTag(aResult);
|
||||
return mNextBinding->GetBaseTag(aNameSpaceID, aResult);
|
||||
|
||||
// XXX Cache the value as a "base" attribute so that we don't do this
|
||||
// check over and over each time the bound element occurs.
|
||||
|
@ -945,7 +945,7 @@ nsXBLBinding::GetBaseTag(nsIAtom** aResult)
|
|||
nameSpace->FindNameSpace(prefixAtom, *getter_AddRefs(tagSpace));
|
||||
if (tagSpace) {
|
||||
// Score! Return the tag.
|
||||
// XXX We should really return the namespace as well.
|
||||
tagSpace->GetNameSpaceID(*aNameSpaceID);
|
||||
*aResult = NS_NewAtom(extends); // The addref happens here
|
||||
}
|
||||
}
|
||||
|
@ -959,8 +959,9 @@ nsXBLBinding::GetBaseTag(nsIAtom** aResult)
|
|||
NS_IMETHODIMP
|
||||
nsXBLBinding::AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceID, PRBool aRemoveFlag)
|
||||
{
|
||||
if (mNextBinding)
|
||||
mNextBinding->AttributeChanged(aAttribute, aNameSpaceID, aRemoveFlag);
|
||||
// XXX check to see if we inherit anonymous content from a base binding
|
||||
// if (mNextBinding)
|
||||
// mNextBinding->AttributeChanged(aAttribute, aNameSpaceID, aRemoveFlag);
|
||||
|
||||
if (!mAttributeTable)
|
||||
return NS_OK;
|
||||
|
|
|
@ -131,7 +131,7 @@ class nsXBLService: public nsIXBLService
|
|||
PRBool* aMultipleInsertionPoints);
|
||||
|
||||
// Gets the object's base class type.
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, nsIAtom** aResult);
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD AllowScripts(nsIContent* aContent, PRBool* aAllowScripts);
|
||||
|
||||
|
@ -371,7 +371,7 @@ nsXBLService::FlushBindingDocuments()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLService::ResolveTag(nsIContent* aContent, nsIAtom** aResult)
|
||||
nsXBLService::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
|
@ -380,9 +380,10 @@ nsXBLService::ResolveTag(nsIContent* aContent, nsIAtom** aResult)
|
|||
document->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
if (bindingManager)
|
||||
return bindingManager->ResolveTag(aContent, aResult);
|
||||
return bindingManager->ResolveTag(aContent, aNameSpaceID, aResult);
|
||||
}
|
||||
|
||||
aContent->GetNameSpaceID(*aNameSpaceID);
|
||||
aContent->GetTag(*aResult); // Addref happens here.
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -465,7 +466,8 @@ NS_IMETHODIMP nsXBLService::GetBinding(const nsCString& aURLStr, nsIXBLBinding**
|
|||
if (!value.IsEmpty()) {
|
||||
// See if we are extending a builtin tag.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
(*aResult)->GetBaseTag(getter_AddRefs(tag));
|
||||
PRInt32 dummy;
|
||||
(*aResult)->GetBaseTag(&dummy, getter_AddRefs(tag));
|
||||
if (!tag) {
|
||||
// We have a base class binding. Load it right now.
|
||||
nsCOMPtr<nsIXBLBinding> baseBinding;
|
||||
|
|
|
@ -153,7 +153,7 @@ static PRBool gReallyNoisyContentUpdates = PR_FALSE;
|
|||
static PRBool gNoisyInlineConstruction = PR_FALSE;
|
||||
#endif
|
||||
|
||||
//#define XULTREE
|
||||
#define XULTREE
|
||||
#ifdef XULTREE
|
||||
#include "nsXULTreeFrame.h"
|
||||
#include "nsXULTreeGroupFrame.h"
|
||||
|
@ -4707,6 +4707,7 @@ nsCSSFrameConstructor::ConstructFrameByTag(nsIPresShell* aPresShell,
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems)
|
||||
{
|
||||
|
@ -5377,6 +5378,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems,
|
||||
PRBool& aHaltProcessing)
|
||||
|
@ -5404,9 +5406,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
return NS_OK;
|
||||
|
||||
|
||||
PRInt32 nameSpaceID;
|
||||
if (NS_SUCCEEDED(aContent->GetNameSpaceID(nameSpaceID)) &&
|
||||
nameSpaceID == nsXULAtoms::nameSpaceID) {
|
||||
if (aNameSpaceID == nsXULAtoms::nameSpaceID) {
|
||||
|
||||
// was here
|
||||
|
||||
|
@ -6935,6 +6935,7 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems)
|
||||
{
|
||||
|
@ -6954,9 +6955,7 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
|
|||
return NS_OK;
|
||||
|
||||
// Make sure that we remain confined in the MathML world
|
||||
PRInt32 nameSpaceID;
|
||||
rv = aContent->GetNameSpaceID(nameSpaceID);
|
||||
if (NS_FAILED(rv) || nameSpaceID != nsMathMLAtoms::nameSpaceID)
|
||||
if (aNameSpaceID != nsMathMLAtoms::nameSpaceID)
|
||||
return NS_OK;
|
||||
|
||||
// Initialize the new frame
|
||||
|
@ -7140,6 +7139,7 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell,
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems)
|
||||
{
|
||||
|
@ -7158,10 +7158,8 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell,
|
|||
if (aTag == nsnull)
|
||||
return NS_OK;
|
||||
|
||||
// Make sure that we remain confined in the MathML world
|
||||
PRInt32 nameSpaceID;
|
||||
rv = aContent->GetNameSpaceID(nameSpaceID);
|
||||
if (NS_FAILED(rv) || nameSpaceID != nsSVGAtoms::nameSpaceID)
|
||||
// Make sure that we remain confined in the SVG world
|
||||
if (aNameSpaceID != nsSVGAtoms::nameSpaceID)
|
||||
return NS_OK;
|
||||
|
||||
// Initialize the new frame
|
||||
|
@ -7274,12 +7272,15 @@ nsCSSFrameConstructor::ConstructFrame(nsIPresShell* aPresShell,
|
|||
}
|
||||
else
|
||||
{
|
||||
PRInt32 nameSpaceID;
|
||||
aContent->GetNameSpaceID(nameSpaceID);
|
||||
rv = ConstructFrameInternal(aPresShell,
|
||||
aPresContext,
|
||||
aState,
|
||||
aContent,
|
||||
aParentFrame,
|
||||
tag,
|
||||
nameSpaceID,
|
||||
styleContext,
|
||||
aFrameItems,
|
||||
PR_FALSE);
|
||||
|
@ -7297,6 +7298,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems,
|
||||
PRBool aXBLBaseTag)
|
||||
|
@ -7321,7 +7323,8 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
xblService->LoadBindings(aContent, ui->mBehavior);
|
||||
|
||||
nsCOMPtr<nsIAtom> baseTag;
|
||||
xblService->ResolveTag(aContent, getter_AddRefs(baseTag));
|
||||
PRInt32 nameSpaceID;
|
||||
xblService->ResolveTag(aContent, &nameSpaceID, getter_AddRefs(baseTag));
|
||||
|
||||
if (baseTag.get() != aTag) {
|
||||
// Construct the frame using the XBL base tag.
|
||||
|
@ -7331,6 +7334,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
aContent,
|
||||
aParentFrame,
|
||||
baseTag,
|
||||
nameSpaceID,
|
||||
aStyleContext,
|
||||
aFrameItems,
|
||||
PR_TRUE);
|
||||
|
@ -7343,7 +7347,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
|
||||
// Handle specific frame types
|
||||
nsresult rv = ConstructFrameByTag(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
// Failing to find a matching HTML frame, try creating a specialized
|
||||
|
@ -7353,7 +7357,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
(lastChild == aFrameItems.lastChild))) {
|
||||
PRBool haltProcessing = PR_FALSE;
|
||||
rv = ConstructXULFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aStyleContext, aFrameItems, haltProcessing);
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems, haltProcessing);
|
||||
if (haltProcessing) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -7365,7 +7369,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
|
||||
(lastChild == aFrameItems.lastChild))) {
|
||||
rv = ConstructMathMLFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -7374,7 +7378,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
|
||||
(lastChild == aFrameItems.lastChild))) {
|
||||
rv = ConstructSVGFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -490,6 +490,7 @@ protected:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
||||
|
@ -499,6 +500,7 @@ protected:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems,
|
||||
PRBool aXBLBaseTag);
|
||||
|
@ -536,6 +538,7 @@ protected:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems);
|
||||
#endif
|
||||
|
@ -547,6 +550,7 @@ protected:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems,
|
||||
PRBool& aHaltProcessing);
|
||||
|
@ -561,6 +565,7 @@ protected:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems);
|
||||
#endif
|
||||
|
|
|
@ -1523,7 +1523,19 @@ nsGenericElement::GetScriptObject(nsIScriptContext* aContext,
|
|||
"nsGenericElement::mScriptObject");
|
||||
}
|
||||
}
|
||||
*aScriptObject = slots->mScriptObject;
|
||||
|
||||
void* object = nsnull;
|
||||
if (mDocument) {
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
bindingManager->GetBinding(mContent, getter_AddRefs(binding));
|
||||
if (binding) {
|
||||
nsCOMPtr<nsIScriptObjectOwner> owner(do_QueryInterface(binding));
|
||||
owner->GetScriptObject(aContext, &object);
|
||||
}
|
||||
}
|
||||
*aScriptObject = object ? object : slots->mScriptObject;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ static PRBool gReallyNoisyContentUpdates = PR_FALSE;
|
|||
static PRBool gNoisyInlineConstruction = PR_FALSE;
|
||||
#endif
|
||||
|
||||
//#define XULTREE
|
||||
#define XULTREE
|
||||
#ifdef XULTREE
|
||||
#include "nsXULTreeFrame.h"
|
||||
#include "nsXULTreeGroupFrame.h"
|
||||
|
@ -4707,6 +4707,7 @@ nsCSSFrameConstructor::ConstructFrameByTag(nsIPresShell* aPresShell,
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems)
|
||||
{
|
||||
|
@ -5377,6 +5378,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems,
|
||||
PRBool& aHaltProcessing)
|
||||
|
@ -5404,9 +5406,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
return NS_OK;
|
||||
|
||||
|
||||
PRInt32 nameSpaceID;
|
||||
if (NS_SUCCEEDED(aContent->GetNameSpaceID(nameSpaceID)) &&
|
||||
nameSpaceID == nsXULAtoms::nameSpaceID) {
|
||||
if (aNameSpaceID == nsXULAtoms::nameSpaceID) {
|
||||
|
||||
// was here
|
||||
|
||||
|
@ -6935,6 +6935,7 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems)
|
||||
{
|
||||
|
@ -6954,9 +6955,7 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
|
|||
return NS_OK;
|
||||
|
||||
// Make sure that we remain confined in the MathML world
|
||||
PRInt32 nameSpaceID;
|
||||
rv = aContent->GetNameSpaceID(nameSpaceID);
|
||||
if (NS_FAILED(rv) || nameSpaceID != nsMathMLAtoms::nameSpaceID)
|
||||
if (aNameSpaceID != nsMathMLAtoms::nameSpaceID)
|
||||
return NS_OK;
|
||||
|
||||
// Initialize the new frame
|
||||
|
@ -7140,6 +7139,7 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell,
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems)
|
||||
{
|
||||
|
@ -7158,10 +7158,8 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsIPresShell* aPresShell,
|
|||
if (aTag == nsnull)
|
||||
return NS_OK;
|
||||
|
||||
// Make sure that we remain confined in the MathML world
|
||||
PRInt32 nameSpaceID;
|
||||
rv = aContent->GetNameSpaceID(nameSpaceID);
|
||||
if (NS_FAILED(rv) || nameSpaceID != nsSVGAtoms::nameSpaceID)
|
||||
// Make sure that we remain confined in the SVG world
|
||||
if (aNameSpaceID != nsSVGAtoms::nameSpaceID)
|
||||
return NS_OK;
|
||||
|
||||
// Initialize the new frame
|
||||
|
@ -7274,12 +7272,15 @@ nsCSSFrameConstructor::ConstructFrame(nsIPresShell* aPresShell,
|
|||
}
|
||||
else
|
||||
{
|
||||
PRInt32 nameSpaceID;
|
||||
aContent->GetNameSpaceID(nameSpaceID);
|
||||
rv = ConstructFrameInternal(aPresShell,
|
||||
aPresContext,
|
||||
aState,
|
||||
aContent,
|
||||
aParentFrame,
|
||||
tag,
|
||||
nameSpaceID,
|
||||
styleContext,
|
||||
aFrameItems,
|
||||
PR_FALSE);
|
||||
|
@ -7297,6 +7298,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems,
|
||||
PRBool aXBLBaseTag)
|
||||
|
@ -7321,7 +7323,8 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
xblService->LoadBindings(aContent, ui->mBehavior);
|
||||
|
||||
nsCOMPtr<nsIAtom> baseTag;
|
||||
xblService->ResolveTag(aContent, getter_AddRefs(baseTag));
|
||||
PRInt32 nameSpaceID;
|
||||
xblService->ResolveTag(aContent, &nameSpaceID, getter_AddRefs(baseTag));
|
||||
|
||||
if (baseTag.get() != aTag) {
|
||||
// Construct the frame using the XBL base tag.
|
||||
|
@ -7331,6 +7334,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
aContent,
|
||||
aParentFrame,
|
||||
baseTag,
|
||||
nameSpaceID,
|
||||
aStyleContext,
|
||||
aFrameItems,
|
||||
PR_TRUE);
|
||||
|
@ -7343,7 +7347,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
|
||||
// Handle specific frame types
|
||||
nsresult rv = ConstructFrameByTag(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
|
||||
#ifdef INCLUDE_XUL
|
||||
// Failing to find a matching HTML frame, try creating a specialized
|
||||
|
@ -7353,7 +7357,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
(lastChild == aFrameItems.lastChild))) {
|
||||
PRBool haltProcessing = PR_FALSE;
|
||||
rv = ConstructXULFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aStyleContext, aFrameItems, haltProcessing);
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems, haltProcessing);
|
||||
if (haltProcessing) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -7365,7 +7369,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
|
||||
(lastChild == aFrameItems.lastChild))) {
|
||||
rv = ConstructMathMLFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -7374,7 +7378,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
|
||||
(lastChild == aFrameItems.lastChild))) {
|
||||
rv = ConstructSVGFrame(aPresShell, aPresContext, aState, aContent, aParentFrame,
|
||||
aTag, aStyleContext, aFrameItems);
|
||||
aTag, aNameSpaceID, aStyleContext, aFrameItems);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -490,6 +490,7 @@ protected:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
||||
|
@ -499,6 +500,7 @@ protected:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems,
|
||||
PRBool aXBLBaseTag);
|
||||
|
@ -536,6 +538,7 @@ protected:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems);
|
||||
#endif
|
||||
|
@ -547,6 +550,7 @@ protected:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems,
|
||||
PRBool& aHaltProcessing);
|
||||
|
@ -561,6 +565,7 @@ protected:
|
|||
nsIContent* aContent,
|
||||
nsIFrame* aParentFrame,
|
||||
nsIAtom* aTag,
|
||||
PRInt32 aNameSpaceID,
|
||||
nsIStyleContext* aStyleContext,
|
||||
nsFrameItems& aFrameItems);
|
||||
#endif
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
NS_IMETHOD GetBinding(nsIContent* aContent, nsIXBLBinding** aResult) = 0;
|
||||
NS_IMETHOD SetBinding(nsIContent* aContent, nsIXBLBinding* aBinding) = 0;
|
||||
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, nsIAtom** aResult) = 0;
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult) = 0;
|
||||
|
||||
NS_IMETHOD GetInsertionPoint(nsIContent* aParent, nsIContent* aChild, nsIContent** aResult) = 0;
|
||||
NS_IMETHOD GetSingleInsertionPoint(nsIContent* aParent, nsIContent** aResult,
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
NS_IMETHOD InstallEventHandlers(nsIContent* aBoundElement) = 0;
|
||||
NS_IMETHOD InstallProperties(nsIContent* aBoundElement) = 0;
|
||||
|
||||
NS_IMETHOD GetBaseTag(nsIAtom** aResult) = 0;
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNameSpaceID, nsIAtom** aResult) = 0;
|
||||
|
||||
// Called when an attribute changes on a binding.
|
||||
NS_IMETHOD AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceID, PRBool aRemoveFlag) = 0;
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
PRBool* aMultipleInsertionPoints) = 0;
|
||||
|
||||
// Retrieves our base class (e.g., tells us what type of frame and content node to build)
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, nsIAtom** aResult) = 0;
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult) = 0;
|
||||
|
||||
NS_IMETHOD AllowScripts(nsIContent* aContent, PRBool* aAllowScripts) = 0;
|
||||
};
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
NS_IMETHOD GetBinding(nsIContent* aContent, nsIXBLBinding** aResult);
|
||||
NS_IMETHOD SetBinding(nsIContent* aContent, nsIXBLBinding* aBinding);
|
||||
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, nsIAtom** aResult);
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD GetInsertionPoint(nsIContent* aParent, nsIContent* aChild, nsIContent** aResult);
|
||||
NS_IMETHOD GetSingleInsertionPoint(nsIContent* aParent, nsIContent** aResult,
|
||||
|
@ -130,14 +130,14 @@ nsBindingManager::SetBinding(nsIContent* aContent, nsIXBLBinding* aBinding )
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBindingManager::ResolveTag(nsIContent* aContent, nsIAtom** aResult)
|
||||
nsBindingManager::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
GetBinding(aContent, getter_AddRefs(binding));
|
||||
|
||||
if (binding) {
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
binding->GetBaseTag(getter_AddRefs(tag));
|
||||
binding->GetBaseTag(aNameSpaceID, getter_AddRefs(tag));
|
||||
if (tag) {
|
||||
*aResult = tag;
|
||||
NS_ADDREF(*aResult);
|
||||
|
@ -145,6 +145,7 @@ nsBindingManager::ResolveTag(nsIContent* aContent, nsIAtom** aResult)
|
|||
}
|
||||
}
|
||||
|
||||
aContent->GetNameSpaceID(*aNameSpaceID);
|
||||
return aContent->GetTag(*aResult);
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ class nsXBLBinding: public nsIXBLBinding, public nsIScriptObjectOwner
|
|||
NS_IMETHOD InstallEventHandlers(nsIContent* aBoundElement);
|
||||
NS_IMETHOD InstallProperties(nsIContent* aBoundElement);
|
||||
|
||||
NS_IMETHOD GetBaseTag(nsIAtom** aResult);
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceID, PRBool aRemoveFlag);
|
||||
|
||||
|
@ -912,10 +912,10 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLBinding::GetBaseTag(nsIAtom** aResult)
|
||||
nsXBLBinding::GetBaseTag(PRInt32* aNameSpaceID, nsIAtom** aResult)
|
||||
{
|
||||
if (mNextBinding)
|
||||
return mNextBinding->GetBaseTag(aResult);
|
||||
return mNextBinding->GetBaseTag(aNameSpaceID, aResult);
|
||||
|
||||
// XXX Cache the value as a "base" attribute so that we don't do this
|
||||
// check over and over each time the bound element occurs.
|
||||
|
@ -945,7 +945,7 @@ nsXBLBinding::GetBaseTag(nsIAtom** aResult)
|
|||
nameSpace->FindNameSpace(prefixAtom, *getter_AddRefs(tagSpace));
|
||||
if (tagSpace) {
|
||||
// Score! Return the tag.
|
||||
// XXX We should really return the namespace as well.
|
||||
tagSpace->GetNameSpaceID(*aNameSpaceID);
|
||||
*aResult = NS_NewAtom(extends); // The addref happens here
|
||||
}
|
||||
}
|
||||
|
@ -959,8 +959,9 @@ nsXBLBinding::GetBaseTag(nsIAtom** aResult)
|
|||
NS_IMETHODIMP
|
||||
nsXBLBinding::AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceID, PRBool aRemoveFlag)
|
||||
{
|
||||
if (mNextBinding)
|
||||
mNextBinding->AttributeChanged(aAttribute, aNameSpaceID, aRemoveFlag);
|
||||
// XXX check to see if we inherit anonymous content from a base binding
|
||||
// if (mNextBinding)
|
||||
// mNextBinding->AttributeChanged(aAttribute, aNameSpaceID, aRemoveFlag);
|
||||
|
||||
if (!mAttributeTable)
|
||||
return NS_OK;
|
||||
|
|
|
@ -131,7 +131,7 @@ class nsXBLService: public nsIXBLService
|
|||
PRBool* aMultipleInsertionPoints);
|
||||
|
||||
// Gets the object's base class type.
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, nsIAtom** aResult);
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD AllowScripts(nsIContent* aContent, PRBool* aAllowScripts);
|
||||
|
||||
|
@ -371,7 +371,7 @@ nsXBLService::FlushBindingDocuments()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLService::ResolveTag(nsIContent* aContent, nsIAtom** aResult)
|
||||
nsXBLService::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
aContent->GetDocument(*getter_AddRefs(document));
|
||||
|
@ -380,9 +380,10 @@ nsXBLService::ResolveTag(nsIContent* aContent, nsIAtom** aResult)
|
|||
document->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
|
||||
if (bindingManager)
|
||||
return bindingManager->ResolveTag(aContent, aResult);
|
||||
return bindingManager->ResolveTag(aContent, aNameSpaceID, aResult);
|
||||
}
|
||||
|
||||
aContent->GetNameSpaceID(*aNameSpaceID);
|
||||
aContent->GetTag(*aResult); // Addref happens here.
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -465,7 +466,8 @@ NS_IMETHODIMP nsXBLService::GetBinding(const nsCString& aURLStr, nsIXBLBinding**
|
|||
if (!value.IsEmpty()) {
|
||||
// See if we are extending a builtin tag.
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
(*aResult)->GetBaseTag(getter_AddRefs(tag));
|
||||
PRInt32 dummy;
|
||||
(*aResult)->GetBaseTag(&dummy, getter_AddRefs(tag));
|
||||
if (!tag) {
|
||||
// We have a base class binding. Load it right now.
|
||||
nsCOMPtr<nsIXBLBinding> baseBinding;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIBindingManager.h"
|
||||
#include "nsIXBLBinding.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
|
@ -124,7 +126,19 @@ nsGenericXMLElement::GetScriptObject(nsIScriptContext* aContext,
|
|||
"nsGenericXMLElement::mScriptObject");
|
||||
}
|
||||
}
|
||||
*aScriptObject = slots->mScriptObject;
|
||||
|
||||
void* object = nsnull;
|
||||
if (mDocument) {
|
||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
bindingManager->GetBinding(mContent, getter_AddRefs(binding));
|
||||
if (binding) {
|
||||
nsCOMPtr<nsIScriptObjectOwner> owner(do_QueryInterface(binding));
|
||||
owner->GetScriptObject(aContext, &object);
|
||||
}
|
||||
}
|
||||
*aScriptObject = object ? object : slots->mScriptObject;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -794,9 +794,10 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && xblService)
|
||||
xblService->ResolveTag(content, getter_AddRefs(atom));
|
||||
else
|
||||
if (NS_SUCCEEDED(rv) && xblService) {
|
||||
PRInt32 dummy;
|
||||
xblService->ResolveTag(content, &dummy, getter_AddRefs(atom));
|
||||
} else
|
||||
content->GetTag(*getter_AddRefs(atom));
|
||||
|
||||
// skip over any splitters
|
||||
|
|
Загрузка…
Ссылка в новой задаче