Bug 340016 - Remove nsISVGMarkable interface. r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@198870 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
tor%cs.brown.edu 2006-06-02 14:26:28 +00:00
parent 42f654a8af
commit 3d6a1ab169
8 changed files with 36 additions and 127 deletions

View File

@ -1,57 +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 IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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_ISVGMARKABLE_H__
#define __NS_ISVGMARKABLE_H__
#define NS_ISVGMARKABLE_IID \
{0x6c4f9a33, 0x4461, 0x419c, {0x82, 0xf8, 0x6b, 0x78, 0x3b, 0xcf, 0x85, 0x97}}
struct nsSVGMark {
float x, y, angle;
};
class nsISVGMarkable : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGMARKABLE_IID)
virtual void GetMarkPoints(nsVoidArray *aMarks) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsISVGMarkable, NS_ISVGMARKABLE_IID)
#endif

View File

@ -38,12 +38,11 @@
* ***** END LICENSE BLOCK ***** */
#include "nsSVGPathGeometryFrame.h"
#include "nsISVGMarkable.h"
#include "nsIDOMSVGLineElement.h"
#include "nsSVGElement.h"
#include "nsSVGMarkerFrame.h"
class nsSVGLineFrame : public nsSVGPathGeometryFrame,
public nsISVGMarkable
class nsSVGLineFrame : public nsSVGPathGeometryFrame
{
friend nsIFrame*
NS_NewSVGLineFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
@ -72,20 +71,11 @@ class nsSVGLineFrame : public nsSVGPathGeometryFrame,
// nsISVGPathGeometrySource interface:
NS_IMETHOD ConstructPath(cairo_t *aCtx);
// nsISVGMarkable interface
void GetMarkPoints(nsVoidArray *aMarks);
// nsISupports interface:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
// nsSVGPathGeometry methods
virtual PRBool IsMarkable() { return PR_TRUE; }
virtual void GetMarkPoints(nsVoidArray *aMarks);
};
NS_INTERFACE_MAP_BEGIN(nsSVGLineFrame)
NS_INTERFACE_MAP_ENTRY(nsISVGMarkable)
NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryFrame)
//----------------------------------------------------------------------
// Implementation
@ -148,7 +138,7 @@ NS_IMETHODIMP nsSVGLineFrame::ConstructPath(cairo_t *aCtx)
}
//----------------------------------------------------------------------
// nsISVGMarkable methods:
// nsSVGPathGeometry methods:
void
nsSVGLineFrame::GetMarkPoints(nsVoidArray *aMarks) {

View File

@ -37,7 +37,6 @@
#ifndef __NS_SVGMARKERFRAME_H__
#define __NS_SVGMARKERFRAME_H__
#include "nsISVGMarkable.h"
#include "nsISupports.h"
class nsISVGRendererCanvas;
@ -49,6 +48,10 @@ class nsIContent;
#define NS_ISVGMARKERFRAME_IID \
{0xf08cd1a0, 0x667c, 0x43ef, {0x9d, 0xcf, 0x99,0x09, 0xc7, 0x96, 0x0d, 0x02}}
struct nsSVGMark {
float x, y, angle;
};
class nsISVGMarkerFrame : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGMARKERFRAME_IID)

View File

@ -42,7 +42,6 @@
#include "nsIDOMSVGPathSegList.h"
#include "nsIDOMSVGPathSeg.h"
#include "nsIDOMSVGMatrix.h"
#include "nsISVGMarkable.h"
#include "nsISupports.h"
#include "nsLayoutAtoms.h"
#include "nsISVGPathFlatten.h"
@ -50,9 +49,9 @@
#include "nsINameSpaceManager.h"
#include "nsGkAtoms.h"
#include "nsSVGPathElement.h"
#include "nsSVGMarkerFrame.h"
class nsSVGPathFrame : public nsSVGPathGeometryFrame,
public nsISVGMarkable,
public nsISVGPathFlatten
{
protected:
@ -70,8 +69,9 @@ public:
// nsISVGPathGeometrySource interface:
NS_IMETHOD ConstructPath(cairo_t *aCtx);
// nsISVGMarkable interface
void GetMarkPoints(nsVoidArray *aMarks);
// nsSVGPathGeometry methods
virtual PRBool IsMarkable() { return PR_TRUE; }
virtual void GetMarkPoints(nsVoidArray *aMarks);
// nsISVGPathFlatten interface
NS_IMETHOD GetFlattenedPath(nsSVGPathData **data, nsIFrame *parent);
@ -99,7 +99,6 @@ private:
};
NS_INTERFACE_MAP_BEGIN(nsSVGPathFrame)
NS_INTERFACE_MAP_ENTRY(nsISVGMarkable)
NS_INTERFACE_MAP_ENTRY(nsISVGPathFlatten)
NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryFrame)
@ -160,7 +159,7 @@ NS_IMETHODIMP nsSVGPathFrame::ConstructPath(cairo_t *aCtx)
}
//----------------------------------------------------------------------
// nsISVGMarkable methods:
// nsSVGPathGeometry methods:
void
nsSVGPathFrame::GetMarkPoints(nsVoidArray *aMarks) {
@ -185,7 +184,8 @@ nsSVGPathFrame::GetMarkPoints(nsVoidArray *aMarks) {
PRUint16 lastSegmentType = nsIDOMSVGPathSeg::PATHSEG_UNKNOWN;
float px, py; // subpath initial point
float pathAngle, pathIndex;
float pathAngle;
PRUint32 pathIndex;
float prevAngle = 0, startAngle, endAngle;

View File

@ -50,7 +50,6 @@
#include "nsCRT.h"
#include "prdtoa.h"
#include "nsSVGMarkerFrame.h"
#include "nsISVGMarkable.h"
#include "nsIViewManager.h"
#include "nsSVGMatrix.h"
#include "nsSVGClipPathFrame.h"
@ -280,10 +279,7 @@ nsSVGPathGeometryFrame::PaintSVG(nsISVGRendererCanvas* canvas)
/* render */
GetGeometry()->Render(this, canvas);
nsISVGMarkable *markable;
CallQueryInterface(this, &markable);
if (markable) {
if (IsMarkable()) {
// Marker Property is added lazily and may have been removed by a restyle
UpdateMarkerProperty();
nsSVGMarkerProperty *property = GetMarkerProperty();
@ -299,7 +295,7 @@ nsSVGPathGeometryFrame::PaintSVG(nsISVGRendererCanvas* canvas)
float strokeWidth = GetStrokeWidth();
nsVoidArray marks;
markable->GetMarkPoints(&marks);
GetMarkPoints(&marks);
PRUint32 num = marks.Count();
@ -348,10 +344,7 @@ nsSVGPathGeometryFrame::GetCoveredRegion()
GetGeometry()->GetCoveredRegion(this, &region);
nsISVGMarkable *markable;
CallQueryInterface(this, &markable);
if (markable) {
if (IsMarkable()) {
nsSVGMarkerProperty *property = GetMarkerProperty();
if (!property ||
@ -363,7 +356,7 @@ nsSVGPathGeometryFrame::GetCoveredRegion()
float strokeWidth = GetStrokeWidth();
nsVoidArray marks;
markable->GetMarkPoints(&marks);
GetMarkPoints(&marks);
PRUint32 num = marks.Count();

View File

@ -133,6 +133,9 @@ protected:
NS_IMETHOD InitSVG();
nsISVGRendererPathGeometry *GetGeometry();
virtual PRBool IsMarkable() { return PR_FALSE; }
virtual void GetMarkPoints(nsVoidArray *aMarks) {}
private:
nsSVGMarkerProperty *GetMarkerProperty();
void GetMarkerFromStyle(nsISVGMarkerFrame **aResult,

View File

@ -40,14 +40,13 @@
#include "nsIDOMSVGAnimatedPoints.h"
#include "nsIDOMSVGPointList.h"
#include "nsIDOMSVGPoint.h"
#include "nsISVGMarkable.h"
#include "nsLayoutAtoms.h"
#include "nsSVGUtils.h"
#include "nsINameSpaceManager.h"
#include "nsGkAtoms.h"
#include "nsSVGMarkerFrame.h"
class nsSVGPolygonFrame : public nsSVGPathGeometryFrame,
public nsISVGMarkable
class nsSVGPolygonFrame : public nsSVGPathGeometryFrame
{
protected:
friend nsIFrame*
@ -68,11 +67,9 @@ public:
nsCOMPtr<nsIDOMSVGPointList> mPoints;
// nsISVGMarkable interface
void GetMarkPoints(nsVoidArray *aMarks);
// nsISupports interface:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsSVGPathGeometry methods
virtual PRBool IsMarkable() { return PR_TRUE; }
virtual void GetMarkPoints(nsVoidArray *aMarks);
/**
* Get the "type" of the frame
@ -87,17 +84,8 @@ public:
return MakeFrameName(NS_LITERAL_STRING("SVGPolygon"), aResult);
}
#endif
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
};
NS_INTERFACE_MAP_BEGIN(nsSVGPolygonFrame)
NS_INTERFACE_MAP_ENTRY(nsISVGMarkable)
NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryFrame)
//----------------------------------------------------------------------
// Implementation
@ -180,7 +168,7 @@ NS_IMETHODIMP nsSVGPolygonFrame::ConstructPath(cairo_t *aCtx)
}
//----------------------------------------------------------------------
// nsISVGMarkable methods:
// nsSVGPathGeometry methods:
void
nsSVGPolygonFrame::GetMarkPoints(nsVoidArray *aMarks) {

View File

@ -40,14 +40,13 @@
#include "nsIDOMSVGAnimatedPoints.h"
#include "nsIDOMSVGPointList.h"
#include "nsIDOMSVGPoint.h"
#include "nsISVGMarkable.h"
#include "nsLayoutAtoms.h"
#include "nsSVGUtils.h"
#include "nsINameSpaceManager.h"
#include "nsGkAtoms.h"
#include "nsSVGMarkerFrame.h"
class nsSVGPolylineFrame : public nsSVGPathGeometryFrame,
public nsISVGMarkable
class nsSVGPolylineFrame : public nsSVGPathGeometryFrame
{
protected:
friend nsIFrame*
@ -82,21 +81,11 @@ public:
nsCOMPtr<nsIDOMSVGPointList> mPoints;
// nsISVGMarkable interface
void GetMarkPoints(nsVoidArray *aMarks);
// nsISupports interface:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
// nsSVGPathGeometry methods
virtual PRBool IsMarkable() { return PR_TRUE; }
virtual void GetMarkPoints(nsVoidArray *aMarks);
};
NS_INTERFACE_MAP_BEGIN(nsSVGPolylineFrame)
NS_INTERFACE_MAP_ENTRY(nsISVGMarkable)
NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryFrame)
//----------------------------------------------------------------------
// Implementation
@ -182,7 +171,7 @@ NS_IMETHODIMP nsSVGPolylineFrame::ConstructPath(cairo_t *aCtx)
}
//----------------------------------------------------------------------
// nsISVGMarkable methods:
// nsSVGPathGeometry methods:
void
nsSVGPolylineFrame::GetMarkPoints(nsVoidArray *aMarks) {