mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 456286 - support altGlyph elements as tspans. r=roc
This commit is contained in:
parent
6e91448d6a
commit
eb179fd968
@ -52,6 +52,7 @@ CPPSRCS = \
|
||||
nsDOMSVGZoomEvent.cpp \
|
||||
nsDOMSVGEvent.cpp \
|
||||
nsSVGAElement.cpp \
|
||||
nsSVGAltGlyphElement.cpp \
|
||||
nsSVGAngle.cpp \
|
||||
nsSVGAnimatedLengthList.cpp \
|
||||
nsSVGAnimatedNumberList.cpp \
|
||||
@ -113,6 +114,7 @@ CPPSRCS = \
|
||||
nsSVGTextContentElement.cpp \
|
||||
nsSVGTextElement.cpp \
|
||||
nsSVGTextPathElement.cpp \
|
||||
nsSVGTextPositioningElement.cpp \
|
||||
nsSVGTitleElement.cpp \
|
||||
nsSVGTransform.cpp \
|
||||
nsSVGTransformList.cpp \
|
||||
|
209
content/svg/content/src/nsSVGAltGlyphElement.cpp
Normal file
209
content/svg/content/src/nsSVGAltGlyphElement.cpp
Normal file
@ -0,0 +1,209 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Robert Longson.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsSVGStylableElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDOMSVGAltGlyphElement.h"
|
||||
#include "nsIDOMSVGURIReference.h"
|
||||
#include "nsSVGString.h"
|
||||
#include "nsSVGTextPositioningElement.h"
|
||||
|
||||
typedef nsSVGStylableElement nsSVGAltGlyphElementBase;
|
||||
|
||||
class nsSVGAltGlyphElement : public nsSVGAltGlyphElementBase,
|
||||
public nsIDOMSVGAltGlyphElement,
|
||||
public nsIDOMSVGURIReference,
|
||||
public nsSVGTextPositioningElement // = nsIDOMSVGTextPositioningElement
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGAltGlyphElement(nsIContent **aResult,
|
||||
nsINodeInfo *aNodeInfo);
|
||||
nsSVGAltGlyphElement(nsINodeInfo* aNodeInfo);
|
||||
nsresult Init();
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGALTGLYPHELEMENT
|
||||
NS_DECL_NSIDOMSVGURIREFERENCE
|
||||
|
||||
// xxx If xpcom allowed virtual inheritance we wouldn't need to
|
||||
// forward here :-(
|
||||
NS_FORWARD_NSIDOMNODE(nsSVGAltGlyphElementBase::)
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGAltGlyphElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGAltGlyphElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGTextContentElement::)
|
||||
NS_FORWARD_NSIDOMSVGTEXTPOSITIONINGELEMENT(nsSVGTextPositioningElement::)
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
protected:
|
||||
virtual nsSVGTextContainerFrame* GetTextContainerFrame() {
|
||||
return do_QueryFrame(GetPrimaryFrame(Flush_Layout));
|
||||
}
|
||||
|
||||
// nsSVGElement overrides
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
|
||||
virtual PRBool IsEventName(nsIAtom* aName);
|
||||
|
||||
enum { HREF };
|
||||
nsSVGString mStringAttributes[1];
|
||||
static StringInfo sStringInfo[1];
|
||||
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo nsSVGAltGlyphElement::sStringInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::href, kNameSpaceID_XLink }
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(AltGlyph)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGAltGlyphElement,nsSVGAltGlyphElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGAltGlyphElement,nsSVGAltGlyphElementBase)
|
||||
|
||||
DOMCI_DATA(SVGAltGlyphElement, nsSVGAltGlyphElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGAltGlyphElement)
|
||||
NS_NODE_INTERFACE_TABLE7(nsSVGAltGlyphElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement, nsIDOMSVGAltGlyphElement,
|
||||
nsIDOMSVGTextPositioningElement, nsIDOMSVGTextContentElement,
|
||||
nsIDOMSVGURIReference)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGAltGlyphElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGAltGlyphElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGAltGlyphElement::nsSVGAltGlyphElement(nsINodeInfo *aNodeInfo)
|
||||
: nsSVGAltGlyphElementBase(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGAltGlyphElement::Init()
|
||||
{
|
||||
nsresult rv = nsSVGAltGlyphElementBase::Init();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = Initialise(this);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGAltGlyphElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGURIReference methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedString href; */
|
||||
NS_IMETHODIMP nsSVGAltGlyphElement::GetHref(nsIDOMSVGAnimatedString * *aHref)
|
||||
{
|
||||
return mStringAttributes[HREF].ToDOMAnimatedString(aHref, this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGAltGlyphElement methods
|
||||
|
||||
/* attribute DOMString glyphRef; */
|
||||
NS_IMETHODIMP nsSVGAltGlyphElement::GetGlyphRef(nsAString & aGlyphRef)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::glyphRef, aGlyphRef);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSVGAltGlyphElement::SetGlyphRef(const nsAString & aGlyphRef)
|
||||
{
|
||||
return SetAttr(kNameSpaceID_None, nsGkAtoms::glyphRef, aGlyphRef, PR_TRUE);
|
||||
}
|
||||
|
||||
/* attribute DOMString format; */
|
||||
NS_IMETHODIMP nsSVGAltGlyphElement::GetFormat(nsAString & aFormat)
|
||||
{
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::format, aFormat);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsSVGAltGlyphElement::SetFormat(const nsAString & aFormat)
|
||||
{
|
||||
return SetAttr(kNameSpaceID_None, nsGkAtoms::format, aFormat, PR_TRUE);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsSVGAltGlyphElement::IsAttributeMapped(const nsIAtom* name) const
|
||||
{
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
sColorMap,
|
||||
sFillStrokeMap,
|
||||
sFontSpecificationMap,
|
||||
sGraphicsMap,
|
||||
sTextContentElementsMap
|
||||
};
|
||||
|
||||
return FindAttributeDependence(name, map, NS_ARRAY_LENGTH(map)) ||
|
||||
nsSVGAltGlyphElementBase::IsAttributeMapped(name);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement overrides
|
||||
|
||||
PRBool
|
||||
nsSVGAltGlyphElement::IsEventName(nsIAtom* aName)
|
||||
{
|
||||
return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
|
||||
}
|
||||
|
||||
nsSVGElement::StringAttributesInfo
|
||||
nsSVGAltGlyphElement::GetStringInfo()
|
||||
{
|
||||
return StringAttributesInfo(mStringAttributes, sStringInfo,
|
||||
NS_ARRAY_LENGTH(sStringInfo));
|
||||
}
|
@ -189,6 +189,7 @@ protected:
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue);
|
||||
|
||||
friend class nsSVGTextPositioningElement;
|
||||
// Hooks for subclasses
|
||||
virtual PRBool IsEventName(nsIAtom* aName);
|
||||
|
||||
|
@ -50,6 +50,8 @@
|
||||
nsresult
|
||||
NS_NewSVGAElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
|
||||
nsresult
|
||||
NS_NewSVGAltGlyphElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
|
||||
nsresult
|
||||
NS_NewSVGPolylineElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
|
||||
nsresult
|
||||
NS_NewSVGPolygonElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
|
||||
@ -189,6 +191,8 @@ NS_NewSVGElement(nsIContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
|
||||
if (name == nsGkAtoms::a)
|
||||
return NS_NewSVGAElement(aResult, aNodeInfo);
|
||||
if (name == nsGkAtoms::altGlyph)
|
||||
return NS_NewSVGAltGlyphElement(aResult, aNodeInfo);
|
||||
if (name == nsGkAtoms::polyline)
|
||||
return NS_NewSVGPolylineElement(aResult, aNodeInfo);
|
||||
if (name == nsGkAtoms::polygon)
|
||||
|
@ -39,21 +39,14 @@
|
||||
#include "nsSVGStylableElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDOMSVGTSpanElement.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsSVGAnimatedLengthList.h"
|
||||
#include "nsSVGAnimatedNumberList.h"
|
||||
#include "nsSVGLengthList.h"
|
||||
#include "nsSVGNumberList.h"
|
||||
#include "nsSVGSVGElement.h"
|
||||
#include "nsSVGTextContentElement.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsSVGTextPositioningElement.h"
|
||||
|
||||
typedef nsSVGStylableElement nsSVGTSpanElementBase;
|
||||
|
||||
class nsSVGTSpanElement : public nsSVGTSpanElementBase,
|
||||
public nsIDOMSVGTSpanElement, // : nsIDOMSVGTextPositioningElement
|
||||
public nsSVGTextContentElement // = nsIDOMSVGTextContentElement
|
||||
public nsIDOMSVGTSpanElement,
|
||||
public nsSVGTextPositioningElement // = nsIDOMSVGTextPositioningElement
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGTSpanElement(nsIContent **aResult,
|
||||
@ -66,7 +59,6 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGTSPANELEMENT
|
||||
NS_DECL_NSIDOMSVGTEXTPOSITIONINGELEMENT
|
||||
|
||||
// xxx If xpcom allowed virtual inheritance we wouldn't need to
|
||||
// forward here :-(
|
||||
@ -74,6 +66,7 @@ public:
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGTSpanElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTSpanElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGTextContentElement::)
|
||||
NS_FORWARD_NSIDOMSVGTEXTPOSITIONINGELEMENT(nsSVGTextPositioningElement::)
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
@ -87,14 +80,6 @@ protected:
|
||||
|
||||
// nsSVGElement overrides
|
||||
virtual PRBool IsEventName(nsIAtom* aName);
|
||||
|
||||
// nsIDOMSVGTextPositioning properties:
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mX;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mY;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mdX;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mdY;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedNumberList> mRotate;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -133,67 +118,8 @@ nsSVGTSpanElement::Init()
|
||||
nsresult rv = nsSVGTSpanElementBase::Init();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// Create mapped properties:
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::x, #IMPLIED attrib: x
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), this, nsSVGUtils::X);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mX),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::x, mX);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::y, #IMPLIED attrib: y
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), this, nsSVGUtils::Y);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mY),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::y, mY);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::dx, #IMPLIED attrib: dx
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), this, nsSVGUtils::X);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mdX),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::dx, mdX);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::dy, #IMPLIED attrib: dy
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), this, nsSVGUtils::Y);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mdY),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::dy, mdY);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::rotate, #IMPLIED attrib: rotate
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGNumberList> numberList;
|
||||
rv = NS_NewSVGNumberList(getter_AddRefs(numberList));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedNumberList(getter_AddRefs(mRotate),
|
||||
numberList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::rotate, mRotate);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
rv = Initialise(this);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
@ -210,49 +136,6 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGTSpanElement)
|
||||
|
||||
// - no methods -
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGTextPositioningElement methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList x; */
|
||||
NS_IMETHODIMP nsSVGTSpanElement::GetX(nsIDOMSVGAnimatedLengthList * *aX)
|
||||
{
|
||||
*aX = mX;
|
||||
NS_IF_ADDREF(*aX);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList y; */
|
||||
NS_IMETHODIMP nsSVGTSpanElement::GetY(nsIDOMSVGAnimatedLengthList * *aY)
|
||||
{
|
||||
*aY = mY;
|
||||
NS_IF_ADDREF(*aY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList dx; */
|
||||
NS_IMETHODIMP nsSVGTSpanElement::GetDx(nsIDOMSVGAnimatedLengthList * *aDx)
|
||||
{
|
||||
*aDx = mdX;
|
||||
NS_IF_ADDREF(*aDx);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList dy; */
|
||||
NS_IMETHODIMP nsSVGTSpanElement::GetDy(nsIDOMSVGAnimatedLengthList * *aDy)
|
||||
{
|
||||
*aDy = mdY;
|
||||
NS_IF_ADDREF(*aDy);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedNumberList rotate; */
|
||||
NS_IMETHODIMP nsSVGTSpanElement::GetRotate(nsIDOMSVGAnimatedNumberList * *aRotate)
|
||||
{
|
||||
*aRotate = mRotate;
|
||||
NS_IF_ADDREF(*aRotate);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
|
@ -40,20 +40,16 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDOMSVGTextElement.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsSVGAnimatedLengthList.h"
|
||||
#include "nsSVGAnimatedNumberList.h"
|
||||
#include "nsSVGLengthList.h"
|
||||
#include "nsSVGNumberList.h"
|
||||
#include "nsSVGSVGElement.h"
|
||||
#include "nsSVGTextContentElement.h"
|
||||
#include "nsSVGTextPositioningElement.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
typedef nsSVGGraphicElement nsSVGTextElementBase;
|
||||
|
||||
class nsSVGTextElement : public nsSVGTextElementBase,
|
||||
public nsIDOMSVGTextElement, // : nsIDOMSVGTextPositioningElement
|
||||
public nsSVGTextContentElement // = nsIDOMSVGTextContentElement
|
||||
public nsIDOMSVGTextElement,
|
||||
public nsSVGTextPositioningElement // = nsIDOMSVGTextPositioningElement
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGTextElement(nsIContent **aResult,
|
||||
@ -66,7 +62,6 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGTEXTELEMENT
|
||||
NS_DECL_NSIDOMSVGTEXTPOSITIONINGELEMENT
|
||||
|
||||
// xxx If xpcom allowed virtual inheritance we wouldn't need to
|
||||
// forward here :-(
|
||||
@ -74,6 +69,7 @@ public:
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGTextElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGTextElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGTextContentElement::)
|
||||
NS_FORWARD_NSIDOMSVGTEXTPOSITIONINGELEMENT(nsSVGTextPositioningElement::)
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
@ -85,13 +81,6 @@ protected:
|
||||
return do_QueryFrame(GetPrimaryFrame(Flush_Layout));
|
||||
}
|
||||
|
||||
// nsIDOMSVGTextPositioning properties:
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mX;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mY;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mdX;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mdY;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedNumberList> mRotate;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -129,67 +118,8 @@ nsSVGTextElement::Init()
|
||||
nsresult rv = nsSVGTextElementBase::Init();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// Create mapped properties:
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::x, #IMPLIED attrib: x
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), this, nsSVGUtils::X);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mX),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::x, mX);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::y, #IMPLIED attrib: y
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), this, nsSVGUtils::Y);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mY),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::y, mY);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::dx, #IMPLIED attrib: dx
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), this, nsSVGUtils::X);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mdX),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::dx, mdX);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::dy, #IMPLIED attrib: dy
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), this, nsSVGUtils::Y);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mdY),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::dy, mdY);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::rotate, #IMPLIED attrib: rotate
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGNumberList> numberList;
|
||||
rv = NS_NewSVGNumberList(getter_AddRefs(numberList));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedNumberList(getter_AddRefs(mRotate),
|
||||
numberList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = AddMappedSVGValue(nsGkAtoms::rotate, mRotate);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
rv = Initialise(this);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
@ -206,49 +136,6 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGTextElement)
|
||||
|
||||
// - no methods -
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGTextPositioningElement methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList x; */
|
||||
NS_IMETHODIMP nsSVGTextElement::GetX(nsIDOMSVGAnimatedLengthList * *aX)
|
||||
{
|
||||
*aX = mX;
|
||||
NS_IF_ADDREF(*aX);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList y; */
|
||||
NS_IMETHODIMP nsSVGTextElement::GetY(nsIDOMSVGAnimatedLengthList * *aY)
|
||||
{
|
||||
*aY = mY;
|
||||
NS_IF_ADDREF(*aY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList dx; */
|
||||
NS_IMETHODIMP nsSVGTextElement::GetDx(nsIDOMSVGAnimatedLengthList * *aDx)
|
||||
{
|
||||
*aDx = mdX;
|
||||
NS_IF_ADDREF(*aDx);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList dy; */
|
||||
NS_IMETHODIMP nsSVGTextElement::GetDy(nsIDOMSVGAnimatedLengthList * *aDy)
|
||||
{
|
||||
*aDy = mdY;
|
||||
NS_IF_ADDREF(*aDy);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedNumberList rotate; */
|
||||
NS_IMETHODIMP nsSVGTextElement::GetRotate(nsIDOMSVGAnimatedNumberList * *aRotate)
|
||||
{
|
||||
*aRotate = mRotate;
|
||||
NS_IF_ADDREF(*aRotate);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
|
152
content/svg/content/src/nsSVGTextPositioningElement.cpp
Normal file
152
content/svg/content/src/nsSVGTextPositioningElement.cpp
Normal file
@ -0,0 +1,152 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Robert Longson <longsonr@gmail.com>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsSVGTextPositioningElement.h"
|
||||
#include "nsSVGAnimatedLengthList.h"
|
||||
#include "nsSVGAnimatedNumberList.h"
|
||||
#include "nsSVGLengthList.h"
|
||||
#include "nsSVGNumberList.h"
|
||||
|
||||
nsresult
|
||||
nsSVGTextPositioningElement::Initialise(nsSVGElement *aSVGElement)
|
||||
{
|
||||
nsresult rv;
|
||||
// Create mapped properties:
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::x, #IMPLIED attrib: x
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), aSVGElement, nsSVGUtils::X);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mX),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = aSVGElement->AddMappedSVGValue(nsGkAtoms::x, mX);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::y, #IMPLIED attrib: y
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), aSVGElement, nsSVGUtils::Y);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mY),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = aSVGElement->AddMappedSVGValue(nsGkAtoms::y, mY);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::dx, #IMPLIED attrib: dx
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), aSVGElement, nsSVGUtils::X);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mdX),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = aSVGElement->AddMappedSVGValue(nsGkAtoms::dx, mdX);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::dy, #IMPLIED attrib: dy
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGLengthList> lengthList;
|
||||
rv = NS_NewSVGLengthList(getter_AddRefs(lengthList), aSVGElement, nsSVGUtils::Y);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedLengthList(getter_AddRefs(mdY),
|
||||
lengthList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = aSVGElement->AddMappedSVGValue(nsGkAtoms::dy, mdY);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
// DOM property: nsIDOMSVGTextPositioningElement::rotate, #IMPLIED attrib: rotate
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGNumberList> numberList;
|
||||
rv = NS_NewSVGNumberList(getter_AddRefs(numberList));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewSVGAnimatedNumberList(getter_AddRefs(mRotate),
|
||||
numberList);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = aSVGElement->AddMappedSVGValue(nsGkAtoms::rotate, mRotate);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGTextPositioningElement methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList x; */
|
||||
NS_IMETHODIMP nsSVGTextPositioningElement::GetX(nsIDOMSVGAnimatedLengthList * *aX)
|
||||
{
|
||||
*aX = mX;
|
||||
NS_IF_ADDREF(*aX);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList y; */
|
||||
NS_IMETHODIMP nsSVGTextPositioningElement::GetY(nsIDOMSVGAnimatedLengthList * *aY)
|
||||
{
|
||||
*aY = mY;
|
||||
NS_IF_ADDREF(*aY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList dx; */
|
||||
NS_IMETHODIMP nsSVGTextPositioningElement::GetDx(nsIDOMSVGAnimatedLengthList * *aDx)
|
||||
{
|
||||
*aDx = mdX;
|
||||
NS_IF_ADDREF(*aDx);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLengthList dy; */
|
||||
NS_IMETHODIMP nsSVGTextPositioningElement::GetDy(nsIDOMSVGAnimatedLengthList * *aDy)
|
||||
{
|
||||
*aDy = mdY;
|
||||
NS_IF_ADDREF(*aDy);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedNumberList rotate; */
|
||||
NS_IMETHODIMP nsSVGTextPositioningElement::GetRotate(nsIDOMSVGAnimatedNumberList * *aRotate)
|
||||
{
|
||||
*aRotate = mRotate;
|
||||
NS_IF_ADDREF(*aRotate);
|
||||
return NS_OK;
|
||||
}
|
60
content/svg/content/src/nsSVGTextPositioningElement.h
Normal file
60
content/svg/content/src/nsSVGTextPositioningElement.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Robert Longson <longsonr@gmail.com>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __NS_SVGTEXTPOSITIONINGELEMENTBASE_H__
|
||||
#define __NS_SVGTEXTPOSITIONINGELEMENTBASE_H__
|
||||
|
||||
#include "nsIDOMSVGTextPositionElem.h"
|
||||
#include "nsSVGTextContentElement.h"
|
||||
#include "nsIDOMSVGAnimatedLengthList.h"
|
||||
#include "nsIDOMSVGAnimatedNumberList.h"
|
||||
|
||||
class nsSVGTextPositioningElement : public nsSVGTextContentElement
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIDOMSVGTEXTPOSITIONINGELEMENT
|
||||
|
||||
protected:
|
||||
nsresult Initialise(nsSVGElement *aSVGElement);
|
||||
|
||||
// nsIDOMSVGTextPositioning properties:
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mX;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mY;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mdX;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mdY;
|
||||
nsCOMPtr<nsIDOMSVGAnimatedNumberList> mRotate;
|
||||
};
|
||||
|
||||
#endif
|
@ -353,6 +353,7 @@
|
||||
#ifdef MOZ_SVG
|
||||
#include "nsIDOMGetSVGDocument.h"
|
||||
#include "nsIDOMSVGAElement.h"
|
||||
#include "nsIDOMSVGAltGlyphElement.h"
|
||||
#include "nsIDOMSVGAngle.h"
|
||||
#include "nsIDOMSVGAnimatedAngle.h"
|
||||
#include "nsIDOMSVGAnimatedBoolean.h"
|
||||
@ -937,6 +938,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
// SVG element classes
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGAElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGAltGlyphElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
#ifdef MOZ_SMIL
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGAnimateElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
@ -2849,6 +2852,16 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGAltGlyphElement, nsIDOMSVGAltGlyphElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTextPositioningElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGTextContentElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGURIReference)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGStylable)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
#ifdef MOZ_SMIL
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGAnimateElement, nsIDOMSVGAnimateElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimationElement)
|
||||
|
@ -230,6 +230,7 @@ DOMCI_CLASS(SVGDocument)
|
||||
|
||||
// SVG element classes
|
||||
DOMCI_CLASS(SVGAElement)
|
||||
DOMCI_CLASS(SVGAltGlyphElement)
|
||||
#ifdef MOZ_SMIL
|
||||
DOMCI_CLASS(SVGAnimateElement)
|
||||
DOMCI_CLASS(SVGAnimateTransformElement)
|
||||
|
@ -52,6 +52,7 @@ XPIDL_MODULE = dom_svg
|
||||
XPIDLSRCS = \
|
||||
nsIDOMGetSVGDocument.idl \
|
||||
nsIDOMSVGAElement.idl \
|
||||
nsIDOMSVGAltGlyphElement.idl \
|
||||
nsIDOMSVGAngle.idl \
|
||||
nsIDOMSVGAnimatedAngle.idl \
|
||||
nsIDOMSVGAnimatedBoolean.idl \
|
||||
@ -63,9 +64,9 @@ XPIDLSRCS = \
|
||||
nsIDOMSVGAnimatedNumberList.idl \
|
||||
nsIDOMSVGAnimatedPathData.idl \
|
||||
nsIDOMSVGAnimatedPoints.idl \
|
||||
nsIDOMSVGAnimatedRect.idl \
|
||||
nsIDOMSVGAnimatedString.idl \
|
||||
nsIDOMSVGAnimPresAspRatio.idl \
|
||||
nsIDOMSVGAnimatedRect.idl \
|
||||
nsIDOMSVGAnimTransformList.idl \
|
||||
nsIDOMSVGCircleElement.idl \
|
||||
nsIDOMSVGClipPathElement.idl \
|
||||
|
55
dom/interfaces/svg/nsIDOMSVGAltGlyphElement.idl
Normal file
55
dom/interfaces/svg/nsIDOMSVGAltGlyphElement.idl
Normal file
@ -0,0 +1,55 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Robert Longson <longsonr@yahoo.com>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMSVGTextPositionElem.idl"
|
||||
|
||||
[scriptable, uuid(b688b5fd-48b6-447c-bb20-766a9392d0d0)]
|
||||
interface nsIDOMSVGAltGlyphElement : nsIDOMSVGTextPositioningElement
|
||||
/*
|
||||
The SVG DOM makes use of multiple interface inheritance.
|
||||
Since XPCOM only supports single interface inheritance,
|
||||
the best thing that we can do is to promise that whenever
|
||||
an object implements _this_ interface it will also
|
||||
implement the following interfaces. (We then have to QI to
|
||||
hop between them.)
|
||||
|
||||
nsIDOMSVGURIReference
|
||||
*/
|
||||
{
|
||||
attribute DOMString glyphRef;
|
||||
// raises DOMException on setting
|
||||
attribute DOMString format;
|
||||
// raises DOMException on setting
|
||||
};
|
@ -4794,7 +4794,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aTag == nsGkAtoms::tspan) {
|
||||
else if (aTag == nsGkAtoms::tspan || aTag == nsGkAtoms::altGlyph) {
|
||||
NS_ASSERTION(aParentFrame, "Should have aParentFrame here");
|
||||
nsIFrame *ancestorFrame =
|
||||
nsSVGUtils::GetFirstNonAAncestorFrame(aParentFrame);
|
||||
@ -4830,6 +4830,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
|
||||
FULL_CTOR_FCDATA(FCDATA_DISALLOW_OUT_OF_FLOW,
|
||||
&nsCSSFrameConstructor::ConstructSVGForeignObjectFrame) },
|
||||
SIMPLE_SVG_CREATE(a, NS_NewSVGAFrame),
|
||||
SIMPLE_SVG_CREATE(altGlyph, NS_NewSVGTSpanFrame),
|
||||
SIMPLE_SVG_CREATE(text, NS_NewSVGTextFrame),
|
||||
SIMPLE_SVG_CREATE(tspan, NS_NewSVGTSpanFrame),
|
||||
SIMPLE_SVG_CREATE(linearGradient, NS_NewSVGLinearGradientFrame),
|
||||
|
14
layout/reftests/svg/altGlyph-01-ref.svg
Normal file
14
layout/reftests/svg/altGlyph-01-ref.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
font-family="monospace" font-size="20" xml:space="preserve">
|
||||
|
||||
<title>Reference to check that that altGlyph falls back to tspan behaviour</title>
|
||||
|
||||
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=456286 -->
|
||||
|
||||
<text><tspan x="20" y="20" rotate="90">T</tspan>EST1</text>
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 464 B |
14
layout/reftests/svg/altGlyph-01.svg
Normal file
14
layout/reftests/svg/altGlyph-01.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||
font-family="monospace" font-size="20" xml:space="preserve">
|
||||
|
||||
<title>Testcase to check that altGlyph falls back to tspan behaviour</title>
|
||||
|
||||
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=456286 -->
|
||||
|
||||
<text><altGlyph x="20" y="20" rotate="90">T</altGlyph>EST1</text>
|
||||
|
||||
</svg>
|
After Width: | Height: | Size: 464 B |
@ -16,6 +16,7 @@ include moz-only/reftest.list
|
||||
# svg-integration tests (using svg effects in e.g. HTML)
|
||||
include svg-integration/reftest.list
|
||||
|
||||
== altGlyph-01.svg altGlyph-01-ref.svg
|
||||
== clip-01.svg pass.svg
|
||||
== clip-02a.svg clip-02-ref.svg
|
||||
== clip-02b.svg clip-02-ref.svg
|
||||
|
@ -37,6 +37,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMSVGTSpanElement.h"
|
||||
#include "nsIDOMSVGAltGlyphElement.h"
|
||||
#include "nsSVGTSpanFrame.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsSVGTextFrame.h"
|
||||
@ -91,7 +92,8 @@ nsSVGTSpanFrame::Init(nsIContent* aContent,
|
||||
"container");
|
||||
|
||||
nsCOMPtr<nsIDOMSVGTSpanElement> tspan = do_QueryInterface(aContent);
|
||||
NS_ASSERTION(tspan, "Content is not an SVG tspan");
|
||||
nsCOMPtr<nsIDOMSVGAltGlyphElement> altGlyph = do_QueryInterface(aContent);
|
||||
NS_ASSERTION(tspan || altGlyph, "Content is not an SVG tspan or altGlyph");
|
||||
}
|
||||
|
||||
return nsSVGTSpanFrameBase::Init(aContent, aParent, aPrevInFlow);
|
||||
|
@ -52,7 +52,7 @@ class nsSVGTSpanFrame : public nsSVGTSpanFrameBase,
|
||||
NS_NewSVGTSpanFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
protected:
|
||||
nsSVGTSpanFrame(nsStyleContext* aContext) :
|
||||
nsSVGTextContainerFrame(aContext) {}
|
||||
nsSVGTSpanFrameBase(aContext) {}
|
||||
|
||||
public:
|
||||
NS_DECL_QUERYFRAME
|
||||
|
Loading…
Reference in New Issue
Block a user