зеркало из https://github.com/mozilla/pjs.git
Make the base URI for anon nodes in an XBL binding be the URI of the XBL
document. Bug 211128, r+sr=jst, a=chofmann
This commit is contained in:
Родитель
c076641412
Коммит
632a834fb0
|
@ -70,6 +70,7 @@ REQUIRES = xpcom \
|
||||||
webbrowserpersist \
|
webbrowserpersist \
|
||||||
imglib2 \
|
imglib2 \
|
||||||
prefetch \
|
prefetch \
|
||||||
|
xuldoc \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXPORTS = \
|
EXPORTS = \
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
|
|
||||||
#include "nsIBindingManager.h"
|
#include "nsIBindingManager.h"
|
||||||
#include "nsXBLBinding.h"
|
#include "nsXBLBinding.h"
|
||||||
|
#include "nsXBLPrototypeBinding.h"
|
||||||
#include "nsIDOMCSSStyleDeclaration.h"
|
#include "nsIDOMCSSStyleDeclaration.h"
|
||||||
#include "nsIDOMViewCSS.h"
|
#include "nsIDOMViewCSS.h"
|
||||||
#include "nsIXBLService.h"
|
#include "nsIXBLService.h"
|
||||||
|
@ -2379,13 +2380,38 @@ nsGenericElement::GetBaseURI() const
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our base URL depends on whether we have an xml:base attribute, as
|
// Our base URL depends on whether we have an xml:base attribute, as well as
|
||||||
// well as on whether any of our ancestors do.
|
// on whether any of our ancestors do. The basic idea is to ask our parent
|
||||||
nsCOMPtr<nsIURI> parentBase;
|
// (GetParent() if we have one, our document otherwise) for its base
|
||||||
|
// URL. Then we resolve our xml:base attr, if any, relative to that.
|
||||||
|
|
||||||
|
// The one complication is that we may be an anonymous node bound via XBL.
|
||||||
|
// If this is the case, we still want to use our parent's baseURL unless our
|
||||||
|
// parent is not part of our own binding (eg is the element the binding is
|
||||||
|
// attached to). If that is the case, we want to use the binding url as the
|
||||||
|
// "parent" url.
|
||||||
|
|
||||||
nsIContent *parent = GetParent();
|
nsIContent *parent = GetParent();
|
||||||
|
nsCOMPtr<nsIURI> parentBase;
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parentBase = parent->GetBaseURI();
|
// XXX Not all things with a bindingParent are actually XBL anonymous
|
||||||
|
// content, so we may not end up getting a binding in the case when we have
|
||||||
|
// a bindingParent... This seems very wrong. Perhaps it should be fixed?
|
||||||
|
if (!IsNativeAnonymous()) {
|
||||||
|
nsIContent* bindingParent = GetBindingParent();
|
||||||
|
nsIContent* parentsBindingParent = parent->GetBindingParent();
|
||||||
|
if (bindingParent != parentsBindingParent) {
|
||||||
|
nsXBLBinding* binding =
|
||||||
|
doc->BindingManager()->GetBinding(bindingParent);
|
||||||
|
if (binding) {
|
||||||
|
parentBase = binding->PrototypeBinding()->BindingURI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!parentBase) {
|
||||||
|
parentBase = parent->GetBaseURI();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// No parent, so just use the document (we must be the root or not in the
|
// No parent, so just use the document (we must be the root or not in the
|
||||||
// tree).
|
// tree).
|
||||||
|
|
Загрузка…
Ссылка в новой задаче