Bug 1957689 - Fix detection of cross-doc references.
MANUAL PUSH: Orange fix CLOSED TREE
This commit is contained in:
@@ -140,7 +140,11 @@ static nsIURI* GetExternalResourceURIIfNeeded(nsIURI* aBaseURI,
|
||||
if (!use) {
|
||||
return nullptr;
|
||||
}
|
||||
nsIURI* originalURI = use->GetSourceDocURI();
|
||||
Document* doc = use->GetSourceDocument();
|
||||
if (!doc || doc == aFrom.OwnerDoc()) {
|
||||
return nullptr;
|
||||
}
|
||||
nsIURI* originalURI = doc->GetDocumentURI();
|
||||
if (!originalURI) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class IDTracker {
|
||||
/**
|
||||
* Find which element, if any, is referenced.
|
||||
*/
|
||||
Element* get() { return mElement; }
|
||||
Element* get() const { return mElement; }
|
||||
|
||||
/**
|
||||
* Set up a reference to another element, identified by the fragment
|
||||
|
||||
@@ -485,22 +485,19 @@ void SVGUseElement::UpdateShadowTree() {
|
||||
targetElement->AddMutationObserver(this);
|
||||
}
|
||||
|
||||
nsIURI* SVGUseElement::GetSourceDocURI() {
|
||||
Document* SVGUseElement::GetSourceDocument() const {
|
||||
nsIContent* targetElement = mReferencedElementTracker.get();
|
||||
if (!targetElement) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return targetElement->OwnerDoc()->GetDocumentURI();
|
||||
return targetElement ? targetElement->OwnerDoc() : nullptr;
|
||||
}
|
||||
|
||||
const Encoding* SVGUseElement::GetSourceDocCharacterSet() {
|
||||
nsIContent* targetElement = mReferencedElementTracker.get();
|
||||
if (!targetElement) {
|
||||
return nullptr;
|
||||
}
|
||||
nsIURI* SVGUseElement::GetSourceDocURI() const {
|
||||
auto* doc = GetSourceDocument();
|
||||
return doc ? doc->GetDocumentURI() : nullptr;
|
||||
}
|
||||
|
||||
return targetElement->OwnerDoc()->GetDocumentCharacterSet();
|
||||
const Encoding* SVGUseElement::GetSourceDocCharacterSet() const {
|
||||
auto* doc = GetSourceDocument();
|
||||
return doc ? doc->GetDocumentCharacterSet() : nullptr;
|
||||
}
|
||||
|
||||
static nsINode* GetClonedChild(const SVGUseElement& aUseElement) {
|
||||
|
||||
@@ -80,8 +80,9 @@ class SVGUseElement final : public SVGUseElementBase,
|
||||
already_AddRefed<DOMSVGAnimatedLength> Width();
|
||||
already_AddRefed<DOMSVGAnimatedLength> Height();
|
||||
|
||||
nsIURI* GetSourceDocURI();
|
||||
const Encoding* GetSourceDocCharacterSet();
|
||||
Document* GetSourceDocument() const;
|
||||
nsIURI* GetSourceDocURI() const;
|
||||
const Encoding* GetSourceDocCharacterSet() const;
|
||||
URLExtraData* GetContentURLData() const { return mContentURLData; }
|
||||
|
||||
// Updates the internal shadow tree to be an up-to-date clone of the
|
||||
|
||||
Reference in New Issue
Block a user