diff --git a/mozilla/content/svg/content/src/nsDOMSVGZoomEvent.cpp b/mozilla/content/svg/content/src/nsDOMSVGZoomEvent.cpp index 688ec08f465..b9c0946d61d 100755 --- a/mozilla/content/svg/content/src/nsDOMSVGZoomEvent.cpp +++ b/mozilla/content/svg/content/src/nsDOMSVGZoomEvent.cpp @@ -39,7 +39,7 @@ #include "nsContentUtils.h" #include "nsSVGRect.h" #include "nsSVGPoint.h" -#include "nsISVGSVGElement.h" +#include "nsSVGSVGElement.h" #include "nsIDOMSVGSVGElement.h" #include "nsIContent.h" #include "nsIPresShell.h" @@ -74,7 +74,7 @@ nsDOMSVGZoomEvent::nsDOMSVGZoomEvent(nsPresContext* aPresContext, if (doc) { nsIContent *rootContent = doc->GetRootContent(); if (rootContent) { - // If the root element isn't an SVG 'svg' element these QIs will fail + // If the root element isn't an SVG 'svg' element this QI will fail // (e.g. if this event was created by calling createEvent on a // non-SVGDocument). In these circumstances the "New" and "Previous" // properties will be left null which is probably what we want. @@ -87,16 +87,16 @@ nsDOMSVGZoomEvent::nsDOMSVGZoomEvent(nsPresContext* aPresContext, currentTranslate->GetX(&x); currentTranslate->GetY(&y); NS_NewSVGReadonlyPoint(getter_AddRefs(mNewTranslate), x, y); - } - nsCOMPtr privSVGElement = do_QueryInterface(rootContent); - if (svgElement) { - mPreviousScale = privSVGElement->GetPreviousScale(); + + nsSVGSVGElement *SVGSVGElement = + NS_STATIC_CAST(nsSVGSVGElement*, rootContent); + mPreviousScale = SVGSVGElement->GetPreviousScale(); NS_NewSVGReadonlyPoint(getter_AddRefs(mPreviousTranslate), - privSVGElement->GetPreviousTranslate_x(), - privSVGElement->GetPreviousTranslate_y()); + SVGSVGElement->GetPreviousTranslate_x(), + SVGSVGElement->GetPreviousTranslate_y()); // Important: we call RecordCurrentST() here to make sure that // scripts that create an SVGZoomEvent won't get our "Previous" data - privSVGElement->RecordCurrentScaleTranslate(); + SVGSVGElement->RecordCurrentScaleTranslate(); } } } diff --git a/mozilla/content/svg/content/src/nsISVGSVGElement.h b/mozilla/content/svg/content/src/nsISVGSVGElement.h deleted file mode 100644 index b6e1e121e53..00000000000 --- a/mozilla/content/svg/content/src/nsISVGSVGElement.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- 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 - * Crocodile Clips Ltd.. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Alex Fritze (original author) - * Jonathan Watt - * - * 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_ISVGSVGELEMENT__ -#define __NS_ISVGSVGELEMENT__ - -#include "nsISupports.h" -#include "nsIDOMSVGSVGElement.h" - -class nsSVGSVGElement; -class nsIDOMSVGNumber; -class nsISVGEnum; - -//////////////////////////////////////////////////////////////////////// -// nsISVGSVGElement: private interface implemented by -elements - -#define NS_ISVGSVGELEMENT_IID \ -{ 0x65195064, 0x9a5f, 0x42df, { 0xa1, 0x1f, 0x4c, 0x05, 0xbc, 0xa4, 0xe7, 0x28 } } - -class nsISVGSVGElement : public nsIDOMSVGSVGElement -{ -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGSVGELEMENT_IID) - - NS_IMETHOD GetCurrentScaleNumber(nsIDOMSVGNumber **aResult)=0; - NS_IMETHOD GetZoomAndPanEnum(nsISVGEnum **aResult)=0; - - /** - * For use by zoom controls to allow currentScale, currentTranslate.x and - * currentTranslate.y to be set by a single operation that dispatches a - * single SVGZoom event (instead of one SVGZoom and two SVGScroll events). - */ - NS_IMETHOD SetCurrentScaleTranslate(float s, float x, float y)=0; - - /** - * For use by pan controls to allow currentTranslate.x and currentTranslate.y - * to be set by a single operation that dispatches a single SVGScroll event - * (instead of two). - */ - NS_IMETHOD SetCurrentTranslate(float x, float y)=0; - - /** - * Record the current values of currentScale, currentTranslate.x and - * currentTranslate.y prior to changing the value of one of them. - */ - NS_IMETHOD_(void) RecordCurrentScaleTranslate()=0; - - /** - * Retrieve the value of currentScale, currentTranslate.x or - * currentTranslate.y prior to the last change made to any one of them. - */ - NS_IMETHOD_(float) GetPreviousScale()=0; - NS_IMETHOD_(float) GetPreviousTranslate_x()=0; - NS_IMETHOD_(float) GetPreviousTranslate_y()=0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsISVGSVGElement, NS_ISVGSVGELEMENT_IID) - -#endif // __NS_ISVGSVGELEMENT__ diff --git a/mozilla/content/svg/content/src/nsSVGElement.cpp b/mozilla/content/svg/content/src/nsSVGElement.cpp index d8bf9748bf5..d90920318d2 100644 --- a/mozilla/content/svg/content/src/nsSVGElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGElement.cpp @@ -55,7 +55,6 @@ #include "nsIXBLService.h" #include "nsGkAtoms.h" #include "nsICSSStyleRule.h" -#include "nsISVGSVGElement.h" #include "nsRuleWalker.h" #include "nsCSSDeclaration.h" #include "nsCSSProps.h" diff --git a/mozilla/content/svg/content/src/nsSVGFilterElement.cpp b/mozilla/content/svg/content/src/nsSVGFilterElement.cpp index b04f846ca5c..4d9f89a25cc 100644 --- a/mozilla/content/svg/content/src/nsSVGFilterElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGFilterElement.cpp @@ -37,7 +37,6 @@ #include "nsGkAtoms.h" #include "nsSVGLength.h" #include "nsCOMPtr.h" -#include "nsISVGSVGElement.h" #include "nsSVGAnimatedEnumeration.h" #include "nsSVGAnimatedInteger.h" #include "nsSVGAnimatedString.h" diff --git a/mozilla/content/svg/content/src/nsSVGForeignObjectElement.cpp b/mozilla/content/svg/content/src/nsSVGForeignObjectElement.cpp index b222d43eeef..b2c4b0b33b2 100644 --- a/mozilla/content/svg/content/src/nsSVGForeignObjectElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGForeignObjectElement.cpp @@ -38,7 +38,6 @@ #include "nsSVGLength.h" #include "nsCOMPtr.h" -#include "nsISVGSVGElement.h" #include "nsSVGForeignObjectElement.h" nsSVGElement::LengthInfo nsSVGForeignObjectElement::sLengthInfo[4] = diff --git a/mozilla/content/svg/content/src/nsSVGGradientElement.cpp b/mozilla/content/svg/content/src/nsSVGGradientElement.cpp index cdf8f515f94..1d63da3656b 100644 --- a/mozilla/content/svg/content/src/nsSVGGradientElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGGradientElement.cpp @@ -45,7 +45,6 @@ #include "nsIDOMSVGGradientElement.h" #include "nsSVGAnimatedString.h" #include "nsCOMPtr.h" -#include "nsISVGSVGElement.h" #include "nsSVGStylableElement.h" #include "nsGkAtoms.h" #include "nsSVGGradientElement.h" diff --git a/mozilla/content/svg/content/src/nsSVGGraphicElement.cpp b/mozilla/content/svg/content/src/nsSVGGraphicElement.cpp index 19809d3057b..ca02d988720 100644 --- a/mozilla/content/svg/content/src/nsSVGGraphicElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGGraphicElement.cpp @@ -42,7 +42,6 @@ #include "nsSVGAnimatedTransformList.h" #include "nsGkAtoms.h" #include "nsSVGMatrix.h" -#include "nsISVGSVGElement.h" #include "nsIDOMEventTarget.h" #include "nsBindingManager.h" #include "nsIFrame.h" diff --git a/mozilla/content/svg/content/src/nsSVGImageElement.cpp b/mozilla/content/svg/content/src/nsSVGImageElement.cpp index dd54285311f..22a97e1937e 100644 --- a/mozilla/content/svg/content/src/nsSVGImageElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGImageElement.cpp @@ -40,7 +40,6 @@ #include "nsSVGLength.h" #include "nsSVGAnimatedString.h" #include "nsCOMPtr.h" -#include "nsISVGSVGElement.h" #include "nsIURI.h" #include "nsNetUtil.h" #include "nsSVGAnimatedPreserveAspectRatio.h" diff --git a/mozilla/content/svg/content/src/nsSVGMaskElement.cpp b/mozilla/content/svg/content/src/nsSVGMaskElement.cpp index d1b4dd52bbe..68ec235ef00 100644 --- a/mozilla/content/svg/content/src/nsSVGMaskElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGMaskElement.cpp @@ -38,7 +38,6 @@ #include "nsSVGAnimatedEnumeration.h" #include "nsIDOMSVGAnimatedEnum.h" #include "nsCOMPtr.h" -#include "nsISVGSVGElement.h" #include "nsGkAtoms.h" #include "nsSVGMaskElement.h" diff --git a/mozilla/content/svg/content/src/nsSVGPatternElement.cpp b/mozilla/content/svg/content/src/nsSVGPatternElement.cpp index c21661b71b2..c9b9ceea6c5 100644 --- a/mozilla/content/svg/content/src/nsSVGPatternElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGPatternElement.cpp @@ -43,7 +43,6 @@ #include "nsIDOMSVGAnimatedEnum.h" #include "nsSVGAnimatedString.h" #include "nsCOMPtr.h" -#include "nsISVGSVGElement.h" #include "nsGkAtoms.h" #include "nsSVGAnimatedRect.h" #include "nsSVGRect.h" diff --git a/mozilla/content/svg/content/src/nsSVGSVGElement.cpp b/mozilla/content/svg/content/src/nsSVGSVGElement.cpp index 5ce09c6b663..abcdef47909 100644 --- a/mozilla/content/svg/content/src/nsSVGSVGElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGSVGElement.cpp @@ -88,7 +88,6 @@ NS_INTERFACE_MAP_BEGIN(nsSVGSVGElement) NS_INTERFACE_MAP_ENTRY(nsIDOMSVGFitToViewBox) NS_INTERFACE_MAP_ENTRY(nsIDOMSVGLocatable) NS_INTERFACE_MAP_ENTRY(nsIDOMSVGZoomAndPan) - NS_INTERFACE_MAP_ENTRY(nsISVGSVGElement) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGSVGElement) NS_INTERFACE_MAP_END_INHERITING(nsSVGSVGElementBase) @@ -745,7 +744,7 @@ nsSVGSVGElement::GetCTM(nsIDOMSVGMatrix **_retval) break; } - nsSVGSVGElement *viewportElement = QI_TO_NSSVGSVGELEMENT(ancestor); + nsSVGSVGElement *viewportElement = QI_AND_CAST_TO_NSSVGSVGELEMENT(ancestor); if (viewportElement) { rv = viewportElement->GetViewboxToViewportTransform(getter_AddRefs(ancestorCTM)); if (NS_FAILED(rv)) return rv; @@ -980,7 +979,7 @@ nsSVGSVGElement::SetZoomAndPan(PRUint16 aZoomAndPan) } //---------------------------------------------------------------------- -// nsISVGSVGElement methods: +// helper methods for implementing SVGZoomEvent: NS_IMETHODIMP nsSVGSVGElement::GetCurrentScaleNumber(nsIDOMSVGNumber **aResult) diff --git a/mozilla/content/svg/content/src/nsSVGSVGElement.h b/mozilla/content/svg/content/src/nsSVGSVGElement.h index fd7686cd983..734644f8b13 100644 --- a/mozilla/content/svg/content/src/nsSVGSVGElement.h +++ b/mozilla/content/svg/content/src/nsSVGSVGElement.h @@ -41,22 +41,23 @@ #define __NS_SVGSVGELEMENT_H__ #include "nsSVGStylableElement.h" -#include "nsISVGSVGElement.h" +#include "nsIDOMSVGSVGElement.h" #include "nsIDOMSVGFitToViewBox.h" #include "nsIDOMSVGLocatable.h" #include "nsIDOMSVGZoomAndPan.h" #include "nsIDOMSVGMatrix.h" #include "nsSVGLength2.h" -#define QI_TO_NSSVGSVGELEMENT(base) \ - NS_STATIC_CAST(nsSVGSVGElement*, \ - NS_STATIC_CAST(nsISVGSVGElement*, \ - nsCOMPtr(do_QueryInterface(base)))); +class nsISVGEnum; + +#define QI_AND_CAST_TO_NSSVGSVGELEMENT(base) \ + (nsCOMPtr(do_QueryInterface(base)) ? \ + NS_STATIC_CAST(nsSVGSVGElement*, base.get()) : nsnull) typedef nsSVGStylableElement nsSVGSVGElementBase; class nsSVGSVGElement : public nsSVGSVGElementBase, - public nsISVGSVGElement, // : nsIDOMSVGSVGElement + public nsIDOMSVGSVGElement, public nsIDOMSVGFitToViewBox, public nsIDOMSVGLocatable, public nsIDOMSVGZoomAndPan @@ -75,7 +76,6 @@ protected: void SetCoordCtxRect(nsIDOMSVGRect* aCtxRect); public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGSVGELEMENT_IID) // interfaces: NS_DECL_ISUPPORTS_INHERITED @@ -89,12 +89,34 @@ public: NS_FORWARD_NSIDOMELEMENT(nsSVGSVGElementBase::) NS_FORWARD_NSIDOMSVGELEMENT(nsSVGSVGElementBase::) - // nsISVGSVGElement interface: + // helper methods for implementing SVGZoomEvent: NS_IMETHOD GetCurrentScaleNumber(nsIDOMSVGNumber **aResult); NS_IMETHOD GetZoomAndPanEnum(nsISVGEnum **aResult); + + /** + * For use by zoom controls to allow currentScale, currentTranslate.x and + * currentTranslate.y to be set by a single operation that dispatches a + * single SVGZoom event (instead of one SVGZoom and two SVGScroll events). + */ NS_IMETHOD SetCurrentScaleTranslate(float s, float x, float y); + + /** + * For use by pan controls to allow currentTranslate.x and currentTranslate.y + * to be set by a single operation that dispatches a single SVGScroll event + * (instead of two). + */ NS_IMETHOD SetCurrentTranslate(float x, float y); + + /** + * Record the current values of currentScale, currentTranslate.x and + * currentTranslate.y prior to changing the value of one of them. + */ NS_IMETHOD_(void) RecordCurrentScaleTranslate(); + + /** + * Retrieve the value of currentScale, currentTranslate.x or + * currentTranslate.y prior to the last change made to any one of them. + */ NS_IMETHOD_(float) GetPreviousTranslate_x(); NS_IMETHOD_(float) GetPreviousTranslate_y(); NS_IMETHOD_(float) GetPreviousScale(); diff --git a/mozilla/content/svg/content/src/nsSVGTSpanElement.cpp b/mozilla/content/svg/content/src/nsSVGTSpanElement.cpp index bf61f251686..d3495e68800 100644 --- a/mozilla/content/svg/content/src/nsSVGTSpanElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGTSpanElement.cpp @@ -42,7 +42,6 @@ #include "nsCOMPtr.h" #include "nsSVGAnimatedLengthList.h" #include "nsSVGLengthList.h" -#include "nsISVGSVGElement.h" #include "nsSVGSVGElement.h" #include "nsISVGTextContentMetrics.h" #include "nsIFrame.h" diff --git a/mozilla/content/svg/content/src/nsSVGTextElement.cpp b/mozilla/content/svg/content/src/nsSVGTextElement.cpp index 668c70db2d0..ca1217a1e49 100644 --- a/mozilla/content/svg/content/src/nsSVGTextElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGTextElement.cpp @@ -42,7 +42,6 @@ #include "nsCOMPtr.h" #include "nsSVGAnimatedLengthList.h" #include "nsSVGLengthList.h" -#include "nsISVGSVGElement.h" #include "nsSVGSVGElement.h" #include "nsISVGTextContentMetrics.h" #include "nsIFrame.h" diff --git a/mozilla/content/svg/content/src/nsSVGUseElement.cpp b/mozilla/content/svg/content/src/nsSVGUseElement.cpp index fb3aaff032f..bdc14f8f14e 100644 --- a/mozilla/content/svg/content/src/nsSVGUseElement.cpp +++ b/mozilla/content/svg/content/src/nsSVGUseElement.cpp @@ -38,7 +38,6 @@ #include "nsIDOMSVGGElement.h" #include "nsGkAtoms.h" #include "nsIDOMSVGAnimatedLength.h" -#include "nsISVGSVGElement.h" #include "nsIDOMSVGAnimatedString.h" #include "nsSVGAnimatedString.h" #include "nsIDOMDocument.h" diff --git a/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp b/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp index e364f2e76dc..23731c12f75 100644 --- a/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp +++ b/mozilla/layout/svg/base/src/nsSVGOuterSVGFrame.cpp @@ -137,9 +137,7 @@ NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleCo { nsCOMPtr svgElement = do_QueryInterface(aContent); if (!svgElement) { -#ifdef DEBUG - printf("warning: trying to construct an SVGOuterSVGFrame for a content element that doesn't support the right interfaces\n"); -#endif + NS_ERROR("Can't create frame! Content is not an SVG 'svg' element!"); return nsnull; } @@ -157,13 +155,11 @@ nsSVGOuterSVGFrame::nsSVGOuterSVGFrame(nsStyleContext* aContext) NS_IMETHODIMP nsSVGOuterSVGFrame::InitSVG() { - nsCOMPtr SVGElement = do_QueryInterface(mContent); - NS_ASSERTION(SVGElement, "wrong content element"); - nsIDocument* doc = mContent->GetCurrentDoc(); if (doc) { // we only care about our content's zoom and pan values if it's the root element if (doc->GetRootContent() == mContent) { + nsSVGSVGElement *SVGElement = NS_STATIC_CAST(nsSVGSVGElement*, mContent); SVGElement->GetZoomAndPanEnum(getter_AddRefs(mZoomAndPan)); SVGElement->GetCurrentTranslate(getter_AddRefs(mCurrentTranslate)); SVGElement->GetCurrentScaleNumber(getter_AddRefs(mCurrentScale));