зеркало из https://github.com/mozilla/gecko-dev.git
Fixing bug 385218. Remove nsISVGSVGElement. r+sr=tor@acm.org
This commit is contained in:
Родитель
5c7e36a4c3
Коммит
6d71fcdb5d
|
@ -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<nsISVGSVGElement> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 <alex.fritze@crocodile-clips.com> (original author)
|
||||
* Jonathan Watt <jonathan.watt@strath.ac.uk>
|
||||
*
|
||||
* 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 <svg>-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__
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#include "nsSVGLength.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISVGSVGElement.h"
|
||||
#include "nsSVGForeignObjectElement.h"
|
||||
|
||||
nsSVGElement::LengthInfo nsSVGForeignObjectElement::sLengthInfo[4] =
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "nsSVGAnimatedEnumeration.h"
|
||||
#include "nsIDOMSVGAnimatedEnum.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISVGSVGElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsSVGMaskElement.h"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<nsISVGSVGElement>(do_QueryInterface(base))));
|
||||
class nsISVGEnum;
|
||||
|
||||
#define QI_AND_CAST_TO_NSSVGSVGELEMENT(base) \
|
||||
(nsCOMPtr<nsIDOMSVGSVGElement>(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();
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -137,9 +137,7 @@ NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleCo
|
|||
{
|
||||
nsCOMPtr<nsIDOMSVGSVGElement> 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<nsISVGSVGElement> 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));
|
||||
|
|
Загрузка…
Ссылка в новой задаче