LCOV - app.info - content/svg/content/src/nsSVGAltGlyphElement.cpp

LCOV - code coverage report
| Current view: | directory - content/svg/content/src - nsSVGAltGlyphElement.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 37 | 0 | 0.0 %
| Date: | 2012-07-07 | Functions: | 93 | 0 | 0.0 %

           1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
           2                 : /* ***** BEGIN LICENSE BLOCK *****
           3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           4                 :  *
           5                 :  * The contents of this file are subject to the Mozilla Public License Version
           6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           7                 :  * the License. You may obtain a copy of the License at
           8                 :  * http://www.mozilla.org/MPL/
           9                 :  *
          10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          12                 :  * for the specific language governing rights and limitations under the
          13                 :  * License.
          14                 :  *
          15                 :  * The Original Code is the Mozilla SVG project.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is Robert Longson.
          18                 :  * Portions created by the Initial Developer are Copyright (C) 2010
          19                 :  * the Initial Developer. All Rights Reserved.
          20                 :  *
          21                 :  * Alternatively, the contents of this file may be used under the terms of
          22                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          23                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          24                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          25                 :  * of those above. If you wish to allow use of your version of this file only
          26                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          27                 :  * use your version of this file under the terms of the MPL, indicate your
          28                 :  * decision by deleting the provisions above and replace them with the notice
          29                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          30                 :  * the provisions above, a recipient may use your version of this file under
          31                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          32                 :  *
          33                 :  * ***** END LICENSE BLOCK ***** */
          34                 :
          35                 : #include "mozilla/Util.h"
          36                 :
          37                 : #include "nsGkAtoms.h"
          38                 : #include "nsIDOMSVGAltGlyphElement.h"
          39                 : #include "nsIDOMSVGURIReference.h"
          40                 : #include "nsSVGString.h"
          41                 : #include "nsSVGTextPositioningElement.h"
          42                 : #include "nsContentUtils.h"
          43                 :
          44                 : using namespace mozilla;
          45                 :
          46                 : typedef nsSVGTextPositioningElement nsSVGAltGlyphElementBase;
          47                 :
          48                 : class nsSVGAltGlyphElement : public nsSVGAltGlyphElementBase, // = nsIDOMSVGTextPositioningElement
          49                 :                              public nsIDOMSVGAltGlyphElement,
          50                 :                              public nsIDOMSVGURIReference
          51               0 : {
          52                 : protected:
          53                 :   friend nsresult NS_NewSVGAltGlyphElement(nsIContent **aResult,
          54                 :                                            already_AddRefed<nsINodeInfo> aNodeInfo);
          55                 :   nsSVGAltGlyphElement(already_AddRefed<nsINodeInfo> aNodeInfo);
          56                 :
          57                 : public:
          58                 :   // interfaces:
          59                 :
          60                 :   NS_DECL_ISUPPORTS_INHERITED
          61                 :   NS_DECL_NSIDOMSVGALTGLYPHELEMENT
          62                 :   NS_DECL_NSIDOMSVGURIREFERENCE
          63                 :
          64                 :   // xxx If xpcom allowed virtual inheritance we wouldn't need to
          65                 :   // forward here :-(
          66               0 :   NS_FORWARD_NSIDOMNODE(nsSVGAltGlyphElementBase::)
          67               0 :   NS_FORWARD_NSIDOMELEMENT(nsSVGAltGlyphElementBase::)
          68               0 :   NS_FORWARD_NSIDOMSVGELEMENT(nsSVGAltGlyphElementBase::)
          69               0 :   NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGAltGlyphElementBase::)
          70               0 :   NS_FORWARD_NSIDOMSVGTEXTPOSITIONINGELEMENT(nsSVGAltGlyphElementBase::)
          71                 :
          72                 :   // nsIContent interface
          73                 :   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
          74                 :
          75                 :   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
          76                 :
          77                 :   virtual nsXPCClassInfo* GetClassInfo();
          78                 : protected:
          79                 :
          80                 :   // nsSVGElement overrides
          81                 :   virtual StringAttributesInfo GetStringInfo();
          82                 :
          83                 :   virtual bool IsEventName(nsIAtom* aName);
          84                 :
          85                 :   enum { HREF };
          86                 :   nsSVGString mStringAttributes[1];
          87                 :   static StringInfo sStringInfo[1];
          88                 :
          89                 : };
          90                 :
          91                 : nsSVGElement::StringInfo nsSVGAltGlyphElement::sStringInfo[1] =
          92                 : {
          93                 :   { &nsGkAtoms::href, kNameSpaceID_XLink, false }
          94                 : };
          95                 :
          96               0 : NS_IMPL_NS_NEW_SVG_ELEMENT(AltGlyph)
          97                 :
          98                 : //----------------------------------------------------------------------
          99                 : // nsISupports methods
         100                 :
         101               0 : NS_IMPL_ADDREF_INHERITED(nsSVGAltGlyphElement,nsSVGAltGlyphElementBase)
         102               0 : NS_IMPL_RELEASE_INHERITED(nsSVGAltGlyphElement,nsSVGAltGlyphElementBase)
         103                 :
         104               0 : DOMCI_NODE_DATA(SVGAltGlyphElement, nsSVGAltGlyphElement)
         105                 :
         106               0 : NS_INTERFACE_TABLE_HEAD(nsSVGAltGlyphElement)
         107               0 :   NS_NODE_INTERFACE_TABLE8(nsSVGAltGlyphElement, nsIDOMNode, nsIDOMElement,
         108                 :                            nsIDOMSVGElement, nsIDOMSVGAltGlyphElement,
         109                 :                            nsIDOMSVGTextPositioningElement, nsIDOMSVGTextContentElement,
         110                 :                            nsIDOMSVGTests,
         111                 :                            nsIDOMSVGURIReference)
         112               0 :   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGAltGlyphElement)
         113               0 : NS_INTERFACE_MAP_END_INHERITING(nsSVGAltGlyphElementBase)
         114                 :
         115                 : //----------------------------------------------------------------------
         116                 : // Implementation
         117                 :
         118               0 : nsSVGAltGlyphElement::nsSVGAltGlyphElement(already_AddRefed<nsINodeInfo> aNodeInfo)
         119               0 :   : nsSVGAltGlyphElementBase(aNodeInfo)
         120                 : {
         121               0 : }
         122                 :
         123                 :
         124                 : //----------------------------------------------------------------------
         125                 : // nsIDOMNode methods
         126                 :
         127               0 : NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGAltGlyphElement)
         128                 :
         129                 : //----------------------------------------------------------------------
         130                 : // nsIDOMSVGURIReference methods
         131                 :
         132                 : /* readonly attribute nsIDOMSVGAnimatedString href; */
         133               0 : NS_IMETHODIMP nsSVGAltGlyphElement::GetHref(nsIDOMSVGAnimatedString * *aHref)
         134                 : {
         135               0 :   return mStringAttributes[HREF].ToDOMAnimatedString(aHref, this);
         136                 : }
         137                 :
         138                 : //----------------------------------------------------------------------
         139                 : // nsIDOMSVGAltGlyphElement methods
         140                 :
         141                 : /* attribute DOMString glyphRef; */
         142               0 : NS_IMETHODIMP nsSVGAltGlyphElement::GetGlyphRef(nsAString & aGlyphRef)
         143                 : {
         144               0 :   GetAttr(kNameSpaceID_None, nsGkAtoms::glyphRef, aGlyphRef);
         145                 :
         146               0 :   return NS_OK;
         147                 : }
         148                 :
         149               0 : NS_IMETHODIMP nsSVGAltGlyphElement::SetGlyphRef(const nsAString & aGlyphRef)
         150                 : {
         151               0 :   return SetAttr(kNameSpaceID_None, nsGkAtoms::glyphRef, aGlyphRef, true);
         152                 : }
         153                 :
         154                 : /* attribute DOMString format; */
         155               0 : NS_IMETHODIMP nsSVGAltGlyphElement::GetFormat(nsAString & aFormat)
         156                 : {
         157               0 :   GetAttr(kNameSpaceID_None, nsGkAtoms::format, aFormat);
         158                 :
         159               0 :   return NS_OK;
         160                 : }
         161                 :
         162               0 : NS_IMETHODIMP nsSVGAltGlyphElement::SetFormat(const nsAString & aFormat)
         163                 : {
         164               0 :   return SetAttr(kNameSpaceID_None, nsGkAtoms::format, aFormat, true);
         165                 : }
         166                 :
         167                 : //----------------------------------------------------------------------
         168                 : // nsIContent methods
         169                 :
         170                 : NS_IMETHODIMP_(bool)
         171               0 : nsSVGAltGlyphElement::IsAttributeMapped(const nsIAtom* name) const
         172                 : {
         173                 :   static const MappedAttributeEntry* const map[] = {
         174                 :     sColorMap,
         175                 :     sFillStrokeMap,
         176                 :     sFontSpecificationMap,
         177                 :     sGraphicsMap,
         178                 :     sTextContentElementsMap
         179                 :   };
         180                 :
         181               0 :   return FindAttributeDependence(name, map) ||
         182               0 :     nsSVGAltGlyphElementBase::IsAttributeMapped(name);
         183                 : }
         184                 :
         185                 : //----------------------------------------------------------------------
         186                 : // nsSVGElement overrides
         187                 :
         188                 : bool
         189               0 : nsSVGAltGlyphElement::IsEventName(nsIAtom* aName)
         190                 : {
         191               0 :   return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
         192                 : }
         193                 :
         194                 : nsSVGElement::StringAttributesInfo
         195               0 : nsSVGAltGlyphElement::GetStringInfo()
         196                 : {
         197                 :   return StringAttributesInfo(mStringAttributes, sStringInfo,
         198               0 :                               ArrayLength(sStringInfo));
         199                 : }

Generated by: LCOV version 1.7