2004-08-05 09:01:13 +00:00
|
|
|
/* -*- 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) 2001
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
|
|
|
|
*
|
|
|
|
* 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 ***** */
|
|
|
|
|
2006-06-01 15:31:15 +00:00
|
|
|
#include "nsIFrame.h"
|
2004-08-05 09:01:13 +00:00
|
|
|
#include "nsISVGChildFrame.h"
|
2006-06-15 19:10:28 +00:00
|
|
|
#include "nsSVGOuterSVGFrame.h"
|
2004-10-27 00:25:08 +00:00
|
|
|
#include "nsIDOMSVGAnimatedRect.h"
|
2004-12-24 16:26:10 +00:00
|
|
|
#include "nsSVGMatrix.h"
|
2005-09-06 22:30:40 +00:00
|
|
|
#include "nsSVGFilterFrame.h"
|
2006-04-14 15:09:39 +00:00
|
|
|
#include "nsSVGSVGElement.h"
|
2006-06-01 15:31:15 +00:00
|
|
|
#include "nsSVGContainerFrame.h"
|
2006-11-27 17:30:57 +00:00
|
|
|
#include "gfxContext.h"
|
2004-08-05 09:01:13 +00:00
|
|
|
|
2006-06-01 15:31:15 +00:00
|
|
|
typedef nsSVGDisplayContainerFrame nsSVGInnerSVGFrameBase;
|
2004-08-05 09:01:13 +00:00
|
|
|
|
|
|
|
class nsSVGInnerSVGFrame : public nsSVGInnerSVGFrameBase,
|
2004-09-13 22:55:43 +00:00
|
|
|
public nsISVGValueObserver,
|
|
|
|
public nsSupportsWeakReference,
|
|
|
|
public nsISVGSVGFrame
|
2004-08-05 09:01:13 +00:00
|
|
|
{
|
2005-11-11 02:36:29 +00:00
|
|
|
friend nsIFrame*
|
2006-03-26 21:30:36 +00:00
|
|
|
NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
|
2004-08-05 09:01:13 +00:00
|
|
|
protected:
|
2006-03-26 21:30:36 +00:00
|
|
|
nsSVGInnerSVGFrame(nsStyleContext* aContext);
|
2004-08-05 09:01:13 +00:00
|
|
|
|
|
|
|
// 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; }
|
2006-06-01 15:31:15 +00:00
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
public:
|
|
|
|
// nsIFrame:
|
2006-03-21 15:49:20 +00:00
|
|
|
NS_IMETHOD DidSetStyleContext();
|
2004-08-05 09:01:13 +00:00
|
|
|
|
2006-03-02 20:22:19 +00:00
|
|
|
// We don't define an AttributeChanged method since changes to the
|
|
|
|
// 'x', 'y', 'width' and 'height' attributes of our content object
|
|
|
|
// are handled in nsSVGSVGElement::DidModifySVGObservable
|
|
|
|
|
2005-04-01 19:56:08 +00:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsLayoutAtoms::svgInnerSVGFrame
|
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
2004-08-05 09:01:13 +00:00
|
|
|
|
2005-04-01 19:56:08 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGInnerSVG"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
2004-08-05 09:01:13 +00:00
|
|
|
|
|
|
|
// nsISVGChildFrame interface:
|
2006-11-27 17:30:57 +00:00
|
|
|
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, nsRect *aDirtyRect);
|
2006-07-12 15:36:23 +00:00
|
|
|
NS_IMETHOD InitialUpdate();
|
2005-09-06 22:30:40 +00:00
|
|
|
NS_IMETHOD NotifyCanvasTMChanged(PRBool suppressInvalidation);
|
2004-12-24 16:26:10 +00:00
|
|
|
NS_IMETHOD SetMatrixPropagation(PRBool aPropagate);
|
2005-09-06 22:30:40 +00:00
|
|
|
NS_IMETHOD SetOverrideCTM(nsIDOMSVGMatrix *aCTM);
|
2006-09-19 16:35:29 +00:00
|
|
|
NS_IMETHOD GetFrameForPointSVG(float x, float y, nsIFrame** hit);
|
|
|
|
|
2006-06-01 15:31:15 +00:00
|
|
|
// nsSVGContainerFrame methods:
|
2006-11-29 03:47:57 +00:00
|
|
|
virtual already_AddRefed<nsSVGCoordCtxProvider> GetCoordContextProvider();
|
2006-06-01 15:31:15 +00:00
|
|
|
virtual already_AddRefed<nsIDOMSVGMatrix> GetCanvasTM();
|
2004-08-05 09:01:13 +00:00
|
|
|
|
2004-09-13 22:55:43 +00:00
|
|
|
// nsISVGValueObserver
|
2005-01-16 01:44:52 +00:00
|
|
|
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
|
|
|
|
nsISVGValue::modificationType aModType);
|
|
|
|
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
|
|
|
|
nsISVGValue::modificationType aModType);
|
2004-09-13 22:55:43 +00:00
|
|
|
|
|
|
|
// nsISupportsWeakReference
|
|
|
|
// implementation inherited from nsSupportsWeakReference
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
// nsISVGSVGFrame interface:
|
|
|
|
NS_IMETHOD SuspendRedraw();
|
|
|
|
NS_IMETHOD UnsuspendRedraw();
|
|
|
|
NS_IMETHOD NotifyViewportChange();
|
|
|
|
|
|
|
|
protected:
|
2006-07-12 15:36:23 +00:00
|
|
|
|
|
|
|
void UpdateCoordCtx();
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> mCanvasTM;
|
2005-09-06 22:30:40 +00:00
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> mOverrideCTM;
|
|
|
|
|
2006-03-01 10:59:36 +00:00
|
|
|
PRPackedBool mPropagateTransform;
|
2004-08-05 09:01:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
2005-11-11 02:36:29 +00:00
|
|
|
nsIFrame*
|
2006-03-26 21:30:36 +00:00
|
|
|
NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext)
|
2004-08-05 09:01:13 +00:00
|
|
|
{
|
2006-03-26 21:30:36 +00:00
|
|
|
return new (aPresShell) nsSVGInnerSVGFrame(aContext);
|
2004-08-05 09:01:13 +00:00
|
|
|
}
|
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
nsSVGInnerSVGFrame::nsSVGInnerSVGFrame(nsStyleContext* aContext) :
|
|
|
|
nsSVGInnerSVGFrameBase(aContext), mPropagateTransform(PR_TRUE)
|
2004-08-05 09:01:13 +00:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
// printf("nsSVGInnerSVGFrame CTOR\n");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2006-07-12 15:36:23 +00:00
|
|
|
void
|
|
|
|
nsSVGInnerSVGFrame::UpdateCoordCtx()
|
2004-08-05 09:01:13 +00:00
|
|
|
{
|
2006-06-01 15:31:15 +00:00
|
|
|
nsSVGContainerFrame *containerFrame = NS_STATIC_CAST(nsSVGContainerFrame*,
|
|
|
|
mParent);
|
2006-07-12 15:36:23 +00:00
|
|
|
nsSVGSVGElement *svgElement = NS_STATIC_CAST(nsSVGSVGElement*, mContent);
|
2004-09-13 22:55:43 +00:00
|
|
|
|
2006-07-12 15:36:23 +00:00
|
|
|
svgElement->SetParentCoordCtxProvider(nsRefPtr<nsSVGCoordCtxProvider>(containerFrame->GetCoordContextProvider()));
|
2004-08-05 09:01:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISupports methods
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN(nsSVGInnerSVGFrame)
|
2004-09-13 22:55:43 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
|
2006-01-18 16:31:42 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
2004-08-05 09:01:13 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISVGSVGFrame)
|
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsSVGInnerSVGFrameBase)
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIFrame methods
|
2004-09-13 22:55:43 +00:00
|
|
|
|
2005-04-01 19:56:08 +00:00
|
|
|
nsIAtom *
|
|
|
|
nsSVGInnerSVGFrame::GetType() const
|
|
|
|
{
|
|
|
|
return nsLayoutAtoms::svgInnerSVGFrame;
|
|
|
|
}
|
2004-08-05 09:01:13 +00:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGChildFrame methods
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2006-11-27 17:30:57 +00:00
|
|
|
nsSVGInnerSVGFrame::PaintSVG(nsSVGRenderState *aContext, nsRect *aDirtyRect)
|
2004-08-05 09:01:13 +00:00
|
|
|
{
|
2006-10-27 10:34:23 +00:00
|
|
|
nsresult rv = NS_OK;
|
2004-10-27 00:25:08 +00:00
|
|
|
|
2006-11-27 17:30:57 +00:00
|
|
|
gfxContext *gfx = aContext->GetGfxContext();
|
|
|
|
|
|
|
|
gfx->Save();
|
2004-10-27 00:25:08 +00:00
|
|
|
|
|
|
|
if (GetStyleDisplay()->IsScrollableOverflow()) {
|
2006-04-14 15:09:39 +00:00
|
|
|
nsSVGSVGElement *svg = NS_STATIC_CAST(nsSVGSVGElement*, mContent);
|
2005-07-02 23:45:33 +00:00
|
|
|
|
|
|
|
float x, y, width, height;
|
2006-04-14 15:09:39 +00:00
|
|
|
svg->GetAnimatedLengthValues(&x, &y, &width, &height, nsnull);
|
2005-07-02 23:45:33 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> clipTransform;
|
|
|
|
if (!mPropagateTransform) {
|
|
|
|
NS_NewSVGMatrix(getter_AddRefs(clipTransform));
|
|
|
|
} else {
|
2006-06-01 15:31:15 +00:00
|
|
|
nsSVGContainerFrame *parent = NS_STATIC_CAST(nsSVGContainerFrame*,
|
|
|
|
mParent);
|
|
|
|
clipTransform = parent->GetCanvasTM();
|
2004-10-27 00:25:08 +00:00
|
|
|
}
|
2005-07-02 23:45:33 +00:00
|
|
|
|
2006-11-27 17:30:57 +00:00
|
|
|
if (clipTransform)
|
|
|
|
nsSVGUtils::SetClipRect(gfx, clipTransform, x, y, width, height);
|
2004-10-27 00:25:08 +00:00
|
|
|
}
|
|
|
|
|
2006-11-27 17:30:57 +00:00
|
|
|
rv = nsSVGInnerSVGFrameBase::PaintSVG(aContext, aDirtyRect);
|
2006-01-20 17:00:43 +00:00
|
|
|
|
2006-11-27 17:30:57 +00:00
|
|
|
gfx->Restore();
|
2004-10-27 00:25:08 +00:00
|
|
|
|
2006-10-27 10:34:23 +00:00
|
|
|
return rv;
|
2004-08-05 09:01:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-09-06 22:30:40 +00:00
|
|
|
nsSVGInnerSVGFrame::NotifyCanvasTMChanged(PRBool suppressInvalidation)
|
2004-08-05 09:01:13 +00:00
|
|
|
{
|
|
|
|
// make sure our cached transform matrix gets (lazily) updated
|
|
|
|
mCanvasTM = nsnull;
|
2006-12-01 05:16:14 +00:00
|
|
|
nsSVGSVGElement *svg = NS_STATIC_CAST(nsSVGSVGElement*, mContent);
|
|
|
|
svg->InvalidateViewBoxToViewport();
|
2004-08-05 09:01:13 +00:00
|
|
|
|
2006-06-01 15:31:15 +00:00
|
|
|
return nsSVGInnerSVGFrameBase::NotifyCanvasTMChanged(suppressInvalidation);
|
2004-08-05 09:01:13 +00:00
|
|
|
}
|
|
|
|
|
2006-07-12 15:36:23 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGInnerSVGFrame::InitialUpdate()
|
|
|
|
{
|
|
|
|
UpdateCoordCtx();
|
|
|
|
|
|
|
|
return nsSVGInnerSVGFrameBase::InitialUpdate();
|
|
|
|
}
|
2004-08-05 09:01:13 +00:00
|
|
|
|
2004-12-24 16:26:10 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGInnerSVGFrame::SetMatrixPropagation(PRBool aPropagate)
|
|
|
|
{
|
|
|
|
mPropagateTransform = aPropagate;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2005-09-06 22:30:40 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGInnerSVGFrame::SetOverrideCTM(nsIDOMSVGMatrix *aCTM)
|
|
|
|
{
|
|
|
|
mOverrideCTM = aCTM;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-09-19 16:35:29 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGInnerSVGFrame::GetFrameForPointSVG(float x, float y, nsIFrame** hit)
|
|
|
|
{
|
|
|
|
if (GetStyleDisplay()->IsScrollableOverflow()) {
|
|
|
|
float clipX, clipY, clipWidth, clipHeight;
|
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> clipTransform;
|
|
|
|
|
|
|
|
nsSVGElement *svg = NS_STATIC_CAST(nsSVGElement*, mContent);
|
|
|
|
svg->GetAnimatedLengthValues(&clipX, &clipY, &clipWidth, &clipHeight, nsnull);
|
|
|
|
|
|
|
|
nsSVGContainerFrame *parent = NS_STATIC_CAST(nsSVGContainerFrame*,
|
|
|
|
mParent);
|
|
|
|
clipTransform = parent->GetCanvasTM();
|
|
|
|
|
|
|
|
if (!nsSVGUtils::HitTestRect(clipTransform,
|
|
|
|
clipX, clipY, clipWidth, clipHeight,
|
|
|
|
x, y)) {
|
|
|
|
*hit = nsnull;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsSVGInnerSVGFrameBase::GetFrameForPointSVG(x, y, hit);
|
|
|
|
}
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGSVGFrame methods:
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGInnerSVGFrame::SuspendRedraw()
|
|
|
|
{
|
2006-06-15 19:10:28 +00:00
|
|
|
nsSVGOuterSVGFrame *outerSVGFrame = nsSVGUtils::GetOuterSVGFrame(this);
|
2004-08-05 09:01:13 +00:00
|
|
|
if (!outerSVGFrame) {
|
|
|
|
NS_ERROR("no outer svg frame");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return outerSVGFrame->SuspendRedraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGInnerSVGFrame::UnsuspendRedraw()
|
|
|
|
{
|
2006-06-15 19:10:28 +00:00
|
|
|
nsSVGOuterSVGFrame *outerSVGFrame = nsSVGUtils::GetOuterSVGFrame(this);
|
2004-08-05 09:01:13 +00:00
|
|
|
if (!outerSVGFrame) {
|
|
|
|
NS_ERROR("no outer svg frame");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
return outerSVGFrame->UnsuspendRedraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGInnerSVGFrame::NotifyViewportChange()
|
|
|
|
{
|
|
|
|
// make sure canvas transform matrix gets (lazily) recalculated:
|
|
|
|
mCanvasTM = nsnull;
|
|
|
|
|
|
|
|
// inform children
|
|
|
|
SuspendRedraw();
|
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
|
|
|
while (kid) {
|
2006-08-02 08:42:26 +00:00
|
|
|
nsISVGChildFrame* SVGFrame = nsnull;
|
|
|
|
CallQueryInterface(kid, &SVGFrame);
|
2004-08-05 09:01:13 +00:00
|
|
|
if (SVGFrame)
|
2005-09-06 22:30:40 +00:00
|
|
|
SVGFrame->NotifyCanvasTMChanged(PR_FALSE);
|
2004-08-05 09:01:13 +00:00
|
|
|
kid = kid->GetNextSibling();
|
|
|
|
}
|
|
|
|
UnsuspendRedraw();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2006-06-01 15:31:15 +00:00
|
|
|
// nsSVGContainerFrame methods:
|
2004-08-05 09:01:13 +00:00
|
|
|
|
2006-11-29 03:47:57 +00:00
|
|
|
already_AddRefed<nsSVGCoordCtxProvider>
|
|
|
|
nsSVGInnerSVGFrame::GetCoordContextProvider()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mContent, "null parent");
|
|
|
|
|
|
|
|
// Our <svg> content element is the CoordContextProvider for our children:
|
|
|
|
nsSVGCoordCtxProvider *provider;
|
|
|
|
CallQueryInterface(mContent, &provider);
|
|
|
|
|
|
|
|
return provider;
|
|
|
|
}
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
already_AddRefed<nsIDOMSVGMatrix>
|
|
|
|
nsSVGInnerSVGFrame::GetCanvasTM()
|
|
|
|
{
|
2005-09-06 22:30:40 +00:00
|
|
|
if (!mPropagateTransform) {
|
|
|
|
nsIDOMSVGMatrix *retval;
|
|
|
|
if (mOverrideCTM) {
|
|
|
|
retval = mOverrideCTM;
|
|
|
|
NS_ADDREF(retval);
|
|
|
|
} else {
|
2004-12-24 16:26:10 +00:00
|
|
|
NS_NewSVGMatrix(&retval);
|
|
|
|
}
|
2005-09-06 22:30:40 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
// parentTM * Translate(x,y) * viewboxToViewportTM
|
2004-12-24 16:26:10 +00:00
|
|
|
|
2005-09-06 22:30:40 +00:00
|
|
|
if (!mCanvasTM) {
|
2004-12-01 16:23:12 +00:00
|
|
|
// get the transform from our parent's coordinate system to ours:
|
2004-08-05 09:01:13 +00:00
|
|
|
NS_ASSERTION(mParent, "null parent");
|
2006-06-01 15:31:15 +00:00
|
|
|
nsSVGContainerFrame *containerFrame = NS_STATIC_CAST(nsSVGContainerFrame*,
|
|
|
|
mParent);
|
2004-08-05 09:01:13 +00:00
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> parentTM = containerFrame->GetCanvasTM();
|
|
|
|
NS_ASSERTION(parentTM, "null TM");
|
|
|
|
|
2004-12-01 16:23:12 +00:00
|
|
|
// append the transform due to the 'x' and 'y' attributes:
|
|
|
|
float x, y;
|
2006-04-14 15:09:39 +00:00
|
|
|
nsSVGSVGElement *svg = NS_STATIC_CAST(nsSVGSVGElement*, mContent);
|
|
|
|
svg->GetAnimatedLengthValues(&x, &y, nsnull);
|
|
|
|
|
2004-12-01 16:23:12 +00:00
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> xyTM;
|
|
|
|
parentTM->Translate(x, y, getter_AddRefs(xyTM));
|
|
|
|
|
|
|
|
// append the viewbox to viewport transform:
|
2004-08-05 09:01:13 +00:00
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> viewBoxToViewportTM;
|
2006-04-26 21:02:25 +00:00
|
|
|
nsSVGSVGElement *svgElement = NS_STATIC_CAST(nsSVGSVGElement*, mContent);
|
2004-08-05 09:01:13 +00:00
|
|
|
svgElement->GetViewboxToViewportTransform(getter_AddRefs(viewBoxToViewportTM));
|
2004-12-01 16:23:12 +00:00
|
|
|
xyTM->Multiply(viewBoxToViewportTM, getter_AddRefs(mCanvasTM));
|
2004-08-05 09:01:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsIDOMSVGMatrix* retval = mCanvasTM.get();
|
|
|
|
NS_IF_ADDREF(retval);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2004-09-13 22:55:43 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGValueObserver methods:
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-01-16 01:44:52 +00:00
|
|
|
nsSVGInnerSVGFrame::WillModifySVGObservable(nsISVGValue* observable,
|
|
|
|
nsISVGValue::modificationType aModType)
|
2004-09-13 22:55:43 +00:00
|
|
|
{
|
2006-03-21 15:49:20 +00:00
|
|
|
nsSVGUtils::WillModifyEffects(this, observable, aModType);
|
2006-01-20 17:00:43 +00:00
|
|
|
return NS_OK;
|
2004-09-13 22:55:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-01-16 01:44:52 +00:00
|
|
|
nsSVGInnerSVGFrame::DidModifySVGObservable (nsISVGValue* observable,
|
|
|
|
nsISVGValue::modificationType aModType)
|
2004-09-13 22:55:43 +00:00
|
|
|
{
|
2005-09-06 22:30:40 +00:00
|
|
|
nsISVGFilterFrame *filter;
|
|
|
|
CallQueryInterface(observable, &filter);
|
|
|
|
|
2006-03-21 15:49:20 +00:00
|
|
|
nsSVGUtils::DidModifyEffects(this, observable, aModType);
|
2005-09-06 22:30:40 +00:00
|
|
|
|
2006-03-21 15:49:20 +00:00
|
|
|
if (!filter) {
|
2005-09-06 22:30:40 +00:00
|
|
|
NotifyViewportChange();
|
|
|
|
}
|
|
|
|
|
2004-09-13 22:55:43 +00:00
|
|
|
return NS_OK;
|
2004-08-05 09:01:13 +00:00
|
|
|
}
|
2006-03-21 15:49:20 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGInnerSVGFrame::DidSetStyleContext()
|
|
|
|
{
|
|
|
|
nsSVGUtils::StyleEffects(this);
|
|
|
|
return NS_OK;
|
|
|
|
}
|