mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1075125 - GetCurrentDoc fixes in content/svg, r=wchen
--HG-- extra : rebase_source : 72ca9c3f48b54ca7eaf4eefd061b06fad0f37385
This commit is contained in:
parent
6530938e0a
commit
266f1943a8
@ -134,8 +134,9 @@ SVGAElement::BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
||||
aCompileEventHandlers);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aDocument) {
|
||||
aDocument->RegisterPendingLinkUpdate(this);
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc) {
|
||||
doc->RegisterPendingLinkUpdate(this);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -148,7 +149,9 @@ SVGAElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
// be under a different xml:base, so forget the cached state now.
|
||||
Link::ResetLinkState(false, Link::ElementHasHref());
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
// Note, we need to use OwnerDoc() here since GetComposedDoc() may
|
||||
// return null already at this point.
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
if (doc) {
|
||||
doc->UnregisterPendingLinkUpdate(this);
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ SVGAnimationElement::BindToTree(nsIDocument* aDocument,
|
||||
href->ToString(hrefStr);
|
||||
|
||||
// Pass in |aParent| instead of |this| -- first argument is only used
|
||||
// for a call to GetCurrentDoc(), and |this| might not have a current
|
||||
// for a call to GetComposedDoc(), and |this| might not have a current
|
||||
// document yet.
|
||||
UpdateHrefTarget(aParent, hrefStr);
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ GetCTMInternal(nsSVGElement *aElement, bool aScreenCTM, bool aHaveRecursed)
|
||||
|
||||
// XXX this does not take into account CSS transform, or that the non-SVG
|
||||
// content that we've hit may itself be inside an SVG foreignObject higher up
|
||||
nsIDocument* currentDoc = aElement->GetCurrentDoc();
|
||||
nsIDocument* currentDoc = aElement->GetComposedDoc();
|
||||
float x = 0.0f, y = 0.0f;
|
||||
if (currentDoc && element->NodeInfo()->Equals(nsGkAtoms::svg, kNameSpaceID_SVG)) {
|
||||
nsIPresShell *presShell = currentDoc->GetShell();
|
||||
|
@ -213,7 +213,7 @@ SVGMPathElement::UpdateHrefTarget(nsIContent* aParent,
|
||||
|
||||
if (aParent) {
|
||||
// Pass in |aParent| instead of |this| -- first argument is only used
|
||||
// for a call to GetCurrentDoc(), and |this| might not have a current
|
||||
// for a call to GetComposedDoc(), and |this| might not have a current
|
||||
// document yet (if our caller is BindToTree).
|
||||
mHrefTarget.Reset(aParent, targetURI);
|
||||
} else {
|
||||
|
@ -307,7 +307,7 @@ SVGSVGElement::UnsuspendRedrawAll()
|
||||
void
|
||||
SVGSVGElement::ForceRedraw(ErrorResult& rv)
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (!doc) {
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
@ -514,7 +514,7 @@ SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
|
||||
mCurrentTranslate = SVGPoint(x, y);
|
||||
|
||||
// now dispatch the appropriate event if we are the root element
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
|
||||
if (presShell && IsRoot()) {
|
||||
@ -831,7 +831,8 @@ SVGViewElement*
|
||||
SVGSVGElement::GetCurrentViewElement() const
|
||||
{
|
||||
if (mCurrentViewID) {
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
//XXXsmaug It is unclear how this should work in case we're in Shadow DOM.
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (doc) {
|
||||
Element *element = doc->GetElementById(*mCurrentViewID);
|
||||
if (element && element->IsSVG(nsGkAtoms::view)) {
|
||||
@ -874,7 +875,7 @@ SVGSVGElement::GetViewBoxWithSynthesis(
|
||||
SVGPreserveAspectRatio
|
||||
SVGSVGElement::GetPreserveAspectRatioWithOverride() const
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (doc && doc->IsBeingUsedAsImage()) {
|
||||
const SVGPreserveAspectRatio *pAROverridePtr = GetPreserveAspectRatioProperty();
|
||||
if (pAROverridePtr) {
|
||||
@ -1037,7 +1038,7 @@ SVGSVGElement::ShouldSynthesizeViewBox() const
|
||||
NS_ABORT_IF_FALSE(!HasViewBoxRect(),
|
||||
"Should only be called if we lack a viewBox");
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
return doc &&
|
||||
doc->IsBeingUsedAsImage() &&
|
||||
!mIsPaintingSVGImageElement &&
|
||||
@ -1086,7 +1087,7 @@ SVGSVGElement::
|
||||
SetImageOverridePreserveAspectRatio(const SVGPreserveAspectRatio& aPAR)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
NS_ABORT_IF_FALSE(GetCurrentDoc()->IsBeingUsedAsImage(),
|
||||
NS_ABORT_IF_FALSE(OwnerDoc()->IsBeingUsedAsImage(),
|
||||
"should only override preserveAspectRatio in images");
|
||||
#endif
|
||||
|
||||
@ -1116,7 +1117,7 @@ void
|
||||
SVGSVGElement::ClearImageOverridePreserveAspectRatio()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
NS_ABORT_IF_FALSE(GetCurrentDoc()->IsBeingUsedAsImage(),
|
||||
NS_ABORT_IF_FALSE(OwnerDoc()->IsBeingUsedAsImage(),
|
||||
"should only override image preserveAspectRatio in images");
|
||||
#endif
|
||||
|
||||
@ -1137,7 +1138,7 @@ void
|
||||
SVGSVGElement::FlushImageTransformInvalidation()
|
||||
{
|
||||
NS_ABORT_IF_FALSE(!GetParent(), "Should only be called on root node");
|
||||
NS_ABORT_IF_FALSE(GetCurrentDoc()->IsBeingUsedAsImage(),
|
||||
NS_ABORT_IF_FALSE(OwnerDoc()->IsBeingUsedAsImage(),
|
||||
"Should only be called on image documents");
|
||||
|
||||
if (mImageNeedsTransformInvalidation) {
|
||||
|
@ -85,7 +85,7 @@ SVGStyleElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
void
|
||||
SVGStyleElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
|
||||
nsCOMPtr<nsIDocument> oldDoc = GetUncomposedDoc();
|
||||
ShadowRoot* oldShadow = GetContainingShadow();
|
||||
SVGStyleElementBase::UnbindFromTree(aDeep, aNullParent);
|
||||
UpdateStyleSheetInternal(oldDoc, oldShadow);
|
||||
|
@ -111,7 +111,7 @@ SVGTitleElement::DoneAddingChildren(bool aHaveNotified)
|
||||
void
|
||||
SVGTitleElement::SendTitleChangeEvent(bool aBound)
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetUncomposedDoc();
|
||||
if (doc) {
|
||||
doc->NotifyPossibleTitleChange(aBound);
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ SVGTransformableElement::GetBBox(const SVGBoundingBoxOptions& aOptions,
|
||||
already_AddRefed<SVGMatrix>
|
||||
SVGTransformableElement::GetCTM()
|
||||
{
|
||||
nsIDocument* currentDoc = GetCurrentDoc();
|
||||
nsIDocument* currentDoc = GetComposedDoc();
|
||||
if (currentDoc) {
|
||||
// Flush all pending notifications so that our frames are up to date
|
||||
currentDoc->FlushPendingNotifications(Flush_Layout);
|
||||
@ -238,7 +238,7 @@ SVGTransformableElement::GetCTM()
|
||||
already_AddRefed<SVGMatrix>
|
||||
SVGTransformableElement::GetScreenCTM()
|
||||
{
|
||||
nsIDocument* currentDoc = GetCurrentDoc();
|
||||
nsIDocument* currentDoc = GetComposedDoc();
|
||||
if (currentDoc) {
|
||||
// Flush all pending notifications so that our frames are up to date
|
||||
currentDoc->FlushPendingNotifications(Flush_Layout);
|
||||
|
@ -269,7 +269,7 @@ SVGUseElement::CreateAnonymousContent()
|
||||
return nullptr;
|
||||
|
||||
if (newcontent->IsSVG(nsGkAtoms::symbol)) {
|
||||
nsIDocument *document = GetCurrentDoc();
|
||||
nsIDocument *document = GetComposedDoc();
|
||||
if (!document)
|
||||
return nullptr;
|
||||
|
||||
@ -392,7 +392,7 @@ SVGUseElement::LookupHref()
|
||||
nsCOMPtr<nsIURI> targetURI;
|
||||
nsCOMPtr<nsIURI> baseURI = mOriginal ? mOriginal->GetBaseURI() : GetBaseURI();
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
|
||||
GetCurrentDoc(), baseURI);
|
||||
GetComposedDoc(), baseURI);
|
||||
|
||||
mSource.Reset(this, targetURI);
|
||||
}
|
||||
@ -400,7 +400,7 @@ SVGUseElement::LookupHref()
|
||||
void
|
||||
SVGUseElement::TriggerReclone()
|
||||
{
|
||||
nsIDocument *doc = GetCurrentDoc();
|
||||
nsIDocument *doc = GetComposedDoc();
|
||||
if (!doc)
|
||||
return;
|
||||
nsIPresShell *presShell = doc->GetShell();
|
||||
|
@ -2705,7 +2705,7 @@ nsSVGElement::GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName)
|
||||
void
|
||||
nsSVGElement::AnimationNeedsResample()
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc && doc->HasAnimationController()) {
|
||||
doc->GetAnimationController()->SetResampleNeeded();
|
||||
}
|
||||
@ -2714,7 +2714,7 @@ nsSVGElement::AnimationNeedsResample()
|
||||
void
|
||||
nsSVGElement::FlushAnimations()
|
||||
{
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc && doc->HasAnimationController()) {
|
||||
doc->GetAnimationController()->FlushResampleRequests();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ nsSVGFeatures::HasFeature(nsISupports* aObject, const nsAString& aFeature)
|
||||
if (aFeature.EqualsLiteral("http://www.w3.org/TR/SVG11/feature#Script")) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aObject));
|
||||
if (content) {
|
||||
nsIDocument *doc = content->GetCurrentDoc();
|
||||
nsIDocument* doc = content->GetUncomposedDoc();
|
||||
if (doc && doc->IsResourceDoc()) {
|
||||
// no scripting in SVG images or external resource documents
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user