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

LCOV - code coverage report
| Current view: | directory - content/svg/content/src - nsSVGTextContentElement.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 67 | 0 | 0.0 %
| Date: | 2012-06-02 | Functions: | 14 | 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
          18                 :  * Arpad Borsos <arpad.borsos@googlemail.com>
          19                 :  * Portions created by the Initial Developer are Copyright (C) 2009
          20                 :  * the Initial Developer. All Rights Reserved.
          21                 :  *
          22                 :  * Contributor(s):
          23                 :  *   Arpad Borsos <arpad.borsos@googlemail.com> (original author)
          24                 :  *
          25                 :  * Alternatively, the contents of this file may be used under the terms of
          26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          29                 :  * of those above. If you wish to allow use of your version of this file only
          30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          31                 :  * use your version of this file under the terms of the MPL, indicate your
          32                 :  * decision by deleting the provisions above and replace them with the notice
          33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          34                 :  * the provisions above, a recipient may use your version of this file under
          35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          36                 :  *
          37                 :  * ***** END LICENSE BLOCK ***** */
          38                 :
          39                 : #include "nsSVGTextContentElement.h"
          40                 : #include "DOMSVGPoint.h"
          41                 :
          42                 : using namespace mozilla;
          43                 :
          44                 : //----------------------------------------------------------------------
          45                 : // nsISupports methods
          46                 :
          47               0 : NS_IMPL_ADDREF_INHERITED(nsSVGTextContentElement, nsSVGTextContentElementBase)
          48               0 : NS_IMPL_RELEASE_INHERITED(nsSVGTextContentElement, nsSVGTextContentElementBase)
          49                 :
          50               0 : NS_INTERFACE_MAP_BEGIN(nsSVGTextContentElement)
          51               0 :   NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTests)
          52               0 : NS_INTERFACE_MAP_END_INHERITING(nsSVGTextContentElementBase)
          53                 :
          54                 : /* readonly attribute nsIDOMSVGAnimatedLength textLength; */
          55               0 : NS_IMETHODIMP nsSVGTextContentElement::GetTextLength(nsIDOMSVGAnimatedLength * *aTextLength)
          56                 : {
          57               0 :   NS_NOTYETIMPLEMENTED("nsSVGTextContentElement::GetTextLength");
          58               0 :   return NS_ERROR_NOT_IMPLEMENTED;
          59                 : }
          60                 :
          61                 : /* readonly attribute nsIDOMSVGAnimatedEnumeration lengthAdjust; */
          62               0 : NS_IMETHODIMP nsSVGTextContentElement::GetLengthAdjust(nsIDOMSVGAnimatedEnumeration * *aLengthAdjust)
          63                 : {
          64               0 :   NS_NOTYETIMPLEMENTED("nsSVGTextContentElement::GetLengthAdjust");
          65               0 :   return NS_ERROR_NOT_IMPLEMENTED;
          66                 : }
          67                 :
          68                 : /* long getNumberOfChars (); */
          69               0 : NS_IMETHODIMP nsSVGTextContentElement::GetNumberOfChars(PRInt32 *_retval)
          70                 : {
          71               0 :   *_retval = 0;
          72                 :
          73               0 :   nsSVGTextContainerFrame* metrics = GetTextContainerFrame();
          74               0 :   if (metrics)
          75               0 :     *_retval = metrics->GetNumberOfChars();
          76                 :
          77               0 :   return NS_OK;
          78                 : }
          79                 :
          80                 : /* float getComputedTextLength (); */
          81               0 : NS_IMETHODIMP nsSVGTextContentElement::GetComputedTextLength(float *_retval)
          82                 : {
          83               0 :   *_retval = 0.0;
          84                 :
          85               0 :   nsSVGTextContainerFrame* metrics = GetTextContainerFrame();
          86               0 :   if (metrics)
          87               0 :     *_retval = metrics->GetComputedTextLength();
          88                 :
          89               0 :   return NS_OK;
          90                 : }
          91                 :
          92                 : /* float getSubStringLength (in unsigned long charnum, in unsigned long nchars); */
          93               0 : NS_IMETHODIMP nsSVGTextContentElement::GetSubStringLength(PRUint32 charnum, PRUint32 nchars, float *_retval)
          94                 : {
          95               0 :   *_retval = 0.0f;
          96               0 :   nsSVGTextContainerFrame* metrics = GetTextContainerFrame();
          97               0 :   if (!metrics)
          98               0 :     return NS_OK;
          99                 :
         100               0 :   PRUint32 charcount = metrics->GetNumberOfChars();
         101               0 :   if (charcount <= charnum || nchars > charcount - charnum)
         102               0 :     return NS_ERROR_DOM_INDEX_SIZE_ERR;
         103                 :
         104               0 :   if (nchars == 0)
         105               0 :     return NS_OK;
         106                 :
         107               0 :   *_retval = metrics->GetSubStringLength(charnum, nchars);
         108               0 :   return NS_OK;
         109                 : }
         110                 :
         111                 : /* nsIDOMSVGPoint getStartPositionOfChar (in unsigned long charnum); */
         112               0 : NS_IMETHODIMP nsSVGTextContentElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
         113                 : {
         114               0 :   *_retval = nsnull;
         115               0 :   nsSVGTextContainerFrame* metrics = GetTextContainerFrame();
         116                 :
         117               0 :   if (!metrics) return NS_ERROR_FAILURE;
         118                 :
         119               0 :   return metrics->GetStartPositionOfChar(charnum, _retval);
         120                 : }
         121                 :
         122                 : /* nsIDOMSVGPoint getEndPositionOfChar (in unsigned long charnum); */
         123               0 : NS_IMETHODIMP nsSVGTextContentElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
         124                 : {
         125               0 :   *_retval = nsnull;
         126               0 :   nsSVGTextContainerFrame* metrics = GetTextContainerFrame();
         127                 :
         128               0 :   if (!metrics) return NS_ERROR_FAILURE;
         129                 :
         130               0 :   return metrics->GetEndPositionOfChar(charnum, _retval);
         131                 : }
         132                 :
         133                 : /* nsIDOMSVGRect getExtentOfChar (in unsigned long charnum); */
         134               0 : NS_IMETHODIMP nsSVGTextContentElement::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval)
         135                 : {
         136               0 :   *_retval = nsnull;
         137               0 :   nsSVGTextContainerFrame* metrics = GetTextContainerFrame();
         138                 :
         139               0 :   if (!metrics) return NS_ERROR_FAILURE;
         140                 :
         141               0 :   return metrics->GetExtentOfChar(charnum, _retval);
         142                 : }
         143                 :
         144                 : /* float getRotationOfChar (in unsigned long charnum); */
         145               0 : NS_IMETHODIMP nsSVGTextContentElement::GetRotationOfChar(PRUint32 charnum, float *_retval)
         146                 : {
         147               0 :   *_retval = 0.0;
         148                 :
         149               0 :   nsSVGTextContainerFrame* metrics = GetTextContainerFrame();
         150                 :
         151               0 :   if (!metrics) return NS_ERROR_FAILURE;
         152                 :
         153               0 :   return metrics->GetRotationOfChar(charnum, _retval);
         154                 : }
         155                 :
         156                 : /* long getCharNumAtPosition (in nsIDOMSVGPoint point); */
         157               0 : NS_IMETHODIMP nsSVGTextContentElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, PRInt32 *_retval)
         158                 : {
         159               0 :   nsCOMPtr<DOMSVGPoint> p = do_QueryInterface(point);
         160               0 :   if (!p)
         161               0 :     return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
         162                 :
         163               0 :   *_retval = -1;
         164                 :
         165               0 :   nsSVGTextContainerFrame* metrics = GetTextContainerFrame();
         166               0 :   if (metrics)
         167               0 :     *_retval = metrics->GetCharNumAtPosition(point);
         168                 :
         169               0 :   return NS_OK;
         170                 : }
         171                 :
         172                 : /* void selectSubString (in unsigned long charnum, in unsigned long nchars); */
         173               0 : NS_IMETHODIMP nsSVGTextContentElement::SelectSubString(PRUint32 charnum, PRUint32 nchars)
         174                 : {
         175               0 :   NS_NOTYETIMPLEMENTED("nsSVGTextContentElement::SelectSubString");
         176               0 :   return NS_ERROR_NOT_IMPLEMENTED;
         177                 : }

Generated by: LCOV version 1.7