added nsSVGPathFrame

This commit is contained in:
rods%netscape.com 2000-05-15 20:34:00 +00:00
parent df43e3c067
commit dca62f6984
5 changed files with 129 additions and 2 deletions

View File

@ -33,6 +33,7 @@ CPPSRCS = \
nsSVGContainerFrame.cpp \
nsPolygonFrame.cpp \
nsPolylineFrame.cpp \
nsSVGPathFrame.cpp \
$(NULL)
include $(topsrcdir)/config/config.mk

View File

@ -31,12 +31,14 @@ CPPSRCS= \
nsSVGContainerFrame.cpp \
nsPolygonFrame.cpp \
nsPolylineFrame.cpp \
nsSVGPathFrame.cpp \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsSVGContainerFrame.obj \
.\$(OBJDIR)\nsPolygonFrame.obj \
.\$(OBJDIR)\nsPolylineFrame.obj \
.\$(OBJDIR)\nsSVGPathFrame.obj \
$(NULL)
EXPORTS = \

View File

@ -0,0 +1,65 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsSVGPathFrame.h"
#include "nsIDOMElement.h"
#include "nsIContent.h"
#include "prtypes.h"
#include "nsIAtom.h"
#include "nsHTMLAtoms.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsCSSRendering.h"
#include "nsINameSpaceManager.h"
#include "nsColor.h"
#include "nsIServiceManager.h"
#include "nsPoint.h"
#include "nsSVGAtoms.h"
#include "nsIDeviceContext.h"
//#include "nsSVGPathCID.h"
//
// NS_NewSVGPathFrame
//
// Wrapper for creating a new color picker
//
nsresult
NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsSVGPathFrame* it = new (aPresShell) nsSVGPathFrame;
if ( !it )
return NS_ERROR_OUT_OF_MEMORY;
*aNewFrame = it;
return NS_OK;
}
NS_METHOD nsSVGPathFrame::RenderPoints(nsIRenderingContext& aRenderingContext,
const nsPoint aPoints[], PRInt32 aNumPoints)
{
// draw path here
return NS_OK;
}

View File

@ -0,0 +1,51 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
//
// nsSVGPathFrame
//
#ifndef nsSVGPathFrame_h__
#define nsSVGPathFrame_h__
#include "nsPolygonFrame.h"
class nsString;
nsresult NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIFrame** aResult) ;
// XXX - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// This should NOT be derived from nsLeafFrame
// we really want to create our own container class from the nsIFrame
// interface and not derive from any HTML Frames
// XXX - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
class nsSVGPathFrame : public nsPolygonFrame
{
NS_IMETHOD RenderPoints(nsIRenderingContext& aRenderingContext,
const nsPoint aPoints[], PRInt32 aNumPoints);
}; // class nsSVGPathFrame
#endif

View File

@ -10,7 +10,7 @@
<![CDATA[
function moveit(node)
{
var elementName = "rect";
/*var elementName = "rect";
var node = findNode(document.documentElement, elementName);
dump("Node: "+node+"\n");
@ -18,7 +18,14 @@ function moveit(node)
dump("-----------\n"+node.x);
node.x = 10;
//node.y = "10";
//node.points = "10 10";
//node.points = "10 10";*/
var node = findNode(document.documentElement, "rect");
dump("Node: "+node+"\n");
attr = document.createAttribute("points");
attr.value = "100 100 50 10 50 50";
node.attributes.setNamedItem(attr);
dump("Node: "+node+"\n");
}
function findNode(node, nodename)
@ -126,5 +133,6 @@ function findNode(node, nodename)
<foreignobject>
<html:div style="position:absolute;top:5px;left:385px;">Simple Polygons</html:div>
<html:div style="position:absolute;top:250px;left:165px;">A Simple Graph</html:div>
<html:input type="button" value="Move It" onclick="moveit();"/>
</foreignobject>
</svg>

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB