mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 824899 - Don't use nsIDOMSVGElement where possible r=longsonr
This commit is contained in:
parent
de4ed0fa3d
commit
6defbde7e5
@ -12,7 +12,6 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsComputedDOMStyle.h"
|
||||
#include "nsFontMetrics.h"
|
||||
#include "nsIDOMSVGElement.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
@ -160,7 +159,7 @@ SVGContentUtils::EstablishesViewport(nsIContent *aContent)
|
||||
aContent->Tag() == nsGkAtoms::symbol);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGElement>
|
||||
nsSVGElement*
|
||||
SVGContentUtils::GetNearestViewportElement(nsIContent *aContent)
|
||||
{
|
||||
nsIContent *element = aContent->GetFlattenedTreeParent();
|
||||
@ -170,7 +169,7 @@ SVGContentUtils::GetNearestViewportElement(nsIContent *aContent)
|
||||
if (element->Tag() == nsGkAtoms::foreignObject) {
|
||||
return nullptr;
|
||||
}
|
||||
return nsCOMPtr<nsIDOMSVGElement>(do_QueryInterface(element)).forget();
|
||||
return static_cast<nsSVGElement*>(element);
|
||||
}
|
||||
element = element->GetFlattenedTreeParent();
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIDOMSVGElement;
|
||||
class nsIFrame;
|
||||
class nsStyleContext;
|
||||
class nsSVGElement;
|
||||
@ -106,7 +105,7 @@ public:
|
||||
*/
|
||||
static bool EstablishesViewport(nsIContent *aContent);
|
||||
|
||||
static already_AddRefed<nsIDOMSVGElement>
|
||||
static nsSVGElement*
|
||||
GetNearestViewportElement(nsIContent *aContent);
|
||||
|
||||
/* enum for specifying coordinate direction for ObjectSpace/UserSpace */
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
@ -33,16 +32,15 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGElement)
|
||||
NS_IMETHODIMP
|
||||
SVGLocatableElement::GetNearestViewportElement(nsIDOMSVGElement * *aNearestViewportElement)
|
||||
{
|
||||
*aNearestViewportElement = SVGContentUtils::GetNearestViewportElement(this).get();
|
||||
nsCOMPtr<nsIDOMSVGElement> domElem = do_QueryInterface(GetNearestViewportElement());
|
||||
domElem.forget(aNearestViewportElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsSVGElement>
|
||||
nsSVGElement*
|
||||
SVGLocatableElement::GetNearestViewportElement()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGElement> elem = SVGContentUtils::GetNearestViewportElement(this);
|
||||
nsCOMPtr<nsSVGElement> svgElem = do_QueryInterface(elem);
|
||||
return svgElem.forget();
|
||||
return SVGContentUtils::GetNearestViewportElement(this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGElement farthestViewportElement; */
|
||||
@ -53,12 +51,10 @@ SVGLocatableElement::GetFarthestViewportElement(nsIDOMSVGElement * *aFarthestVie
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsSVGElement>
|
||||
nsSVGElement*
|
||||
SVGLocatableElement::GetFarthestViewportElement()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGElement> elem = SVGContentUtils::GetOuterSVGElement(this);
|
||||
nsCOMPtr<nsSVGElement> svgElem = do_QueryInterface(elem);
|
||||
return svgElem.forget();
|
||||
return SVGContentUtils::GetOuterSVGElement(this);
|
||||
}
|
||||
|
||||
/* nsIDOMSVGRect getBBox (); */
|
||||
|
@ -30,8 +30,8 @@ public:
|
||||
NS_DECL_NSIDOMSVGLOCATABLE
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<nsSVGElement> GetNearestViewportElement();
|
||||
already_AddRefed<nsSVGElement> GetFarthestViewportElement();
|
||||
nsSVGElement* GetNearestViewportElement();
|
||||
nsSVGElement* GetFarthestViewportElement();
|
||||
already_AddRefed<nsIDOMSVGRect> GetBBox(ErrorResult& rv);
|
||||
already_AddRefed<DOMSVGMatrix> GetCTM();
|
||||
already_AddRefed<DOMSVGMatrix> GetScreenCTM();
|
||||
|
@ -1174,19 +1174,16 @@ nsSVGElement::GetOwnerSVGElement(ErrorResult& rv)
|
||||
NS_IMETHODIMP
|
||||
nsSVGElement::GetViewportElement(nsIDOMSVGElement * *aViewportElement)
|
||||
{
|
||||
nsCOMPtr<nsSVGElement> elem = GetViewportElement();
|
||||
nsSVGElement* elem = GetViewportElement();
|
||||
nsCOMPtr<nsIDOMSVGElement> svgElem = do_QueryInterface(elem);
|
||||
svgElem.forget(aViewportElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsSVGElement>
|
||||
nsSVGElement*
|
||||
nsSVGElement::GetViewportElement()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGElement> elem =
|
||||
SVGContentUtils::GetNearestViewportElement(this);
|
||||
nsCOMPtr<nsSVGElement> svgElem = do_QueryInterface(elem);
|
||||
return svgElem.forget();
|
||||
return SVGContentUtils::GetNearestViewportElement(this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedString>
|
||||
|
@ -300,7 +300,7 @@ public:
|
||||
|
||||
// WebIDL
|
||||
nsSVGSVGElement* GetOwnerSVGElement(mozilla::ErrorResult& rv);
|
||||
already_AddRefed<nsSVGElement> GetViewportElement();
|
||||
nsSVGElement* GetViewportElement();
|
||||
already_AddRefed<nsIDOMSVGAnimatedString> ClassName();
|
||||
nsICSSDeclaration* GetStyle(mozilla::ErrorResult& rv);
|
||||
already_AddRefed<mozilla::dom::CSSValue> GetPresentationAttribute(const nsAString& aName, mozilla::ErrorResult& rv);
|
||||
|
@ -606,7 +606,7 @@ DOMInterfaces = {
|
||||
'nativeType': 'nsSVGElement',
|
||||
'hasXPConnectImpls': True,
|
||||
'hasInstanceInterface': 'nsIDOMSVGElement',
|
||||
'resultNotAddRefed': ['ownerSVGElement', 'style']
|
||||
'resultNotAddRefed': ['ownerSVGElement', 'viewportElement', 'style']
|
||||
},
|
||||
|
||||
'SVGGraphicsElement': {
|
||||
@ -615,7 +615,8 @@ DOMInterfaces = {
|
||||
|
||||
'SVGLocatableElement': {
|
||||
'hasXPConnectImpls': True,
|
||||
'concrete': False
|
||||
'concrete': False,
|
||||
'resultNotAddRefed': ['nearestViewportElement', 'farthestViewportElement']
|
||||
},
|
||||
|
||||
'SVGLengthList': {
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "nsIDOMElement.h"
|
||||
#include "Link.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIDOMSVGElement.h"
|
||||
#include "nsIDOMSVGTitleElement.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
@ -1015,19 +1014,11 @@ DefaultTooltipTextProvider::DefaultTooltipTextProvider()
|
||||
static bool
|
||||
UseSVGTitle(nsIDOMElement *currElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGElement> svgContent(do_QueryInterface(currElement));
|
||||
if (!svgContent)
|
||||
nsCOMPtr<dom::Element> element(do_QueryInterface(currElement));
|
||||
if (!element || !element->IsSVG() || !element->GetParentNode())
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
currElement->GetParentNode(getter_AddRefs(parent));
|
||||
if (!parent)
|
||||
return false;
|
||||
|
||||
uint16_t nodeType;
|
||||
nsresult rv = parent->GetNodeType(&nodeType);
|
||||
|
||||
return NS_SUCCEEDED(rv) && nodeType != nsIDOMNode::DOCUMENT_NODE;
|
||||
return element->GetParentNode()->NodeType() != nsIDOMNode::DOCUMENT_NODE;
|
||||
}
|
||||
|
||||
/* void getNodeText (in nsIDOMNode aNode, out wstring aText); */
|
||||
|
Loading…
Reference in New Issue
Block a user