Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2004-04-18 14:30:37 +00:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* 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
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
* Crocodile Clips Ltd..
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2002
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2004-04-18 14:30:37 +00:00
|
|
|
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 14:30:37 +00:00
|
|
|
* 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"),
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
* 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
|
2004-04-18 14:30:37 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* ***** END LICENSE BLOCK ***** */
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
|
|
|
|
#include "nsSVGPathGeometryFrame.h"
|
2004-10-14 23:02:53 +00:00
|
|
|
#include "nsIDOMSVGDocument.h"
|
|
|
|
#include "nsIDOMElement.h"
|
|
|
|
#include "nsIDocument.h"
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
#include "nsISVGRenderer.h"
|
|
|
|
#include "nsISVGRendererRegion.h"
|
|
|
|
#include "nsISVGValueUtils.h"
|
|
|
|
#include "nsIDOMSVGTransformable.h"
|
|
|
|
#include "nsIDOMSVGAnimTransformList.h"
|
2004-08-05 09:01:13 +00:00
|
|
|
#include "nsIDOMSVGTransformList.h"
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
#include "nsISVGContainerFrame.h"
|
2004-10-14 23:02:53 +00:00
|
|
|
#include "nsSVGGradientFrame.h"
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
#include "nsReadableUtils.h"
|
2004-10-14 23:02:53 +00:00
|
|
|
#include "nsUnicharUtils.h"
|
|
|
|
#include "nsSVGAtoms.h"
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
#include "nsCRT.h"
|
|
|
|
#include "prdtoa.h"
|
2004-12-09 03:16:15 +00:00
|
|
|
#include "nsSVGMarkerFrame.h"
|
|
|
|
#include "nsISVGMarkable.h"
|
|
|
|
#include "nsIViewManager.h"
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsSVGPathGeometryFrame
|
|
|
|
|
|
|
|
nsSVGPathGeometryFrame::nsSVGPathGeometryFrame()
|
|
|
|
: mUpdateFlags(0)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
// printf("nsSVGPathGeometryFrame %p CTOR\n", this);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGPathGeometryFrame::~nsSVGPathGeometryFrame()
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
// printf("~nsSVGPathGeometryFrame %p\n", this);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(mContent);
|
|
|
|
NS_ASSERTION(transformable, "wrong content element");
|
|
|
|
nsCOMPtr<nsIDOMSVGAnimatedTransformList> transforms;
|
|
|
|
transformable->GetTransform(getter_AddRefs(transforms));
|
|
|
|
nsCOMPtr<nsISVGValue> value = do_QueryInterface(transforms);
|
|
|
|
NS_REMOVE_SVGVALUE_OBSERVER(transforms);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISupports methods
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN(nsSVGPathGeometryFrame)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISVGGeometrySource)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISVGPathGeometrySource)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISVGChildFrame)
|
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsSVGPathGeometryFrameBase)
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIFrame methods
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSVGPathGeometryFrame::Init(nsPresContext* aPresContext,
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
// rv = nsSVGPathGeometryFrameBase::Init(aPresContext, aContent, aParent,
|
|
|
|
// aContext, aPrevInFlow);
|
|
|
|
|
|
|
|
mContent = aContent;
|
|
|
|
NS_IF_ADDREF(mContent);
|
|
|
|
mParent = aParent;
|
|
|
|
|
|
|
|
Init();
|
|
|
|
|
|
|
|
SetStyleContext(aPresContext, aContext);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSVGPathGeometryFrame::AttributeChanged(nsPresContext* aPresContext,
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aModType,
|
|
|
|
PRInt32 aHint)
|
|
|
|
{
|
|
|
|
// we don't use this notification mechanism
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
// printf("** nsSVGPathGeometryFrame::AttributeChanged(");
|
|
|
|
// nsAutoString str;
|
|
|
|
// aAttribute->ToString(str);
|
|
|
|
// nsCAutoString cstr;
|
|
|
|
// cstr.AssignWithConversion(str);
|
|
|
|
// printf(cstr.get());
|
|
|
|
// printf(")\n");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSVGPathGeometryFrame::DidSetStyleContext(nsPresContext* aPresContext)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
{
|
|
|
|
// XXX: we'd like to use the style_hint mechanism and the
|
|
|
|
// ContentStateChanged/AttributeChanged functions for style changes
|
|
|
|
// to get slightly finer granularity, but unfortunately the
|
|
|
|
// style_hints don't map very well onto svg. Here seems to be the
|
|
|
|
// best place to deal with style changes:
|
|
|
|
|
|
|
|
UpdateGraphic(nsISVGGeometrySource::UPDATEMASK_ALL);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGChildFrame methods
|
|
|
|
|
2004-12-09 03:16:15 +00:00
|
|
|
// marker helper
|
|
|
|
void
|
|
|
|
nsSVGPathGeometryFrame::GetMarkerFrames(nsSVGMarkerFrame **markerStart,
|
|
|
|
nsSVGMarkerFrame **markerMid,
|
|
|
|
nsSVGMarkerFrame **markerEnd)
|
|
|
|
{
|
|
|
|
nsIURI *aURI;
|
|
|
|
|
|
|
|
*markerStart = *markerMid = *markerEnd = NULL;
|
|
|
|
|
|
|
|
aURI = GetStyleSVG()->mMarkerEnd;
|
|
|
|
if (aURI)
|
|
|
|
NS_GetSVGMarkerFrame(markerEnd, aURI, mContent);
|
|
|
|
|
|
|
|
aURI = GetStyleSVG()->mMarkerMid;
|
|
|
|
if (aURI)
|
|
|
|
NS_GetSVGMarkerFrame(markerMid, aURI, mContent);
|
|
|
|
|
|
|
|
aURI = GetStyleSVG()->mMarkerStart;
|
|
|
|
if (aURI)
|
|
|
|
NS_GetSVGMarkerFrame(markerStart, aURI, mContent);
|
|
|
|
}
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::Paint(nsISVGRendererCanvas* canvas, const nsRect& dirtyRectTwips)
|
|
|
|
{
|
2004-10-04 18:56:53 +00:00
|
|
|
if (!GetStyleVisibility()->IsVisible())
|
|
|
|
return NS_OK;
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
GetGeometry()->Render(canvas);
|
2004-12-09 03:16:15 +00:00
|
|
|
|
|
|
|
nsISVGMarkable *markable;
|
|
|
|
CallQueryInterface(this, &markable);
|
|
|
|
|
|
|
|
if (markable) {
|
|
|
|
nsSVGMarkerFrame *markerEnd, *markerMid, *markerStart;
|
|
|
|
GetMarkerFrames(&markerStart, &markerMid, &markerEnd);
|
|
|
|
|
|
|
|
if (!markerEnd && !markerMid && !markerStart)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
float strokeWidth;
|
|
|
|
GetStrokeWidth(&strokeWidth);
|
|
|
|
|
|
|
|
nsVoidArray marks;
|
|
|
|
markable->GetMarkPoints(&marks);
|
|
|
|
|
|
|
|
PRUint32 num = marks.Count();
|
|
|
|
|
|
|
|
if (markerStart)
|
|
|
|
markerStart->PaintMark(canvas, this, (nsSVGMark *)marks[0], strokeWidth);
|
|
|
|
|
|
|
|
if (markerMid)
|
|
|
|
for (PRUint32 i = 1; i < num - 1; i++)
|
|
|
|
markerMid->PaintMark(canvas, this, (nsSVGMark *)marks[i], strokeWidth);
|
|
|
|
|
|
|
|
if (markerEnd)
|
|
|
|
markerEnd->PaintMark(canvas, this, (nsSVGMark *)marks[num-1], strokeWidth);
|
|
|
|
}
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetFrameForPoint(float x, float y, nsIFrame** hit)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
//printf("nsSVGPathGeometryFrame(%p)::GetFrameForPoint\n", this);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// test for hit:
|
|
|
|
*hit = nsnull;
|
|
|
|
PRBool isHit;
|
|
|
|
GetGeometry()->ContainsPoint(x, y, &isHit);
|
|
|
|
if (isHit)
|
|
|
|
*hit = this;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(already_AddRefed<nsISVGRendererRegion>)
|
|
|
|
nsSVGPathGeometryFrame::GetCoveredRegion()
|
|
|
|
{
|
|
|
|
nsISVGRendererRegion *region = nsnull;
|
|
|
|
GetGeometry()->GetCoveredRegion(®ion);
|
2004-12-09 03:16:15 +00:00
|
|
|
|
|
|
|
nsISVGMarkable *markable;
|
|
|
|
CallQueryInterface(this, &markable);
|
|
|
|
|
|
|
|
if (markable) {
|
|
|
|
nsSVGMarkerFrame *markerEnd, *markerMid, *markerStart;
|
|
|
|
GetMarkerFrames(&markerStart, &markerMid, &markerEnd);
|
|
|
|
|
|
|
|
if (!markerEnd && !markerMid && !markerStart)
|
|
|
|
return region;
|
|
|
|
|
|
|
|
float strokeWidth;
|
|
|
|
GetStrokeWidth(&strokeWidth);
|
|
|
|
|
|
|
|
nsVoidArray marks;
|
|
|
|
markable->GetMarkPoints(&marks);
|
|
|
|
|
|
|
|
PRUint32 num = marks.Count();
|
|
|
|
|
|
|
|
if (markerStart) {
|
|
|
|
nsCOMPtr<nsISVGRendererRegion> mark;
|
|
|
|
mark = markerStart->RegionMark(this, (nsSVGMark *)marks[0], strokeWidth);
|
|
|
|
|
|
|
|
nsCOMPtr<nsISVGRendererRegion> tmp = dont_AddRef(region);
|
|
|
|
mark->Combine(tmp, ®ion);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (markerMid)
|
|
|
|
for (PRUint32 i = 1; i < num - 1; i++) {
|
|
|
|
nsCOMPtr<nsISVGRendererRegion> mark;
|
|
|
|
mark = markerMid->RegionMark(this, (nsSVGMark *)marks[i], strokeWidth);
|
|
|
|
|
|
|
|
nsCOMPtr<nsISVGRendererRegion> tmp = dont_AddRef(region);
|
|
|
|
mark->Combine(tmp, ®ion);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (markerEnd) {
|
|
|
|
nsCOMPtr<nsISVGRendererRegion> mark;
|
|
|
|
mark = markerEnd->RegionMark(this, (nsSVGMark *)marks[num-1], strokeWidth);
|
|
|
|
|
|
|
|
nsCOMPtr<nsISVGRendererRegion> tmp = dont_AddRef(region);
|
|
|
|
mark->Combine(tmp, ®ion);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return region;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::InitialUpdate()
|
|
|
|
{
|
|
|
|
UpdateGraphic(nsISVGGeometrySource::UPDATEMASK_ALL);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-08-05 09:01:13 +00:00
|
|
|
nsSVGPathGeometryFrame::NotifyCanvasTMChanged()
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
{
|
2004-08-05 09:01:13 +00:00
|
|
|
UpdateGraphic(nsISVGGeometrySource::UPDATEMASK_CANVAS_TM);
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::NotifyRedrawSuspended()
|
|
|
|
{
|
|
|
|
// XXX should we cache the fact that redraw is suspended?
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::NotifyRedrawUnsuspended()
|
|
|
|
{
|
|
|
|
if (mUpdateFlags != 0) {
|
|
|
|
nsCOMPtr<nsISVGRendererRegion> dirty_region;
|
|
|
|
GetGeometry()->Update(mUpdateFlags, getter_AddRefs(dirty_region));
|
|
|
|
if (dirty_region) {
|
|
|
|
nsISVGOuterSVGFrame* outerSVGFrame = GetOuterSVGFrame();
|
|
|
|
if (outerSVGFrame)
|
|
|
|
outerSVGFrame->InvalidateRegion(dirty_region, PR_TRUE);
|
|
|
|
}
|
|
|
|
mUpdateFlags = 0;
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetBBox(nsIDOMSVGRect **_retval)
|
|
|
|
{
|
|
|
|
*_retval = nsnull;
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGValueObserver methods:
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::WillModifySVGObservable(nsISVGValue* observable)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::DidModifySVGObservable (nsISVGValue* observable)
|
|
|
|
{
|
2004-08-05 09:01:13 +00:00
|
|
|
// the observables we're listening in on affect the canvastm by
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
// default. We can specialize in the subclasses when needed.
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
UpdateGraphic(nsISVGGeometrySource::UPDATEMASK_CANVAS_TM);
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGGeometrySource methods:
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
/* [noscript] readonly attribute nsPresContext presContext; */
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSVGPathGeometryFrame::GetPresContext(nsPresContext * *aPresContext)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
{
|
|
|
|
// XXX gcc 3.2.2 requires the explicit 'nsSVGPathGeometryFrameBase::' qualification
|
|
|
|
*aPresContext = nsSVGPathGeometryFrameBase::GetPresContext();
|
|
|
|
NS_ADDREF(*aPresContext);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
/* readonly attribute nsIDOMSVGMatrix canvasTM; */
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
NS_IMETHODIMP
|
2004-08-05 09:01:13 +00:00
|
|
|
nsSVGPathGeometryFrame::GetCanvasTM(nsIDOMSVGMatrix * *aCTM)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
{
|
|
|
|
*aCTM = nsnull;
|
2004-08-05 09:01:13 +00:00
|
|
|
|
|
|
|
nsISVGContainerFrame *containerFrame;
|
|
|
|
mParent->QueryInterface(NS_GET_IID(nsISVGContainerFrame), (void**)&containerFrame);
|
|
|
|
if (!containerFrame) {
|
|
|
|
NS_ERROR("invalid container");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> parentTM = containerFrame->GetCanvasTM();
|
|
|
|
NS_ASSERTION(parentTM, "null TM");
|
|
|
|
|
|
|
|
// append our local transformations if we have any:
|
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> localTM;
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(mContent);
|
|
|
|
NS_ASSERTION(transformable, "wrong content element");
|
|
|
|
nsCOMPtr<nsIDOMSVGAnimatedTransformList> atl;
|
|
|
|
transformable->GetTransform(getter_AddRefs(atl));
|
|
|
|
NS_ASSERTION(atl, "null animated transform list");
|
|
|
|
nsCOMPtr<nsIDOMSVGTransformList> transforms;
|
|
|
|
atl->GetAnimVal(getter_AddRefs(transforms));
|
|
|
|
NS_ASSERTION(transforms, "null transform list");
|
|
|
|
PRUint32 numberOfItems;
|
|
|
|
transforms->GetNumberOfItems(&numberOfItems);
|
|
|
|
if (numberOfItems>0)
|
2004-08-09 14:44:54 +00:00
|
|
|
transforms->GetConsolidationMatrix(getter_AddRefs(localTM));
|
2004-08-05 09:01:13 +00:00
|
|
|
}
|
|
|
|
if (localTM) {
|
|
|
|
return parentTM->Multiply(localTM, aCTM);
|
|
|
|
}
|
|
|
|
*aCTM = parentTM;
|
|
|
|
NS_ADDREF(*aCTM);
|
|
|
|
return NS_OK;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute float strokeOpacity; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetStrokeOpacity(float *aStrokeOpacity)
|
|
|
|
{
|
2004-11-19 22:52:15 +00:00
|
|
|
*aStrokeOpacity =
|
|
|
|
GetStyleSVG()->mStrokeOpacity * GetStyleDisplay()->mOpacity;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute float strokeWidth; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetStrokeWidth(float *aStrokeWidth)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aStrokeWidth = GetStyleSVG()->mStrokeWidth;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void getStrokeDashArray ([array, size_is (count)] out float arr, out unsigned long count); */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetStrokeDashArray(float **arr, PRUint32 *count)
|
|
|
|
{
|
2004-11-09 18:19:28 +00:00
|
|
|
const nsStyleSVG *svg = GetStyleSVG();
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
|
2004-11-09 18:19:28 +00:00
|
|
|
*count = svg->mStrokeDasharrayLength;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
|
2004-11-09 18:19:28 +00:00
|
|
|
if (*count) {
|
|
|
|
*arr = (float *) nsMemory::Alloc(*count * sizeof(float));
|
|
|
|
if (*arr)
|
|
|
|
memcpy(*arr, svg->mStrokeDasharray, *count * sizeof(float));
|
|
|
|
else {
|
|
|
|
*count = 0;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute float strokeDashoffset; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetStrokeDashoffset(float *aStrokeDashoffset)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aStrokeDashoffset = GetStyleSVG()->mStrokeDashoffset;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute unsigned short strokeLinecap; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetStrokeLinecap(PRUint16 *aStrokeLinecap)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aStrokeLinecap = GetStyleSVG()->mStrokeLinecap;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute unsigned short strokeLinejoin; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetStrokeLinejoin(PRUint16 *aStrokeLinejoin)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aStrokeLinejoin = GetStyleSVG()->mStrokeLinejoin;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute float strokeMiterlimit; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetStrokeMiterlimit(float *aStrokeMiterlimit)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aStrokeMiterlimit = GetStyleSVG()->mStrokeMiterlimit;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute float fillOpacity; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetFillOpacity(float *aFillOpacity)
|
|
|
|
{
|
2004-11-19 22:52:15 +00:00
|
|
|
*aFillOpacity =
|
|
|
|
GetStyleSVG()->mFillOpacity * GetStyleDisplay()->mOpacity;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute unsigned short fillRule; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetFillRule(PRUint16 *aFillRule)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aFillRule = GetStyleSVG()->mFillRule;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute unsigned short strokePaintType; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetStrokePaintType(PRUint16 *aStrokePaintType)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aStrokePaintType = GetStyleSVG()->mStroke.mType;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* [noscript] readonly attribute nscolor strokePaint; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetStrokePaint(nscolor *aStrokePaint)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aStrokePaint = GetStyleSVG()->mStroke.mPaint.mColor;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-10-14 23:02:53 +00:00
|
|
|
/* [noscript] void GetStrokeGradient(nsISVGGradient **aGrad); */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetStrokeGradient(nsISVGGradient **aGrad)
|
|
|
|
{
|
|
|
|
nsIURI *aServer;
|
2004-12-04 06:31:02 +00:00
|
|
|
aServer = GetStyleSVG()->mStroke.mPaint.mPaintServer;
|
2004-10-14 23:02:53 +00:00
|
|
|
if (aServer == nsnull)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
// Now have the URI. Get the gradient
|
|
|
|
return NS_GetSVGGradient(aGrad, aServer, mContent, nsSVGPathGeometryFrameBase::GetPresContext()->PresShell());
|
|
|
|
}
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
/* readonly attribute unsigned short fillPaintType; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetFillPaintType(PRUint16 *aFillPaintType)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aFillPaintType = GetStyleSVG()->mFill.mType;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* [noscript] readonly attribute nscolor fillPaint; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetFillPaint(nscolor *aFillPaint)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aFillPaint = GetStyleSVG()->mFill.mPaint.mColor;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-10-14 23:02:53 +00:00
|
|
|
/* [noscript] void GetFillGradient(nsISVGGradient **aGrad); */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetFillGradient(nsISVGGradient **aGrad)
|
|
|
|
{
|
|
|
|
nsIURI *aServer;
|
2004-12-04 06:31:02 +00:00
|
|
|
aServer = GetStyleSVG()->mFill.mPaint.mPaintServer;
|
2004-10-14 23:02:53 +00:00
|
|
|
if (aServer == nsnull)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
// Now have the URI. Get the gradient
|
|
|
|
return NS_GetSVGGradient(aGrad, aServer, mContent, nsSVGPathGeometryFrameBase::GetPresContext()->PresShell());
|
|
|
|
}
|
|
|
|
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGPathGeometrySource methods:
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetHittestMask(PRUint16 *aHittestMask)
|
|
|
|
{
|
|
|
|
*aHittestMask=0;
|
|
|
|
|
2004-12-04 06:31:02 +00:00
|
|
|
switch(GetStyleSVG()->mPointerEvents) {
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
case NS_STYLE_POINTER_EVENTS_NONE:
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_VISIBLEPAINTED:
|
2004-10-04 18:56:53 +00:00
|
|
|
if (GetStyleVisibility()->IsVisible()) {
|
2004-12-04 06:31:02 +00:00
|
|
|
if (GetStyleSVG()->mFill.mType != eStyleSVGPaintType_None)
|
2004-10-04 18:56:53 +00:00
|
|
|
*aHittestMask |= HITTEST_MASK_FILL;
|
2004-12-04 06:31:02 +00:00
|
|
|
if (GetStyleSVG()->mStroke.mType != eStyleSVGPaintType_None)
|
2004-10-04 18:56:53 +00:00
|
|
|
*aHittestMask |= HITTEST_MASK_STROKE;
|
|
|
|
}
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_VISIBLEFILL:
|
2004-10-04 18:56:53 +00:00
|
|
|
if (GetStyleVisibility()->IsVisible()) {
|
|
|
|
*aHittestMask |= HITTEST_MASK_FILL;
|
|
|
|
}
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_VISIBLESTROKE:
|
2004-10-04 18:56:53 +00:00
|
|
|
if (GetStyleVisibility()->IsVisible()) {
|
|
|
|
*aHittestMask |= HITTEST_MASK_STROKE;
|
|
|
|
}
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_VISIBLE:
|
2004-10-04 18:56:53 +00:00
|
|
|
if (GetStyleVisibility()->IsVisible()) {
|
|
|
|
*aHittestMask |= HITTEST_MASK_FILL;
|
|
|
|
*aHittestMask |= HITTEST_MASK_STROKE;
|
|
|
|
}
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_PAINTED:
|
2004-12-04 06:31:02 +00:00
|
|
|
if (GetStyleSVG()->mFill.mType != eStyleSVGPaintType_None)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
*aHittestMask |= HITTEST_MASK_FILL;
|
2004-12-04 06:31:02 +00:00
|
|
|
if (GetStyleSVG()->mStroke.mType != eStyleSVGPaintType_None)
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
*aHittestMask |= HITTEST_MASK_STROKE;
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_FILL:
|
|
|
|
*aHittestMask |= HITTEST_MASK_FILL;
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_STROKE:
|
|
|
|
*aHittestMask |= HITTEST_MASK_STROKE;
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POINTER_EVENTS_ALL:
|
|
|
|
*aHittestMask |= HITTEST_MASK_FILL;
|
|
|
|
*aHittestMask |= HITTEST_MASK_STROKE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_ERROR("not reached");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* readonly attribute unsigned short shapeRendering; */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGPathGeometryFrame::GetShapeRendering(PRUint16 *aShapeRendering)
|
|
|
|
{
|
2004-12-04 06:31:02 +00:00
|
|
|
*aShapeRendering = GetStyleSVG()->mShapeRendering;
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsSVGPathGeometryFrame::Init()
|
|
|
|
{
|
|
|
|
// nsresult rv = nsSVGPathGeometryFrameBase::Init();
|
|
|
|
// if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
// all path geometry frames listen in on changes to their
|
|
|
|
// corresponding content element's transform attribute:
|
|
|
|
nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(mContent);
|
|
|
|
NS_ASSERTION(transformable, "wrong content element");
|
|
|
|
nsCOMPtr<nsIDOMSVGAnimatedTransformList> transforms;
|
|
|
|
transformable->GetTransform(getter_AddRefs(transforms));
|
|
|
|
NS_ADD_SVGVALUE_OBSERVER(transforms);
|
|
|
|
|
|
|
|
// construct a pathgeometry object:
|
|
|
|
nsISVGOuterSVGFrame* outerSVGFrame = GetOuterSVGFrame();
|
|
|
|
if (!outerSVGFrame) {
|
|
|
|
NS_ERROR("Null outerSVGFrame");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsISVGRenderer> renderer;
|
|
|
|
outerSVGFrame->GetRenderer(getter_AddRefs(renderer));
|
|
|
|
|
|
|
|
renderer->CreatePathGeometry(this, getter_AddRefs(mGeometry));
|
|
|
|
|
|
|
|
if (!mGeometry) return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsISVGRendererPathGeometry *
|
|
|
|
nsSVGPathGeometryFrame::GetGeometry()
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_ASSERTION(mGeometry, "invalid geometry object");
|
|
|
|
#endif
|
|
|
|
return mGeometry;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsSVGPathGeometryFrame::UpdateGraphic(PRUint32 flags)
|
|
|
|
{
|
|
|
|
mUpdateFlags |= flags;
|
|
|
|
|
|
|
|
nsISVGOuterSVGFrame *outerSVGFrame = GetOuterSVGFrame();
|
|
|
|
if (!outerSVGFrame) {
|
|
|
|
NS_ERROR("null outerSVGFrame");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool suspended;
|
|
|
|
outerSVGFrame->IsRedrawSuspended(&suspended);
|
|
|
|
if (!suspended) {
|
|
|
|
nsCOMPtr<nsISVGRendererRegion> dirty_region;
|
|
|
|
GetGeometry()->Update(mUpdateFlags, getter_AddRefs(dirty_region));
|
2004-12-09 03:16:15 +00:00
|
|
|
if (dirty_region) {
|
|
|
|
// if we're painting a marker, this will get called during paint
|
|
|
|
// when the region already be invalidated as needed
|
|
|
|
|
|
|
|
nsIView *view = GetClosestView();
|
|
|
|
if (!view) return;
|
|
|
|
nsIViewManager *vm = view->GetViewManager();
|
|
|
|
PRBool painting;
|
|
|
|
vm->IsPainting(painting);
|
|
|
|
|
|
|
|
if (!painting)
|
|
|
|
outerSVGFrame->InvalidateRegion(dirty_region, PR_TRUE);
|
|
|
|
}
|
Landing of SVG_20020806_BRANCH, Bug 182533. Refactoring of SVG backend, new GDI+ and Libart rendering
backends, text support on Windows (GDI+), rudimentary text support on Linux (libart/freetype2), presentation
attributes, lots of bug fixes (see bug 182533 for dependency list).
Not part of default build; code is #ifdef'ed out.
r=sicking, sr=jst for dom and htmlparser changes
r=bsmedberg, sr=tor for config changes
r=dbaron, sr=bzbarsky for content and layout changes
r=tor, sr=bzbarsky for gfx changes
2004-02-07 12:39:26 +00:00
|
|
|
mUpdateFlags = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsISVGOuterSVGFrame *
|
|
|
|
nsSVGPathGeometryFrame::GetOuterSVGFrame()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mParent, "null parent");
|
|
|
|
|
|
|
|
nsISVGContainerFrame *containerFrame;
|
|
|
|
mParent->QueryInterface(NS_GET_IID(nsISVGContainerFrame), (void**)&containerFrame);
|
|
|
|
if (!containerFrame) {
|
|
|
|
NS_ERROR("invalid container");
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
return containerFrame->GetOuterSVGFrame();
|
|
|
|
}
|
|
|
|
|