зеркало из https://github.com/mozilla/pjs.git
Bug 334400 - create SVG transform list lazily. r=jwatt, sr=roc
This commit is contained in:
Родитель
b00892e09f
Коммит
332722923c
|
@ -69,30 +69,6 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGGraphicElementBase)
|
||||||
nsSVGGraphicElement::nsSVGGraphicElement(nsINodeInfo *aNodeInfo)
|
nsSVGGraphicElement::nsSVGGraphicElement(nsINodeInfo *aNodeInfo)
|
||||||
: nsSVGGraphicElementBase(aNodeInfo)
|
: nsSVGGraphicElementBase(aNodeInfo)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsSVGGraphicElement::Init()
|
|
||||||
{
|
|
||||||
nsresult rv = nsSVGGraphicElementBase::Init();
|
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
|
||||||
|
|
||||||
// Create mapped properties:
|
|
||||||
|
|
||||||
// DOM property: transform, #IMPLIED attrib: transform
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIDOMSVGTransformList> transformList;
|
|
||||||
rv = nsSVGTransformList::Create(getter_AddRefs(transformList));
|
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
|
||||||
rv = NS_NewSVGAnimatedTransformList(getter_AddRefs(mTransforms),
|
|
||||||
transformList);
|
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
|
||||||
rv = AddMappedSVGValue(nsSVGAtoms::transform, mTransforms);
|
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -143,6 +119,31 @@ NS_IMETHODIMP nsSVGGraphicElement::GetBBox(nsIDOMSVGRect **_retval)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Helper for GetCTM and GetScreenCTM */
|
||||||
|
nsresult
|
||||||
|
nsSVGGraphicElement::AppendLocalTransform(nsIDOMSVGMatrix *aCTM,
|
||||||
|
nsIDOMSVGMatrix **_retval)
|
||||||
|
{
|
||||||
|
if (!mTransforms) {
|
||||||
|
*_retval = aCTM;
|
||||||
|
NS_ADDREF(*_retval);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// append our local transformations
|
||||||
|
nsCOMPtr<nsIDOMSVGTransformList> transforms;
|
||||||
|
mTransforms->GetAnimVal(getter_AddRefs(transforms));
|
||||||
|
NS_ENSURE_TRUE(transforms, NS_ERROR_FAILURE);
|
||||||
|
nsCOMPtr<nsIDOMSVGMatrix> matrix;
|
||||||
|
transforms->GetConsolidationMatrix(getter_AddRefs(matrix));
|
||||||
|
if (!matrix) {
|
||||||
|
*_retval = aCTM;
|
||||||
|
NS_ADDREF(*_retval);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
return aCTM->Multiply(matrix, _retval); // addrefs, so we don't
|
||||||
|
}
|
||||||
|
|
||||||
/* nsIDOMSVGMatrix getCTM (); */
|
/* nsIDOMSVGMatrix getCTM (); */
|
||||||
NS_IMETHODIMP nsSVGGraphicElement::GetCTM(nsIDOMSVGMatrix **_retval)
|
NS_IMETHODIMP nsSVGGraphicElement::GetCTM(nsIDOMSVGMatrix **_retval)
|
||||||
{
|
{
|
||||||
|
@ -182,13 +183,7 @@ NS_IMETHODIMP nsSVGGraphicElement::GetCTM(nsIDOMSVGMatrix **_retval)
|
||||||
rv = locatableElement->GetCTM(getter_AddRefs(parentCTM));
|
rv = locatableElement->GetCTM(getter_AddRefs(parentCTM));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// append our local transformations
|
return AppendLocalTransform(parentCTM, _retval);
|
||||||
nsCOMPtr<nsIDOMSVGTransformList> transforms;
|
|
||||||
mTransforms->GetAnimVal(getter_AddRefs(transforms));
|
|
||||||
NS_ENSURE_TRUE(transforms, NS_ERROR_FAILURE);
|
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> matrix;
|
|
||||||
transforms->GetConsolidationMatrix(getter_AddRefs(matrix));
|
|
||||||
return parentCTM->Multiply(matrix, _retval); // addrefs, so we don't
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nsIDOMSVGMatrix getScreenCTM (); */
|
/* nsIDOMSVGMatrix getScreenCTM (); */
|
||||||
|
@ -230,13 +225,7 @@ NS_IMETHODIMP nsSVGGraphicElement::GetScreenCTM(nsIDOMSVGMatrix **_retval)
|
||||||
rv = locatableElement->GetScreenCTM(getter_AddRefs(parentScreenCTM));
|
rv = locatableElement->GetScreenCTM(getter_AddRefs(parentScreenCTM));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// append our local transformations
|
return AppendLocalTransform(parentScreenCTM, _retval);
|
||||||
nsCOMPtr<nsIDOMSVGTransformList> transforms;
|
|
||||||
mTransforms->GetAnimVal(getter_AddRefs(transforms));
|
|
||||||
NS_ENSURE_TRUE(transforms, NS_ERROR_FAILURE);
|
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> matrix;
|
|
||||||
transforms->GetConsolidationMatrix(getter_AddRefs(matrix));
|
|
||||||
return parentScreenCTM->Multiply(matrix, _retval); // addrefs, so we don't
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */
|
/* nsIDOMSVGMatrix getTransformToElement (in nsIDOMSVGElement element); */
|
||||||
|
@ -269,12 +258,14 @@ NS_IMETHODIMP nsSVGGraphicElement::GetTransformToElement(nsIDOMSVGElement *eleme
|
||||||
|
|
||||||
NS_IMETHODIMP nsSVGGraphicElement::GetTransform(nsIDOMSVGAnimatedTransformList * *aTransform)
|
NS_IMETHODIMP nsSVGGraphicElement::GetTransform(nsIDOMSVGAnimatedTransformList * *aTransform)
|
||||||
{
|
{
|
||||||
|
if (!mTransforms && NS_FAILED(CreateTransformList()))
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
*aTransform = mTransforms;
|
*aTransform = mTransforms;
|
||||||
NS_IF_ADDREF(*aTransform);
|
NS_ADDREF(*aTransform);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// nsIContent methods
|
// nsIContent methods
|
||||||
|
|
||||||
|
@ -299,3 +290,59 @@ nsSVGGraphicElement::IsEventName(nsIAtom* aName)
|
||||||
{
|
{
|
||||||
return IsGraphicElementEventName(aName);
|
return IsGraphicElementEventName(aName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<nsIDOMSVGMatrix>
|
||||||
|
nsSVGGraphicElement::GetLocalTransformMatrix()
|
||||||
|
{
|
||||||
|
if (!mTransforms)
|
||||||
|
return nsnull;
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMSVGTransformList> transforms;
|
||||||
|
rv = mTransforms->GetAnimVal(getter_AddRefs(transforms));
|
||||||
|
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMSVGMatrix> localTM;
|
||||||
|
rv = transforms->GetConsolidationMatrix(getter_AddRefs(localTM));
|
||||||
|
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||||
|
|
||||||
|
nsIDOMSVGMatrix *retval = localTM.get();
|
||||||
|
NS_IF_ADDREF(retval);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsSVGGraphicElement::BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
|
const nsAString* aValue, PRBool aNotify)
|
||||||
|
{
|
||||||
|
if (aNamespaceID == kNameSpaceID_None &&
|
||||||
|
aName == nsGkAtoms::transform &&
|
||||||
|
!mTransforms &&
|
||||||
|
NS_FAILED(CreateTransformList()))
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
return nsSVGGraphicElementBase::BeforeSetAttr(aNamespaceID, aName,
|
||||||
|
aValue, aNotify);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsSVGGraphicElement::CreateTransformList()
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
// DOM property: transform, #IMPLIED attrib: transform
|
||||||
|
nsCOMPtr<nsIDOMSVGTransformList> transformList;
|
||||||
|
rv = nsSVGTransformList::Create(getter_AddRefs(transformList));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
rv = NS_NewSVGAnimatedTransformList(getter_AddRefs(mTransforms),
|
||||||
|
transformList);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
rv = AddMappedSVGValue(nsSVGAtoms::transform, mTransforms);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
mTransforms = nsnull;
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ class nsSVGGraphicElement : public nsSVGGraphicElementBase,
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
nsSVGGraphicElement(nsINodeInfo *aNodeInfo);
|
nsSVGGraphicElement(nsINodeInfo *aNodeInfo);
|
||||||
nsresult Init();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// interfaces:
|
// interfaces:
|
||||||
|
@ -62,11 +61,22 @@ public:
|
||||||
// nsIContent interface
|
// nsIContent interface
|
||||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||||
|
|
||||||
|
// Used by frames to get consolidation matrix of transform list
|
||||||
|
already_AddRefed<nsIDOMSVGMatrix> GetLocalTransformMatrix();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// nsSVGElement overrides
|
// nsSVGElement overrides
|
||||||
virtual PRBool IsEventName(nsIAtom* aName);
|
virtual PRBool IsEventName(nsIAtom* aName);
|
||||||
|
|
||||||
|
virtual nsresult BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||||
|
const nsAString* aValue, PRBool aNotify);
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMSVGAnimatedTransformList> mTransforms;
|
nsCOMPtr<nsIDOMSVGAnimatedTransformList> mTransforms;
|
||||||
|
|
||||||
|
// helper
|
||||||
|
nsresult CreateTransformList();
|
||||||
|
nsresult AppendLocalTransform(nsIDOMSVGMatrix *aCTM,
|
||||||
|
nsIDOMSVGMatrix **_retval);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __NS_SVGGRAPHICELEMENT_H__
|
#endif // __NS_SVGGRAPHICELEMENT_H__
|
||||||
|
|
|
@ -553,20 +553,29 @@ NS_IMETHODIMP nsSVGTransformList::GetConsolidationMatrix(nsIDOMSVGMatrix **_retv
|
||||||
*_retval = nsnull;
|
*_retval = nsnull;
|
||||||
PRInt32 count = mTransforms.Count();
|
PRInt32 count = mTransforms.Count();
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> conmatrix;
|
if (!count)
|
||||||
nsresult rv = NS_NewSVGMatrix(getter_AddRefs(conmatrix));
|
return NS_OK;
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> temp1, temp2;
|
|
||||||
|
|
||||||
for (PRInt32 i = 0; i < count; ++i) {
|
nsCOMPtr<nsIDOMSVGMatrix> conmatrix;
|
||||||
nsIDOMSVGTransform* transform = ElementAt(i);
|
|
||||||
transform->GetMatrix(getter_AddRefs(temp1));
|
// single transform common case - shortcut
|
||||||
conmatrix->Multiply(temp1, getter_AddRefs(temp2));
|
if (count == 1) {
|
||||||
if (!temp2)
|
ElementAt(0)->GetMatrix(getter_AddRefs(conmatrix));
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
} else {
|
||||||
conmatrix = temp2;
|
nsresult rv = NS_NewSVGMatrix(getter_AddRefs(conmatrix));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMSVGMatrix> temp1, temp2;
|
||||||
|
|
||||||
|
for (PRInt32 i = 0; i < count; ++i) {
|
||||||
|
nsIDOMSVGTransform* transform = ElementAt(i);
|
||||||
|
transform->GetMatrix(getter_AddRefs(temp1));
|
||||||
|
conmatrix->Multiply(temp1, getter_AddRefs(temp2));
|
||||||
|
if (!temp2)
|
||||||
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
conmatrix = temp2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*_retval = conmatrix;
|
*_retval = conmatrix;
|
||||||
|
|
|
@ -34,19 +34,17 @@
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "nsIDOMSVGTransformable.h"
|
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDOMSVGClipPathElement.h"
|
#include "nsIDOMSVGClipPathElement.h"
|
||||||
#include "nsSVGClipPathFrame.h"
|
#include "nsSVGClipPathFrame.h"
|
||||||
#include "nsISVGRendererCanvas.h"
|
#include "nsISVGRendererCanvas.h"
|
||||||
#include "nsIDOMSVGTransformList.h"
|
|
||||||
#include "nsSVGAnimatedTransformList.h"
|
|
||||||
#include "nsIDOMSVGAnimatedEnum.h"
|
#include "nsIDOMSVGAnimatedEnum.h"
|
||||||
#include "nsISVGRendererSurface.h"
|
#include "nsISVGRendererSurface.h"
|
||||||
#include "nsSVGDefsFrame.h"
|
#include "nsSVGDefsFrame.h"
|
||||||
#include "nsSVGAtoms.h"
|
#include "nsSVGAtoms.h"
|
||||||
#include "nsSVGUtils.h"
|
#include "nsSVGUtils.h"
|
||||||
|
#include "nsSVGGraphicElement.h"
|
||||||
|
|
||||||
typedef nsSVGDefsFrame nsSVGClipPathFrameBase;
|
typedef nsSVGDefsFrame nsSVGClipPathFrameBase;
|
||||||
|
|
||||||
|
@ -318,22 +316,10 @@ nsSVGClipPathFrame::GetCanvasTM()
|
||||||
mClipParentMatrix = containerFrame->GetCanvasTM();
|
mClipParentMatrix = containerFrame->GetCanvasTM();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> localTM;
|
nsSVGGraphicElement *element =
|
||||||
{
|
NS_STATIC_CAST(nsSVGGraphicElement*, mContent);
|
||||||
nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(mContent);
|
nsCOMPtr<nsIDOMSVGMatrix> localTM = element->GetLocalTransformMatrix();
|
||||||
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)
|
|
||||||
transforms->GetConsolidationMatrix(getter_AddRefs(localTM));
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> canvasTM;
|
nsCOMPtr<nsIDOMSVGMatrix> canvasTM;
|
||||||
|
|
||||||
if (localTM)
|
if (localTM)
|
||||||
|
|
|
@ -1,345 +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) 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 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 ***** */
|
|
||||||
|
|
||||||
#include "nsIDOMSVGRect.h"
|
|
||||||
#include "nsIDOMSVGGElement.h"
|
|
||||||
#include "nsPresContext.h"
|
|
||||||
#include "nsISVGOuterSVGFrame.h"
|
|
||||||
#include "nsISVGRendererCanvas.h"
|
|
||||||
#include "nsISVGValue.h"
|
|
||||||
#include "nsIDOMSVGTransformable.h"
|
|
||||||
#include "nsIDOMSVGAnimTransformList.h"
|
|
||||||
#include "nsIDOMSVGTransformList.h"
|
|
||||||
#include "nsSVGDefsFrame.h"
|
|
||||||
#include "nsSVGUtils.h"
|
|
||||||
#include "nsINameSpaceManager.h"
|
|
||||||
#include "nsGkAtoms.h"
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// Implementation
|
|
||||||
|
|
||||||
nsIFrame*
|
|
||||||
NS_NewSVGDefsFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext)
|
|
||||||
{
|
|
||||||
return new (aPresShell) nsSVGDefsFrame(aContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stub method specialized by subclasses. Not called by said
|
|
||||||
// specializations.
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::InitSVG()
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// nsISupports methods
|
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsSVGDefsFrame)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISVGChildFrame)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISVGContainerFrame)
|
|
||||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGDefsFrameBase)
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// nsIFrame methods
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::Init(
|
|
||||||
nsIContent* aContent,
|
|
||||||
nsIFrame* aParent,
|
|
||||||
nsIFrame* aPrevInFlow)
|
|
||||||
{
|
|
||||||
nsresult rv;
|
|
||||||
rv = nsSVGDefsFrameBase::Init(aContent, aParent, aPrevInFlow);
|
|
||||||
|
|
||||||
InitSVG();
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::AppendFrames(nsIAtom* aListName,
|
|
||||||
nsIFrame* aFrameList)
|
|
||||||
{
|
|
||||||
// append == insert at end:
|
|
||||||
return InsertFrames(aListName, mFrames.LastChild(), aFrameList);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::InsertFrames(nsIAtom* aListName,
|
|
||||||
nsIFrame* aPrevFrame,
|
|
||||||
nsIFrame* aFrameList)
|
|
||||||
{
|
|
||||||
// memorize last new frame
|
|
||||||
nsIFrame* lastNewFrame = nsnull;
|
|
||||||
{
|
|
||||||
nsFrameList tmpList(aFrameList);
|
|
||||||
lastNewFrame = tmpList.LastChild();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert the new frames
|
|
||||||
mFrames.InsertFrames(this, aPrevFrame, aFrameList);
|
|
||||||
|
|
||||||
// call InitialUpdate() on all new frames:
|
|
||||||
nsIFrame* end = nsnull;
|
|
||||||
if (lastNewFrame)
|
|
||||||
end = lastNewFrame->GetNextSibling();
|
|
||||||
|
|
||||||
for (nsIFrame* kid = aFrameList; kid != end;
|
|
||||||
kid = kid->GetNextSibling()) {
|
|
||||||
nsISVGChildFrame* SVGFrame=nsnull;
|
|
||||||
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
|
||||||
if (SVGFrame) {
|
|
||||||
SVGFrame->InitialUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::RemoveFrame(nsIAtom* aListName,
|
|
||||||
nsIFrame* aOldFrame)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsISVGRendererRegion> dirty_region;
|
|
||||||
|
|
||||||
nsISVGChildFrame* SVGFrame=nsnull;
|
|
||||||
aOldFrame->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
|
||||||
|
|
||||||
if (SVGFrame)
|
|
||||||
dirty_region = SVGFrame->GetCoveredRegion();
|
|
||||||
|
|
||||||
PRBool result = mFrames.DestroyFrame(aOldFrame);
|
|
||||||
|
|
||||||
nsISVGOuterSVGFrame* outerSVGFrame = nsSVGUtils::GetOuterSVGFrame(this);
|
|
||||||
NS_ASSERTION(outerSVGFrame, "no outer svg frame");
|
|
||||||
if (dirty_region && outerSVGFrame)
|
|
||||||
outerSVGFrame->InvalidateRegion(dirty_region, PR_TRUE);
|
|
||||||
|
|
||||||
NS_ASSERTION(result, "didn't find frame to delete");
|
|
||||||
return result ? NS_OK : NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIAtom *
|
|
||||||
nsSVGDefsFrame::GetType() const
|
|
||||||
{
|
|
||||||
return nsLayoutAtoms::svgDefsFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsSVGDefsFrame::IsFrameOfType(PRUint32 aFlags) const
|
|
||||||
{
|
|
||||||
return !(aFlags & ~nsIFrame::eSVG);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
|
||||||
nsIAtom* aAttribute,
|
|
||||||
PRInt32 aModType)
|
|
||||||
{
|
|
||||||
if (aNameSpaceID == kNameSpaceID_None &&
|
|
||||||
aAttribute == nsGkAtoms::transform) {
|
|
||||||
// make sure our cached transform matrix gets (lazily) updated
|
|
||||||
mCanvasTM = nsnull;
|
|
||||||
|
|
||||||
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
||||||
kid = kid->GetNextSibling()) {
|
|
||||||
nsISVGChildFrame* SVGFrame=nsnull;
|
|
||||||
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
|
||||||
if (SVGFrame)
|
|
||||||
SVGFrame->NotifyCanvasTMChanged(PR_FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// nsISVGChildFrame methods
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::PaintSVG(nsISVGRendererCanvas* canvas)
|
|
||||||
{
|
|
||||||
// defs don't paint
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::GetFrameForPointSVG(float x, float y, nsIFrame** hit)
|
|
||||||
{
|
|
||||||
*hit = nsnull;
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP_(already_AddRefed<nsISVGRendererRegion>)
|
|
||||||
nsSVGDefsFrame::GetCoveredRegion()
|
|
||||||
{
|
|
||||||
nsISVGRendererRegion *accu_region=nsnull;
|
|
||||||
|
|
||||||
return accu_region;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::InitialUpdate()
|
|
||||||
{
|
|
||||||
nsIFrame* kid = mFrames.FirstChild();
|
|
||||||
while (kid) {
|
|
||||||
nsISVGChildFrame* SVGFrame=0;
|
|
||||||
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
|
||||||
if (SVGFrame) {
|
|
||||||
SVGFrame->InitialUpdate();
|
|
||||||
}
|
|
||||||
kid = kid->GetNextSibling();
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::NotifyCanvasTMChanged(PRBool suppressInvalidation)
|
|
||||||
{
|
|
||||||
// make sure our cached transform matrix gets (lazily) updated
|
|
||||||
mCanvasTM = nsnull;
|
|
||||||
|
|
||||||
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
||||||
kid = kid->GetNextSibling()) {
|
|
||||||
nsISVGChildFrame* SVGFrame=nsnull;
|
|
||||||
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
|
||||||
if (SVGFrame) {
|
|
||||||
SVGFrame->NotifyCanvasTMChanged(suppressInvalidation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::NotifyRedrawSuspended()
|
|
||||||
{
|
|
||||||
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
||||||
kid = kid->GetNextSibling()) {
|
|
||||||
nsISVGChildFrame* SVGFrame=nsnull;
|
|
||||||
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
|
||||||
if (SVGFrame) {
|
|
||||||
SVGFrame->NotifyRedrawSuspended();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::NotifyRedrawUnsuspended()
|
|
||||||
{
|
|
||||||
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
||||||
kid = kid->GetNextSibling()) {
|
|
||||||
nsISVGChildFrame* SVGFrame=nsnull;
|
|
||||||
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
|
||||||
if (SVGFrame) {
|
|
||||||
SVGFrame->NotifyRedrawUnsuspended();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSVGDefsFrame::GetBBox(nsIDOMSVGRect **_retval)
|
|
||||||
{
|
|
||||||
*_retval = nsnull;
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// nsISVGContainerFrame methods:
|
|
||||||
|
|
||||||
already_AddRefed<nsIDOMSVGMatrix>
|
|
||||||
nsSVGDefsFrame::GetCanvasTM()
|
|
||||||
{
|
|
||||||
if (!mCanvasTM) {
|
|
||||||
// get our parent's tm and append local transforms (if any):
|
|
||||||
NS_ASSERTION(mParent, "null parent");
|
|
||||||
nsISVGContainerFrame *containerFrame;
|
|
||||||
mParent->QueryInterface(NS_GET_IID(nsISVGContainerFrame), (void**)&containerFrame);
|
|
||||||
if (!containerFrame) {
|
|
||||||
NS_ERROR("invalid parent");
|
|
||||||
return nsnull;
|
|
||||||
}
|
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> parentTM = containerFrame->GetCanvasTM();
|
|
||||||
NS_ASSERTION(parentTM, "null TM");
|
|
||||||
|
|
||||||
// got the parent tm, now check for local tm:
|
|
||||||
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)
|
|
||||||
transforms->GetConsolidationMatrix(getter_AddRefs(localTM));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localTM)
|
|
||||||
parentTM->Multiply(localTM, getter_AddRefs(mCanvasTM));
|
|
||||||
else
|
|
||||||
mCanvasTM = parentTM;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIDOMSVGMatrix* retval = mCanvasTM.get();
|
|
||||||
NS_IF_ADDREF(retval);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<nsSVGCoordCtxProvider>
|
|
||||||
nsSVGDefsFrame::GetCoordContextProvider()
|
|
||||||
{
|
|
||||||
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->GetCoordContextProvider();
|
|
||||||
}
|
|
|
@ -41,11 +41,6 @@
|
||||||
#include "nsISVGRendererCanvas.h"
|
#include "nsISVGRendererCanvas.h"
|
||||||
#include "nsISVGValue.h"
|
#include "nsISVGValue.h"
|
||||||
#include "nsIDOMSVGGElement.h"
|
#include "nsIDOMSVGGElement.h"
|
||||||
#include "nsIDOMSVGTransformable.h"
|
|
||||||
#include "nsIDOMSVGAnimTransformList.h"
|
|
||||||
#include "nsIDOMSVGTransformList.h"
|
|
||||||
#include "nsIDOMSVGAnimatedLength.h"
|
|
||||||
#include "nsIDOMSVGLength.h"
|
|
||||||
#include "nsIDOMSVGForeignObjectElem.h"
|
#include "nsIDOMSVGForeignObjectElem.h"
|
||||||
#include "nsIDOMSVGMatrix.h"
|
#include "nsIDOMSVGMatrix.h"
|
||||||
#include "nsIDOMSVGSVGElement.h"
|
#include "nsIDOMSVGSVGElement.h"
|
||||||
|
@ -513,21 +508,9 @@ nsSVGForeignObjectFrame::GetCanvasTM()
|
||||||
NS_ASSERTION(parentTM, "null TM");
|
NS_ASSERTION(parentTM, "null TM");
|
||||||
|
|
||||||
// got the parent tm, now check for local tm:
|
// got the parent tm, now check for local tm:
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> localTM;
|
nsSVGGraphicElement *element =
|
||||||
{
|
NS_STATIC_CAST(nsSVGGraphicElement*, mContent);
|
||||||
nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(mContent);
|
nsCOMPtr<nsIDOMSVGMatrix> localTM = element->GetLocalTransformMatrix();
|
||||||
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)
|
|
||||||
transforms->GetConsolidationMatrix(getter_AddRefs(localTM));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localTM)
|
if (localTM)
|
||||||
parentTM->Multiply(localTM, getter_AddRefs(mCanvasTM));
|
parentTM->Multiply(localTM, getter_AddRefs(mCanvasTM));
|
||||||
|
|
|
@ -524,6 +524,8 @@ NS_IMETHODIMP
|
||||||
nsSVGGradientFrame::GetGradientTransform(nsIDOMSVGMatrix **aGradientTransform,
|
nsSVGGradientFrame::GetGradientTransform(nsIDOMSVGMatrix **aGradientTransform,
|
||||||
nsISVGGeometrySource *aSource)
|
nsISVGGeometrySource *aSource)
|
||||||
{
|
{
|
||||||
|
*aGradientTransform = nsnull;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> bboxTransform;
|
nsCOMPtr<nsIDOMSVGMatrix> bboxTransform;
|
||||||
PRUint16 gradientUnits = GetGradientUnits();
|
PRUint16 gradientUnits = GetGradientUnits();
|
||||||
if (gradientUnits == nsIDOMSVGGradientElement::SVG_GRUNITS_USERSPACEONUSE) {
|
if (gradientUnits == nsIDOMSVGGradientElement::SVG_GRUNITS_USERSPACEONUSE) {
|
||||||
|
@ -583,6 +585,12 @@ nsSVGGradientFrame::GetGradientTransform(nsIDOMSVGMatrix **aGradientTransform,
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> gradientTransform;
|
nsCOMPtr<nsIDOMSVGMatrix> gradientTransform;
|
||||||
trans->GetConsolidationMatrix(getter_AddRefs(gradientTransform));
|
trans->GetConsolidationMatrix(getter_AddRefs(gradientTransform));
|
||||||
|
|
||||||
|
if (!gradientTransform) {
|
||||||
|
*aGradientTransform = bboxTransform;
|
||||||
|
NS_ADDREF(*aGradientTransform);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
return bboxTransform->Multiply(gradientTransform, aGradientTransform);
|
return bboxTransform->Multiply(gradientTransform, aGradientTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,6 @@
|
||||||
#include "nsISVGRendererRegion.h"
|
#include "nsISVGRendererRegion.h"
|
||||||
#include "nsISVGValueUtils.h"
|
#include "nsISVGValueUtils.h"
|
||||||
#include "nsISVGGeometrySource.h"
|
#include "nsISVGGeometrySource.h"
|
||||||
#include "nsIDOMSVGTransformable.h"
|
|
||||||
#include "nsIDOMSVGAnimTransformList.h"
|
|
||||||
#include "nsIDOMSVGTransformList.h"
|
|
||||||
#include "nsISVGContainerFrame.h"
|
#include "nsISVGContainerFrame.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsUnicharUtils.h"
|
#include "nsUnicharUtils.h"
|
||||||
|
@ -65,6 +62,7 @@
|
||||||
#include "nsSVGMaskFrame.h"
|
#include "nsSVGMaskFrame.h"
|
||||||
#include "nsISVGRendererSurface.h"
|
#include "nsISVGRendererSurface.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
|
#include "nsSVGGraphicElement.h"
|
||||||
|
|
||||||
struct nsSVGMarkerProperty {
|
struct nsSVGMarkerProperty {
|
||||||
nsISVGMarkerFrame *mMarkerStart;
|
nsISVGMarkerFrame *mMarkerStart;
|
||||||
|
@ -613,24 +611,13 @@ nsSVGPathGeometryFrame::GetCanvasTM(nsIDOMSVGMatrix * *aCTM)
|
||||||
NS_ASSERTION(parentTM, "null TM");
|
NS_ASSERTION(parentTM, "null TM");
|
||||||
|
|
||||||
// append our local transformations if we have any:
|
// append our local transformations if we have any:
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> localTM;
|
nsSVGGraphicElement *element =
|
||||||
{
|
NS_STATIC_CAST(nsSVGGraphicElement*, mContent);
|
||||||
nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(mContent);
|
nsCOMPtr<nsIDOMSVGMatrix> localTM = element->GetLocalTransformMatrix();
|
||||||
NS_ASSERTION(transformable, "wrong content element");
|
|
||||||
nsCOMPtr<nsIDOMSVGAnimatedTransformList> atl;
|
if (localTM)
|
||||||
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)
|
|
||||||
transforms->GetConsolidationMatrix(getter_AddRefs(localTM));
|
|
||||||
}
|
|
||||||
if (localTM) {
|
|
||||||
return parentTM->Multiply(localTM, aCTM);
|
return parentTM->Multiply(localTM, aCTM);
|
||||||
}
|
|
||||||
*aCTM = parentTM;
|
*aCTM = parentTM;
|
||||||
NS_ADDREF(*aCTM);
|
NS_ADDREF(*aCTM);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -564,6 +564,8 @@ nsSVGPatternFrame::GetPatternContentUnits(PRUint16 *aUnits)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSVGPatternFrame::GetPatternTransform(nsIDOMSVGMatrix **aPatternTransform)
|
nsSVGPatternFrame::GetPatternTransform(nsIDOMSVGMatrix **aPatternTransform)
|
||||||
{
|
{
|
||||||
|
*aPatternTransform = nsnull;
|
||||||
|
|
||||||
// See if we need to get the value from another pattern
|
// See if we need to get the value from another pattern
|
||||||
if (!checkURITarget(nsGkAtoms::patternTransform)) {
|
if (!checkURITarget(nsGkAtoms::patternTransform)) {
|
||||||
// No, return the values
|
// No, return the values
|
||||||
|
@ -574,6 +576,13 @@ nsSVGPatternFrame::GetPatternTransform(nsIDOMSVGMatrix **aPatternTransform)
|
||||||
nsCOMPtr<nsIDOMSVGTransformList> lTrans;
|
nsCOMPtr<nsIDOMSVGTransformList> lTrans;
|
||||||
trans->GetAnimVal(getter_AddRefs(lTrans));
|
trans->GetAnimVal(getter_AddRefs(lTrans));
|
||||||
lTrans->GetConsolidationMatrix(aPatternTransform);
|
lTrans->GetConsolidationMatrix(aPatternTransform);
|
||||||
|
if (!*aPatternTransform) {
|
||||||
|
nsresult rv = NS_NewSVGMatrix(aPatternTransform);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
mLoopFlag = PR_FALSE;
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Yes, get it from the target
|
// Yes, get it from the target
|
||||||
mNextPattern->GetPatternTransform(aPatternTransform);
|
mNextPattern->GetPatternTransform(aPatternTransform);
|
||||||
|
|
|
@ -44,15 +44,12 @@
|
||||||
#include "nsWeakReference.h"
|
#include "nsWeakReference.h"
|
||||||
#include "nsISVGValue.h"
|
#include "nsISVGValue.h"
|
||||||
#include "nsISVGValueObserver.h"
|
#include "nsISVGValueObserver.h"
|
||||||
#include "nsIDOMSVGTransformable.h"
|
|
||||||
#include "nsIDOMSVGAnimTransformList.h"
|
|
||||||
#include "nsIDOMSVGSVGElement.h"
|
#include "nsIDOMSVGSVGElement.h"
|
||||||
#include "nsIDOMSVGMatrix.h"
|
#include "nsIDOMSVGMatrix.h"
|
||||||
#include "nsIDOMSVGLengthList.h"
|
#include "nsIDOMSVGLengthList.h"
|
||||||
#include "nsIDOMSVGLength.h"
|
#include "nsIDOMSVGLength.h"
|
||||||
#include "nsISVGValueUtils.h"
|
#include "nsISVGValueUtils.h"
|
||||||
#include "nsIDOMSVGAnimatedLengthList.h"
|
#include "nsIDOMSVGAnimatedLengthList.h"
|
||||||
#include "nsIDOMSVGTransformList.h"
|
|
||||||
#include "nsISVGContainerFrame.h"
|
#include "nsISVGContainerFrame.h"
|
||||||
#include "nsISVGChildFrame.h"
|
#include "nsISVGChildFrame.h"
|
||||||
#include "nsISVGGlyphFragmentNode.h"
|
#include "nsISVGGlyphFragmentNode.h"
|
||||||
|
@ -72,6 +69,7 @@
|
||||||
#include "nsISVGRendererSurface.h"
|
#include "nsISVGRendererSurface.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
|
#include "nsSVGGraphicElement.h"
|
||||||
|
|
||||||
typedef nsContainerFrame nsSVGTextFrameBase;
|
typedef nsContainerFrame nsSVGTextFrameBase;
|
||||||
|
|
||||||
|
@ -181,7 +179,6 @@ protected:
|
||||||
void EnsureFragmentTreeUpToDate();
|
void EnsureFragmentTreeUpToDate();
|
||||||
void UpdateFragmentTree();
|
void UpdateFragmentTree();
|
||||||
void UpdateGlyphPositioning();
|
void UpdateGlyphPositioning();
|
||||||
already_AddRefed<nsIDOMSVGAnimatedTransformList> GetTransform();
|
|
||||||
nsISVGGlyphFragmentNode *GetFirstGlyphFragmentChildNode();
|
nsISVGGlyphFragmentNode *GetFirstGlyphFragmentChildNode();
|
||||||
nsISVGGlyphFragmentNode *GetNextGlyphFragmentChildNode(nsISVGGlyphFragmentNode*node);
|
nsISVGGlyphFragmentNode *GetNextGlyphFragmentChildNode(nsISVGGlyphFragmentNode*node);
|
||||||
|
|
||||||
|
@ -729,21 +726,9 @@ nsSVGTextFrame::GetCanvasTM()
|
||||||
NS_ASSERTION(parentTM, "null TM");
|
NS_ASSERTION(parentTM, "null TM");
|
||||||
|
|
||||||
// got the parent tm, now check for local tm:
|
// got the parent tm, now check for local tm:
|
||||||
nsCOMPtr<nsIDOMSVGMatrix> localTM;
|
nsSVGGraphicElement *element =
|
||||||
{
|
NS_STATIC_CAST(nsSVGGraphicElement*, mContent);
|
||||||
nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(mContent);
|
nsCOMPtr<nsIDOMSVGMatrix> localTM = element->GetLocalTransformMatrix();
|
||||||
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)
|
|
||||||
transforms->GetConsolidationMatrix(getter_AddRefs(localTM));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localTM)
|
if (localTM)
|
||||||
parentTM->Multiply(localTM, getter_AddRefs(mCanvasTM));
|
parentTM->Multiply(localTM, getter_AddRefs(mCanvasTM));
|
||||||
|
@ -1164,17 +1149,6 @@ nsSVGTextFrame::GetDy()
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsIDOMSVGAnimatedTransformList>
|
|
||||||
nsSVGTextFrame::GetTransform()
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(mContent);
|
|
||||||
NS_ASSERTION(transformable, "wrong content element");
|
|
||||||
|
|
||||||
nsIDOMSVGAnimatedTransformList *retval;
|
|
||||||
transformable->GetTransform(&retval);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsISVGGlyphFragmentNode *
|
nsISVGGlyphFragmentNode *
|
||||||
nsSVGTextFrame::GetFirstGlyphFragmentChildNode()
|
nsSVGTextFrame::GetFirstGlyphFragmentChildNode()
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче