Bug 648094. r=dholbert, a=dveditz.
authorJonathan Watt <jwatt@jwatt.org>
Thu, 16 Jun 2011 14:14:12 +0100
changeset 63473 f5b873872bcd4e26e313bb6cae0785fe4e147b7b
parent 63472 6f4d01073ef81549578425c9c90b29ded2d0d3f2
child 63474 e1727a01dc943f6f5d4bcbbeb84da928850ce02c
push id94
push userjwatt@jwatt.org
push dateTue, 21 Jun 2011 13:13:40 +0000
reviewersdholbert, dveditz
bugs648094
milestone2.0.2pre
Bug 648094. r=dholbert, a=dveditz.
content/svg/content/src/nsSVGTextContentElement.cpp
content/svg/content/src/nsSVGTextElement.cpp
--- a/content/svg/content/src/nsSVGTextContentElement.cpp
+++ b/content/svg/content/src/nsSVGTextContentElement.cpp
@@ -32,16 +32,19 @@
  * 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 "nsSVGTextContentElement.h"
+#include "DOMSVGPoint.h"
+
+using namespace mozilla;
 
 /* readonly attribute nsIDOMSVGAnimatedLength textLength; */
 NS_IMETHODIMP nsSVGTextContentElement::GetTextLength(nsIDOMSVGAnimatedLength * *aTextLength)
 {
   NS_NOTYETIMPLEMENTED("nsSVGTextContentElement::GetTextLength");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
@@ -138,18 +141,18 @@ NS_IMETHODIMP nsSVGTextContentElement::G
   if (!metrics) return NS_ERROR_FAILURE;
 
   return metrics->GetRotationOfChar(charnum, _retval);
 }
 
 /* long getCharNumAtPosition (in nsIDOMSVGPoint point); */
 NS_IMETHODIMP nsSVGTextContentElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, PRInt32 *_retval)
 {
-  // null check when implementing - this method can be used by scripts!
-  if (!point)
+  nsCOMPtr<DOMSVGPoint> p = do_QueryInterface(point);
+  if (!p)
     return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
 
   *_retval = -1;
 
   nsSVGTextContainerFrame* metrics = GetTextContainerFrame();
   if (metrics)
     *_retval = metrics->GetCharNumAtPosition(point);
 
--- a/content/svg/content/src/nsSVGTextElement.cpp
+++ b/content/svg/content/src/nsSVGTextElement.cpp
@@ -45,16 +45,17 @@
 #include "nsIFrame.h"
 #include "nsDOMError.h"
 #include "SVGAnimatedLengthList.h"
 #include "DOMSVGAnimatedLengthList.h"
 #include "SVGLengthList.h"
 #include "SVGNumberList.h"
 #include "SVGAnimatedNumberList.h"
 #include "DOMSVGAnimatedNumberList.h"
+#include "DOMSVGPoint.h"
 
 using namespace mozilla;
 
 typedef nsSVGGraphicElement nsSVGTextElementBase;
 
 /**
  * This class does not inherit nsSVGTextPositioningElement - it reimplements it
  * instead.
@@ -318,17 +319,18 @@ nsSVGTextElement::GetRotationOfChar(PRUi
 
   return metrics->GetRotationOfChar(charnum, _retval);
 }
 
 /* long getCharNumAtPosition (in nsIDOMSVGPoint point); */
 NS_IMETHODIMP
 nsSVGTextElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, PRInt32 *_retval)
 {
-  if (!point)
+  nsCOMPtr<DOMSVGPoint> p = do_QueryInterface(point);
+  if (!p)
     return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
 
   *_retval = -1;
 
   nsSVGTextContainerFrame* metrics = GetTextContainerFrame();
   if (metrics)
     *_retval = metrics->GetCharNumAtPosition(point);