mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 837036 - Remove SVGLocatableElement and SVGTransformableElement IDL r=longsonr
This commit is contained in:
parent
9efe073453
commit
642114ea39
@ -92,7 +92,6 @@ CPPSRCS = \
|
||||
SVGLengthList.cpp \
|
||||
SVGLengthListSMILType.cpp \
|
||||
SVGLineElement.cpp \
|
||||
SVGLocatableElement.cpp \
|
||||
SVGMarkerElement.cpp \
|
||||
SVGMaskElement.cpp \
|
||||
SVGMatrix.cpp \
|
||||
@ -176,7 +175,6 @@ EXPORTS_mozilla/dom = \
|
||||
SVGGraphicsElement.h \
|
||||
SVGImageElement.h \
|
||||
SVGLineElement.h \
|
||||
SVGLocatableElement.h \
|
||||
SVGMarkerElement.h \
|
||||
SVGMaskElement.h \
|
||||
SVGMatrix.h \
|
||||
|
@ -4,7 +4,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/SVGGraphicsElement.h"
|
||||
#include "mozilla/dom/SVGGraphicsElementBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -1,109 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "mozilla/dom/SVGLocatableElement.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsISVGChildFrame.h"
|
||||
#include "nsSVGRect.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "SVGContentUtils.h"
|
||||
#include "mozilla/dom/SVGMatrix.h"
|
||||
#include "mozilla/dom/SVGSVGElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGLocatableElement, nsSVGElement)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGLocatableElement, nsSVGElement)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(SVGLocatableElement)
|
||||
NS_INTERFACE_MAP_ENTRY(mozilla::dom::SVGLocatableElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGElement)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsSVGElement*
|
||||
SVGLocatableElement::GetNearestViewportElement()
|
||||
{
|
||||
return SVGContentUtils::GetNearestViewportElement(this);
|
||||
}
|
||||
|
||||
nsSVGElement*
|
||||
SVGLocatableElement::GetFarthestViewportElement()
|
||||
{
|
||||
return SVGContentUtils::GetOuterSVGElement(this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGRect>
|
||||
SVGLocatableElement::GetBBox(ErrorResult& rv)
|
||||
{
|
||||
nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
|
||||
|
||||
if (!frame || (frame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsISVGChildFrame* svgframe = do_QueryFrame(frame);
|
||||
if (!svgframe) {
|
||||
rv.Throw(NS_ERROR_NOT_IMPLEMENTED); // XXX: outer svg
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMSVGRect> rect;
|
||||
rv = NS_NewSVGRect(getter_AddRefs(rect), nsSVGUtils::GetBBox(frame));
|
||||
return rect.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<SVGMatrix>
|
||||
SVGLocatableElement::GetCTM()
|
||||
{
|
||||
nsIDocument* currentDoc = GetCurrentDoc();
|
||||
if (currentDoc) {
|
||||
// Flush all pending notifications so that our frames are up to date
|
||||
currentDoc->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
gfxMatrix m = SVGContentUtils::GetCTM(this, false);
|
||||
nsCOMPtr<SVGMatrix> mat = m.IsSingular() ? nullptr : new SVGMatrix(m);
|
||||
return mat.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<SVGMatrix>
|
||||
SVGLocatableElement::GetScreenCTM()
|
||||
{
|
||||
nsIDocument* currentDoc = GetCurrentDoc();
|
||||
if (currentDoc) {
|
||||
// Flush all pending notifications so that our frames are up to date
|
||||
currentDoc->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
gfxMatrix m = SVGContentUtils::GetCTM(this, true);
|
||||
nsCOMPtr<SVGMatrix> mat = m.IsSingular() ? nullptr : new SVGMatrix(m);
|
||||
return mat.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<SVGMatrix>
|
||||
SVGLocatableElement::GetTransformToElement(SVGLocatableElement& aElement,
|
||||
ErrorResult& rv)
|
||||
{
|
||||
// the easiest way to do this (if likely to increase rounding error):
|
||||
nsCOMPtr<SVGMatrix> ourScreenCTM = GetScreenCTM();
|
||||
nsCOMPtr<SVGMatrix> targetScreenCTM = aElement.GetScreenCTM();
|
||||
if (!ourScreenCTM || !targetScreenCTM) {
|
||||
rv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<SVGMatrix> tmp = targetScreenCTM->Inverse(rv);
|
||||
if (rv.Failed()) return nullptr;
|
||||
|
||||
nsCOMPtr<SVGMatrix> mat = tmp->Multiply(*ourScreenCTM).get();
|
||||
return mat.forget();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -1,49 +0,0 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
#ifndef SVGLocatableElement_h
|
||||
#define SVGLocatableElement_h
|
||||
|
||||
#include "nsSVGElement.h"
|
||||
|
||||
#define MOZILLA_SVGLOCATABLEELEMENT_IID \
|
||||
{ 0xe20176ba, 0xc48d, 0x4704, \
|
||||
{0x89, 0xec, 0xe6, 0x69, 0x6c, 0xb7, 0xb8, 0xb3} }
|
||||
|
||||
class nsIDOMSVGRect;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class SVGMatrix;
|
||||
|
||||
class SVGLocatableElement : public nsSVGElement
|
||||
{
|
||||
public:
|
||||
SVGLocatableElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGElement(aNodeInfo) {}
|
||||
virtual ~SVGLocatableElement() {}
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_SVGLOCATABLEELEMENT_IID)
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// WebIDL
|
||||
nsSVGElement* GetNearestViewportElement();
|
||||
nsSVGElement* GetFarthestViewportElement();
|
||||
already_AddRefed<nsIDOMSVGRect> GetBBox(ErrorResult& rv);
|
||||
already_AddRefed<SVGMatrix> GetCTM();
|
||||
already_AddRefed<SVGMatrix> GetScreenCTM();
|
||||
already_AddRefed<SVGMatrix> GetTransformToElement(SVGLocatableElement& aElement,
|
||||
ErrorResult& rv);
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(SVGLocatableElement,
|
||||
MOZILLA_SVGLOCATABLEELEMENT_IID)
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // SVGLocatableElement_h
|
||||
|
@ -4,11 +4,16 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/SVGTransformableElement.h"
|
||||
#include "mozilla/dom/SVGMatrix.h"
|
||||
#include "mozilla/dom/SVGSVGElement.h"
|
||||
#include "DOMSVGAnimatedTransformList.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsISVGChildFrame.h"
|
||||
#include "nsSVGRect.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -16,12 +21,7 @@ namespace dom {
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGTransformableElement, SVGLocatableElement)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGTransformableElement, SVGLocatableElement)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(SVGTransformableElement)
|
||||
NS_INTERFACE_MAP_ENTRY(mozilla::dom::SVGTransformableElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGLocatableElement)
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(SVGTransformableElement, nsSVGElement)
|
||||
|
||||
already_AddRefed<DOMSVGAnimatedTransformList>
|
||||
SVGTransformableElement::Transform()
|
||||
@ -46,7 +46,7 @@ SVGTransformableElement::IsAttributeMapped(const nsIAtom* name) const
|
||||
};
|
||||
|
||||
return FindAttributeDependence(name, map) ||
|
||||
SVGLocatableElement::IsAttributeMapped(name);
|
||||
nsSVGElement::IsAttributeMapped(name);
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
@ -54,7 +54,7 @@ SVGTransformableElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||
int32_t aModType) const
|
||||
{
|
||||
nsChangeHint retval =
|
||||
SVGLocatableElement::GetAttributeChangeHint(aAttribute, aModType);
|
||||
nsSVGElement::GetAttributeChangeHint(aAttribute, aModType);
|
||||
if (aAttribute == nsGkAtoms::transform ||
|
||||
aAttribute == nsGkAtoms::mozAnimateMotionDummyAttr) {
|
||||
// We add nsChangeHint_UpdateOverflow so that nsFrame::UpdateOverflow()
|
||||
@ -148,6 +148,83 @@ SVGTransformableElement::GetAnimatedTransformList(uint32_t aFlags)
|
||||
return mTransforms;
|
||||
}
|
||||
|
||||
nsSVGElement*
|
||||
SVGTransformableElement::GetNearestViewportElement()
|
||||
{
|
||||
return SVGContentUtils::GetNearestViewportElement(this);
|
||||
}
|
||||
|
||||
nsSVGElement*
|
||||
SVGTransformableElement::GetFarthestViewportElement()
|
||||
{
|
||||
return SVGContentUtils::GetOuterSVGElement(this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGRect>
|
||||
SVGTransformableElement::GetBBox(ErrorResult& rv)
|
||||
{
|
||||
nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
|
||||
|
||||
if (!frame || (frame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
|
||||
rv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsISVGChildFrame* svgframe = do_QueryFrame(frame);
|
||||
if (!svgframe) {
|
||||
rv.Throw(NS_ERROR_NOT_IMPLEMENTED); // XXX: outer svg
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMSVGRect> rect;
|
||||
rv = NS_NewSVGRect(getter_AddRefs(rect), nsSVGUtils::GetBBox(frame));
|
||||
return rect.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<SVGMatrix>
|
||||
SVGTransformableElement::GetCTM()
|
||||
{
|
||||
nsIDocument* currentDoc = GetCurrentDoc();
|
||||
if (currentDoc) {
|
||||
// Flush all pending notifications so that our frames are up to date
|
||||
currentDoc->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
gfxMatrix m = SVGContentUtils::GetCTM(this, false);
|
||||
nsCOMPtr<SVGMatrix> mat = m.IsSingular() ? nullptr : new SVGMatrix(m);
|
||||
return mat.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<SVGMatrix>
|
||||
SVGTransformableElement::GetScreenCTM()
|
||||
{
|
||||
nsIDocument* currentDoc = GetCurrentDoc();
|
||||
if (currentDoc) {
|
||||
// Flush all pending notifications so that our frames are up to date
|
||||
currentDoc->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
gfxMatrix m = SVGContentUtils::GetCTM(this, true);
|
||||
nsCOMPtr<SVGMatrix> mat = m.IsSingular() ? nullptr : new SVGMatrix(m);
|
||||
return mat.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<SVGMatrix>
|
||||
SVGTransformableElement::GetTransformToElement(SVGGraphicsElement& aElement,
|
||||
ErrorResult& rv)
|
||||
{
|
||||
// the easiest way to do this (if likely to increase rounding error):
|
||||
nsCOMPtr<SVGMatrix> ourScreenCTM = GetScreenCTM();
|
||||
nsCOMPtr<SVGMatrix> targetScreenCTM = aElement.GetScreenCTM();
|
||||
if (!ourScreenCTM || !targetScreenCTM) {
|
||||
rv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<SVGMatrix> tmp = targetScreenCTM->Inverse(rv);
|
||||
if (rv.Failed()) return nullptr;
|
||||
|
||||
nsCOMPtr<SVGMatrix> mat = tmp->Multiply(*ourScreenCTM).get();
|
||||
return mat.forget();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -6,30 +6,38 @@
|
||||
#ifndef SVGTransformableElement_h
|
||||
#define SVGTransformableElement_h
|
||||
|
||||
#include "mozilla/dom/SVGLocatableElement.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "SVGAnimatedTransformList.h"
|
||||
|
||||
#define MOZILLA_SVGTRANSFORMABLEELEMENT_IID \
|
||||
{ 0x77888cba, 0x0b43, 0x4654, \
|
||||
{0x96, 0x3c, 0xf5, 0x50, 0xfc, 0xb5, 0x5e, 0x32}}
|
||||
class nsIDOMSVGRect;
|
||||
|
||||
namespace mozilla {
|
||||
class DOMSVGAnimatedTransformList;
|
||||
|
||||
namespace dom {
|
||||
class SVGTransformableElement : public SVGLocatableElement
|
||||
|
||||
class SVGGraphicsElement;
|
||||
class SVGMatrix;
|
||||
|
||||
class SVGTransformableElement : public nsSVGElement
|
||||
{
|
||||
public:
|
||||
SVGTransformableElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGLocatableElement(aNodeInfo) {}
|
||||
: nsSVGElement(aNodeInfo) {}
|
||||
virtual ~SVGTransformableElement() {}
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_SVGTRANSFORMABLEELEMENT_IID)
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<DOMSVGAnimatedTransformList> Transform();
|
||||
nsSVGElement* GetNearestViewportElement();
|
||||
nsSVGElement* GetFarthestViewportElement();
|
||||
already_AddRefed<nsIDOMSVGRect> GetBBox(ErrorResult& rv);
|
||||
already_AddRefed<SVGMatrix> GetCTM();
|
||||
already_AddRefed<SVGMatrix> GetScreenCTM();
|
||||
already_AddRefed<SVGMatrix> GetTransformToElement(SVGGraphicsElement& aElement,
|
||||
ErrorResult& rv);
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
@ -61,9 +69,6 @@ protected:
|
||||
nsAutoPtr<gfxMatrix> mAnimateMotionTransform;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(SVGTransformableElement,
|
||||
MOZILLA_SVGTRANSFORMABLEELEMENT_IID)
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -652,6 +652,7 @@ DOMInterfaces = {
|
||||
|
||||
'SVGGraphicsElement': {
|
||||
'concrete': False,
|
||||
'resultNotAddRefed': ['nearestViewportElement', 'farthestViewportElement']
|
||||
},
|
||||
|
||||
'SVGGradientElement': {
|
||||
@ -662,11 +663,6 @@ DOMInterfaces = {
|
||||
'hasInstanceInterface': 'nsIDOMSVGImageElement',
|
||||
},
|
||||
|
||||
'SVGLocatableElement': {
|
||||
'concrete': False,
|
||||
'resultNotAddRefed': ['nearestViewportElement', 'farthestViewportElement']
|
||||
},
|
||||
|
||||
'SVGLengthList': {
|
||||
'nativeType': 'mozilla::DOMSVGLengthList',
|
||||
'headerFile': 'DOMSVGLengthList.h',
|
||||
@ -828,10 +824,6 @@ DOMInterfaces = {
|
||||
'resultNotAddRefed': [ 'matrix' ]
|
||||
},
|
||||
|
||||
'SVGTransformableElement': {
|
||||
'concrete': False
|
||||
},
|
||||
|
||||
'SVGTransformList': {
|
||||
'nativeType': 'mozilla::DOMSVGTransformList',
|
||||
'headerFile': 'DOMSVGTransformList.h',
|
||||
|
@ -10,7 +10,20 @@
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGGraphicsElement : SVGTransformableElement {
|
||||
interface SVGGraphicsElement : SVGElement {
|
||||
readonly attribute SVGAnimatedTransformList transform;
|
||||
|
||||
readonly attribute SVGElement? nearestViewportElement;
|
||||
readonly attribute SVGElement? farthestViewportElement;
|
||||
|
||||
[Throws]
|
||||
SVGRect getBBox();
|
||||
// Not implemented
|
||||
// SVGRect getStrokeBBox();
|
||||
SVGMatrix? getCTM();
|
||||
SVGMatrix? getScreenCTM();
|
||||
[Throws]
|
||||
SVGMatrix getTransformToElement(SVGGraphicsElement element);
|
||||
};
|
||||
|
||||
SVGGraphicsElement implements SVGTests;
|
||||
|
@ -1,29 +0,0 @@
|
||||
/* -*- Mode: IDL; 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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.w3.org/TR/SVG2/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGRect;
|
||||
|
||||
interface SVGLocatableElement : SVGElement {
|
||||
|
||||
readonly attribute SVGElement? nearestViewportElement;
|
||||
readonly attribute SVGElement? farthestViewportElement;
|
||||
|
||||
[Throws]
|
||||
SVGRect getBBox();
|
||||
// Not implemented
|
||||
// SVGRect getStrokeBBox();
|
||||
SVGMatrix? getCTM();
|
||||
SVGMatrix? getScreenCTM();
|
||||
[Throws]
|
||||
SVGMatrix getTransformToElement(SVGLocatableElement element);
|
||||
};
|
||||
|
@ -1,16 +0,0 @@
|
||||
/* -*- Mode: IDL; 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/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.w3.org/TR/SVG2/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGTransformableElement : SVGLocatableElement {
|
||||
readonly attribute SVGAnimatedTransformList transform;
|
||||
};
|
||||
|
@ -132,7 +132,6 @@ webidl_files = \
|
||||
SVGLengthList.webidl \
|
||||
SVGLinearGradientElement.webidl \
|
||||
SVGLineElement.webidl \
|
||||
SVGLocatableElement.webidl \
|
||||
SVGMarkerElement.webidl \
|
||||
SVGMaskElement.webidl \
|
||||
SVGMatrix.webidl \
|
||||
@ -164,7 +163,6 @@ webidl_files = \
|
||||
SVGTextPositioningElement.webidl \
|
||||
SVGTitleElement.webidl \
|
||||
SVGTransform.webidl \
|
||||
SVGTransformableElement.webidl \
|
||||
SVGTransformList.webidl \
|
||||
SVGTSpanElement.webidl \
|
||||
SVGUnitTypes.webidl \
|
||||
|
Loading…
Reference in New Issue
Block a user