2001-12-12 07:59:31 +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 *****
|
2001-12-12 07:59:31 +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
|
2001-12-12 07:59:31 +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
|
2001-12-12 07:59:31 +00:00
|
|
|
* Crocodile Clips Ltd..
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
|
|
* 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)
|
2001-12-12 07:59:31 +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"),
|
2001-12-12 07:59:31 +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
|
2001-12-12 07:59:31 +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 ***** */
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
//#include "nsHTMLContainerFrame.h"
|
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
#include "nsCSSRendering.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 "nsISVGSVGElement.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
2001-12-12 07:59:31 +00:00
|
|
|
#include "nsIDOMSVGAnimatedLength.h"
|
|
|
|
#include "nsIDOMSVGLength.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"
|
|
|
|
#include "nsISVGChildFrame.h"
|
|
|
|
#include "nsISVGOuterSVGFrame.h"
|
|
|
|
#include "nsISVGRendererCanvas.h"
|
2001-12-12 07:59:31 +00:00
|
|
|
#include "nsIView.h"
|
|
|
|
#include "nsIViewManager.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nsISVGValue.h"
|
|
|
|
#include "nsISVGValueObserver.h"
|
|
|
|
#include "nsHTMLParts.h"
|
2002-05-10 18:22:41 +00:00
|
|
|
#include "nsReflowPath.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 "nsIServiceManager.h"
|
|
|
|
#include "nsISVGRectangleSink.h"
|
|
|
|
#include "nsISVGValueUtils.h"
|
2004-08-05 09:01:13 +00:00
|
|
|
#include "nsIDOMSVGRect.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 "nsIDOMSVGNumber.h"
|
2004-08-05 09:01:13 +00:00
|
|
|
#include "nsSVGCoordCtxProvider.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
|
|
|
#if defined(DEBUG) && defined(SVG_DEBUG_PRINTING)
|
|
|
|
#include "nsIDeviceContext.h"
|
|
|
|
#include "nsTransform2D.h"
|
|
|
|
#endif
|
2004-12-02 23:13:13 +00:00
|
|
|
#include "nsISVGEnum.h"
|
|
|
|
#include "nsIDOMSVGPoint.h"
|
|
|
|
#include "nsIDOMSVGZoomAndPan.h"
|
|
|
|
#include "nsIDOMSVGAnimatedRect.h"
|
|
|
|
#include "nsIDOMSVGFitToViewBox.h"
|
2004-12-05 22:12:43 +00:00
|
|
|
#include "nsSVGRect.h"
|
2005-04-01 19:56:08 +00:00
|
|
|
#include "nsLayoutAtoms.h"
|
2005-08-25 21:31:09 +00:00
|
|
|
#include "nsIDocument.h"
|
2005-02-18 16:30:12 +00:00
|
|
|
|
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
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// VMRectInvalidator: helper class for invalidating rects on the viewmanager.
|
|
|
|
// used in nsSVGOuterSVGFrame::InvalidateRegion
|
|
|
|
|
|
|
|
class VMRectInvalidator : public nsISVGRectangleSink
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
friend already_AddRefed<nsISVGRectangleSink> CreateVMRectInvalidator(nsIViewManager* vm,
|
|
|
|
nsIView* view,
|
|
|
|
int twipsPerPx);
|
|
|
|
VMRectInvalidator(nsIViewManager* vm, nsIView* view, int twipsPerPx);
|
|
|
|
|
|
|
|
public:
|
|
|
|
// nsISupports interface:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsISVGRectangleSink interface:
|
|
|
|
NS_DECL_NSISVGRECTANGLESINK
|
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIViewManager> mViewManager;
|
|
|
|
nsIView* mView;
|
|
|
|
int mTwipsPerPx;
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation:
|
|
|
|
|
|
|
|
VMRectInvalidator::VMRectInvalidator(nsIViewManager* vm, nsIView* view,
|
|
|
|
int twipsPerPx)
|
|
|
|
: mViewManager(vm), mView(view), mTwipsPerPx(twipsPerPx)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<nsISVGRectangleSink>
|
|
|
|
CreateVMRectInvalidator(nsIViewManager* vm, nsIView* view, int twipsPerPx)
|
|
|
|
{
|
|
|
|
nsISVGRectangleSink* retval = new VMRectInvalidator(vm, view, twipsPerPx);
|
|
|
|
NS_IF_ADDREF(retval);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISupports methods:
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF(VMRectInvalidator)
|
|
|
|
NS_IMPL_RELEASE(VMRectInvalidator)
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN(VMRectInvalidator)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISVGRectangleSink)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGRectangleSink methods:
|
|
|
|
|
|
|
|
/* void sinkRectangle (in float x, in float y, in float width, in float height); */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
VMRectInvalidator::SinkRectangle(float x, float y, float width, float height)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
// printf("invalidating %f %f %f %f\n", x,y,width,height);
|
|
|
|
#endif
|
|
|
|
nsRect rect((nscoord)(x*mTwipsPerPx), (nscoord)(y*mTwipsPerPx),
|
|
|
|
(nscoord)(width*mTwipsPerPx), (nscoord)(height*mTwipsPerPx));
|
|
|
|
mViewManager->UpdateView(mView, rect, NS_VMREFRESH_NO_SYNC);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsSVGOuterSVGFrame class
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
//typedef nsHTMLContainerFrame nsSVGOuterSVGFrameBase;
|
|
|
|
typedef nsContainerFrame nsSVGOuterSVGFrameBase;
|
|
|
|
|
|
|
|
class nsSVGOuterSVGFrame : public nsSVGOuterSVGFrameBase,
|
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
|
|
|
public nsISVGOuterSVGFrame,
|
|
|
|
public nsISVGContainerFrame,
|
2001-12-12 07:59:31 +00:00
|
|
|
public nsISVGValueObserver,
|
2004-08-05 09:01:13 +00:00
|
|
|
public nsSupportsWeakReference,
|
|
|
|
public nsSVGCoordCtxProvider
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
|
|
|
friend nsresult
|
|
|
|
NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame);
|
|
|
|
protected:
|
|
|
|
nsSVGOuterSVGFrame();
|
|
|
|
virtual ~nsSVGOuterSVGFrame();
|
|
|
|
nsresult Init();
|
|
|
|
|
|
|
|
// 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; }
|
|
|
|
public:
|
|
|
|
// nsIFrame:
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD Init(nsPresContext* aPresContext,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
2003-02-22 00:32:13 +00:00
|
|
|
nsStyleContext* aContext,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD DidReflow(nsPresContext* aPresContext,
|
2001-12-12 07:59:31 +00:00
|
|
|
const nsHTMLReflowState* aReflowState,
|
|
|
|
nsDidReflowStatus aStatus);
|
|
|
|
|
|
|
|
|
2005-02-07 01:58:25 +00:00
|
|
|
NS_IMETHOD AppendFrames(nsIAtom* aListName,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsIFrame* aFrameList);
|
2005-02-07 01:58:25 +00:00
|
|
|
NS_IMETHOD InsertFrames(nsIAtom* aListName,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList);
|
2005-02-07 01:58:25 +00:00
|
|
|
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsIFrame* aOldFrame);
|
2005-02-07 01:58:25 +00:00
|
|
|
NS_IMETHOD ReplaceFrame(nsIAtom* aListName,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame);
|
|
|
|
|
2004-12-31 01:13:27 +00:00
|
|
|
NS_IMETHOD AttributeChanged(nsIContent* aChild,
|
2001-12-12 07:59:31 +00:00
|
|
|
PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
2003-07-11 21:16:12 +00:00
|
|
|
PRInt32 aModType);
|
2001-12-12 07:59:31 +00:00
|
|
|
|
2005-01-01 17:26:29 +00:00
|
|
|
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
nsIFrame** aFrame);
|
|
|
|
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD Paint(nsPresContext* aPresContext,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags = 0);
|
|
|
|
|
2005-02-03 15:04:39 +00:00
|
|
|
PRBool CanPaintBackground() { return PR_FALSE; }
|
|
|
|
|
2005-04-01 19:56:08 +00:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsLayoutAtoms::svgOuterSVGFrame
|
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGOuterSVG"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-12-12 07:59:31 +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);
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
// nsISupportsWeakReference
|
|
|
|
// implementation inherited from nsSupportsWeakReference
|
|
|
|
|
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
|
|
|
// nsISVGOuterSVGFrame interface:
|
|
|
|
NS_IMETHOD InvalidateRegion(nsISVGRendererRegion* region, PRBool bRedraw);
|
2001-12-12 07:59:31 +00:00
|
|
|
NS_IMETHOD IsRedrawSuspended(PRBool* isSuspended);
|
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_IMETHOD GetRenderer(nsISVGRenderer**renderer);
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
// nsISVGSVGFrame interface:
|
|
|
|
NS_IMETHOD SuspendRedraw();
|
|
|
|
NS_IMETHOD UnsuspendRedraw();
|
|
|
|
NS_IMETHOD NotifyViewportChange();
|
|
|
|
|
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
|
|
|
// nsISVGContainerFrame interface:
|
2004-08-05 09:01:13 +00:00
|
|
|
nsISVGOuterSVGFrame*GetOuterSVGFrame();
|
|
|
|
already_AddRefed<nsIDOMSVGMatrix> GetCanvasTM();
|
|
|
|
already_AddRefed<nsSVGCoordCtxProvider> GetCoordContextProvider();
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// implementation helpers:
|
|
|
|
void InitiateReflow();
|
|
|
|
|
|
|
|
float GetPxPerTwips();
|
|
|
|
float GetTwipsPerPx();
|
|
|
|
|
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
|
|
|
void AddAsWidthHeightObserver();
|
|
|
|
void RemoveAsWidthHeightObserver();
|
|
|
|
|
|
|
|
void CalculateAvailableSpace(nsRect *maxRect, nsRect *preferredRect,
|
2004-07-31 23:15:21 +00:00
|
|
|
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
|
|
|
const nsHTMLReflowState& aReflowState);
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
// nsIView* mView;
|
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
|
|
|
PRUint32 mRedrawSuspendCount;
|
2001-12-12 07:59:31 +00:00
|
|
|
PRBool mNeedsReflow;
|
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
|
|
|
PRBool mViewportInitialized;
|
|
|
|
nsCOMPtr<nsISVGRenderer> mRenderer;
|
2004-08-05 09:01:13 +00:00
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> mCanvasTM;
|
2004-12-02 23:13:13 +00:00
|
|
|
|
|
|
|
// zoom and pan
|
|
|
|
nsCOMPtr<nsISVGEnum> mZoomAndPan;
|
|
|
|
nsCOMPtr<nsIDOMSVGPoint> mCurrentTranslate;
|
|
|
|
nsCOMPtr<nsIDOMSVGNumber> mCurrentScale;
|
2001-12-12 07:59:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame)
|
|
|
|
{
|
|
|
|
*aNewFrame = nsnull;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMSVGSVGElement> svgElement = do_QueryInterface(aContent);
|
|
|
|
if (!svgElement) {
|
|
|
|
#ifdef DEBUG
|
|
|
|
printf("warning: trying to construct an SVGOuterSVGFrame for a content element that doesn't support the right interfaces\n");
|
|
|
|
#endif
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGOuterSVGFrame* it = new (aPresShell) nsSVGOuterSVGFrame;
|
|
|
|
if (nsnull == it)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
*aNewFrame = it;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGOuterSVGFrame::nsSVGOuterSVGFrame()
|
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
|
|
|
: mRedrawSuspendCount(0),
|
|
|
|
mNeedsReflow(PR_FALSE),
|
|
|
|
mViewportInitialized(PR_FALSE)
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsSVGOuterSVGFrame::~nsSVGOuterSVGFrame()
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
// printf("~nsSVGOuterSVGFrame %p\n", this);
|
|
|
|
#endif
|
2004-12-02 23:13:13 +00:00
|
|
|
|
|
|
|
if (mZoomAndPan)
|
|
|
|
NS_REMOVE_SVGVALUE_OBSERVER(mZoomAndPan);
|
|
|
|
|
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
|
|
|
RemoveAsWidthHeightObserver();
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsSVGOuterSVGFrame::Init()
|
|
|
|
{
|
2004-02-12 16:05:54 +00:00
|
|
|
#if (defined(MOZ_SVG_RENDERER_GDIPLUS) + \
|
|
|
|
defined(MOZ_SVG_RENDERER_LIBART) + \
|
|
|
|
defined(MOZ_SVG_RENDERER_CAIRO) > 1)
|
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
|
|
|
#error "Multiple SVG renderers. Please choose one manually."
|
|
|
|
#elif defined(MOZ_SVG_RENDERER_GDIPLUS)
|
|
|
|
mRenderer = do_CreateInstance(NS_SVG_RENDERER_GDIPLUS_CONTRACTID);
|
|
|
|
#elif defined(MOZ_SVG_RENDERER_LIBART)
|
|
|
|
mRenderer = do_CreateInstance(NS_SVG_RENDERER_LIBART_CONTRACTID);
|
2004-02-12 16:05:54 +00:00
|
|
|
#elif defined(MOZ_SVG_RENDERER_CAIRO)
|
|
|
|
mRenderer = do_CreateInstance(NS_SVG_RENDERER_CAIRO_CONTRACTID);
|
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
|
|
|
#else
|
|
|
|
#error "No SVG renderer."
|
|
|
|
#endif
|
|
|
|
NS_ASSERTION(mRenderer, "could not get renderer");
|
2004-08-05 09:01:13 +00:00
|
|
|
|
|
|
|
// we are an *outer* svg element, so this frame will become the
|
|
|
|
// coordinate context for our content element:
|
|
|
|
float mmPerPx = GetTwipsPerPx() / TWIPS_PER_POINT_FLOAT / (72.0f * 0.03937f);
|
|
|
|
SetCoordCtxMMPerPx(mmPerPx, mmPerPx);
|
|
|
|
|
|
|
|
nsCOMPtr<nsISVGSVGElement> SVGElement = do_QueryInterface(mContent);
|
|
|
|
NS_ASSERTION(SVGElement, "wrong content element");
|
|
|
|
SVGElement->SetParentCoordCtxProvider(this);
|
|
|
|
|
2005-08-25 21:31:09 +00:00
|
|
|
// we only care about our content's zoom and pan values if it's the root element
|
|
|
|
nsIDocument* doc = mContent->GetCurrentDoc();
|
|
|
|
if (doc && doc->GetRootContent() == mContent) {
|
|
|
|
SVGElement->GetZoomAndPanEnum(getter_AddRefs(mZoomAndPan));
|
|
|
|
NS_ADD_SVGVALUE_OBSERVER(mZoomAndPan);
|
|
|
|
SVGElement->GetCurrentTranslate(getter_AddRefs(mCurrentTranslate));
|
|
|
|
SVGElement->GetCurrentScaleNumber(getter_AddRefs(mCurrentScale));
|
|
|
|
}
|
|
|
|
|
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
|
|
|
AddAsWidthHeightObserver();
|
|
|
|
SuspendRedraw();
|
2001-12-12 07:59:31 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISupports methods
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN(nsSVGOuterSVGFrame)
|
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_INTERFACE_MAP_ENTRY(nsISVGContainerFrame)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISVGOuterSVGFrame)
|
2004-08-05 09:01:13 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISVGSVGFrame)
|
2001-12-12 07:59:31 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
|
2004-08-05 09:01:13 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsSVGCoordCtxProvider)
|
2001-12-12 07:59:31 +00:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsSVGOuterSVGFrameBase)
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsIFrame methods
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSVGOuterSVGFrame::Init(nsPresContext* aPresContext,
|
2004-08-05 09:01:13 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow)
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
rv = nsSVGOuterSVGFrameBase::Init(aPresContext, aContent, aParent,
|
|
|
|
aContext, aPrevInFlow);
|
|
|
|
|
|
|
|
Init();
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// reflowing
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
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
|
|
|
#if defined(DEBUG) && defined(SVG_DEBUG_PRINTING)
|
|
|
|
{
|
|
|
|
printf("nsSVGOuterSVGFrame(%p)::Reflow()[\n",this);
|
2004-07-29 19:41:39 +00:00
|
|
|
float twipsPerScPx = aPresContext->ScaledPixelsToTwips();
|
|
|
|
float twipsPerPx = aPresContext->PixelsToTwips();
|
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
|
|
|
printf("tw/sc(px)=%f tw/px=%f\n", twipsPerScPx, twipsPerPx);
|
|
|
|
printf("]\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
// check whether this reflow request is targeted at us or a child
|
|
|
|
// frame (e.g. a foreignObject):
|
2002-05-10 18:22:41 +00:00
|
|
|
if (aReflowState.reason == eReflowReason_Incremental) {
|
|
|
|
nsReflowPath::iterator iter = aReflowState.path->FirstChild();
|
|
|
|
nsReflowPath::iterator end = aReflowState.path->EndChildren();
|
|
|
|
|
|
|
|
for ( ; iter != end; ++iter) {
|
|
|
|
// The actual target of this reflow is one of our child
|
|
|
|
// frames. Since SVG as such doesn't use reflow, this will
|
|
|
|
// probably be the child of a <foreignObject>. Some HTML|XUL
|
|
|
|
// content frames target reflow events at themselves when they
|
|
|
|
// need to be redrawn in response to e.g. a style change. For
|
|
|
|
// correct visual updating, we must make sure the reflow
|
|
|
|
// reaches its intended target.
|
2001-12-12 07:59:31 +00:00
|
|
|
|
2002-05-10 18:22:41 +00:00
|
|
|
// Since it is an svg frame (probably an nsSVGForeignObjectFrame),
|
|
|
|
// we might as well pass in our aDesiredSize and aReflowState
|
|
|
|
// objects - they are ignored by svg frames:
|
|
|
|
nsSize availSpace(0, 0); // XXXwaterson probably wrong!
|
|
|
|
nsHTMLReflowState state(aPresContext, aReflowState, *iter, availSpace);
|
|
|
|
(*iter)->Reflow (aPresContext,
|
|
|
|
aDesiredSize,
|
|
|
|
state,
|
|
|
|
aStatus);
|
|
|
|
|
|
|
|
// XXX do we really have to return our metrics although we're
|
|
|
|
// not affected by the reflow? Is there a way of telling our
|
|
|
|
// parent that we don't want anything changed?
|
|
|
|
aDesiredSize.width = mRect.width;
|
|
|
|
aDesiredSize.height = mRect.height;
|
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
|
|
|
aDesiredSize.descent = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! aReflowState.path->mReflowCommand) {
|
|
|
|
// We're not the target of the incremental reflow, so just bail.
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
return NS_OK;
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SVG CR 20001102: When the SVG content is embedded inline within
|
|
|
|
// a containing document, and that document is styled using CSS,
|
|
|
|
// then if there are CSS positioning properties specified on the
|
|
|
|
// outermost 'svg' element that are sufficient to establish the
|
|
|
|
// width of the viewport, then these positioning properties
|
|
|
|
// establish the viewport's width; otherwise, the width attribute
|
|
|
|
// on the outermost 'svg' element establishes the viewport's width.
|
|
|
|
// Similarly, if there are CSS positioning properties specified on
|
|
|
|
// the outermost 'svg' element that are sufficient to establish the
|
|
|
|
// height of the viewport, then these positioning properties
|
|
|
|
// establish the viewport's height; otherwise, the height attribute
|
|
|
|
// on the outermost 'svg' element establishes the viewport's
|
|
|
|
// height.
|
|
|
|
#ifdef DEBUG
|
|
|
|
// printf("--- nsSVGOuterSVGFrame(%p)::Reflow(frame:%p,reason:%d) ---\n",this,aReflowState.frame,aReflowState.reason);
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
nsCOMPtr<nsISVGSVGElement> SVGElement = do_QueryInterface(mContent);
|
2001-12-12 07:59:31 +00:00
|
|
|
NS_ENSURE_TRUE(SVGElement, NS_ERROR_FAILURE);
|
|
|
|
|
|
|
|
float pxPerTwips = GetPxPerTwips();
|
|
|
|
float twipsPerPx = GetTwipsPerPx();
|
|
|
|
|
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
|
|
|
// The width/height attribs given on the <svg>-element might be
|
|
|
|
// percentage values of the parent viewport. We will set the parent
|
2004-08-05 09:01:13 +00:00
|
|
|
// coordinate context dimensions to the available space.
|
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
|
|
|
|
|
|
|
nsRect maxRect, preferredRect;
|
|
|
|
CalculateAvailableSpace(&maxRect, &preferredRect, aPresContext, aReflowState);
|
|
|
|
float preferredWidth = preferredRect.width * pxPerTwips;
|
|
|
|
float preferredHeight = preferredRect.height * pxPerTwips;
|
|
|
|
|
|
|
|
SuspendRedraw();
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
// As soon as we set the coordinate context, the width/height
|
|
|
|
// attributes might emit change-notifications. We don't want those
|
|
|
|
// right now:
|
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
|
|
|
RemoveAsWidthHeightObserver();
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
nsCOMPtr<nsIDOMSVGRect> r;
|
2004-12-05 22:12:43 +00:00
|
|
|
NS_NewSVGRect(getter_AddRefs(r), 0, 0, preferredWidth, preferredHeight);
|
2004-08-05 09:01:13 +00:00
|
|
|
SetCoordCtxRect(r);
|
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
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
// some debug stuff:
|
|
|
|
// {
|
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
|
|
|
// nsRect r=aPresContext->GetVisibleArea();
|
2001-12-12 07:59:31 +00:00
|
|
|
// printf("******* aw: %d, ah: %d visiw: %d, visih: %d\n",
|
|
|
|
// aReflowState.availableWidth,
|
|
|
|
// aReflowState.availableHeight,
|
|
|
|
// r.width, r.height);
|
|
|
|
// printf("******* cw: %d, ch: %d \n cmaxw: %d, cmaxh: %d\n",
|
|
|
|
// aReflowState.mComputedWidth,
|
|
|
|
// aReflowState.mComputedHeight,
|
|
|
|
// aReflowState.mComputedMaxWidth,
|
|
|
|
// aReflowState.mComputedMaxHeight);
|
|
|
|
|
|
|
|
// if (aReflowState.parentReflowState) {
|
|
|
|
// printf("******* parent aw: %d, parent ah: %d \n",
|
|
|
|
// aReflowState.parentReflowState->availableWidth,
|
|
|
|
// aReflowState.parentReflowState->availableHeight);
|
|
|
|
// printf("******* parent cw: %d, parent ch: %d \n parent cmaxw: %d, parent cmaxh: %d\n",
|
|
|
|
// aReflowState.parentReflowState->mComputedWidth,
|
|
|
|
// aReflowState.parentReflowState->mComputedHeight,
|
|
|
|
// aReflowState.parentReflowState->mComputedMaxWidth,
|
|
|
|
// aReflowState.parentReflowState->mComputedMaxHeight);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
#endif
|
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
|
|
|
// now that the parent coord ctx dimensions have been set, the
|
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
|
|
|
// width/height attributes will be valid.
|
|
|
|
// Let's work out our desired dimensions.
|
|
|
|
|
|
|
|
float width;
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMSVGAnimatedLength> animLength;
|
|
|
|
SVGElement->GetWidth(getter_AddRefs(animLength));
|
|
|
|
NS_ENSURE_TRUE(animLength, NS_ERROR_FAILURE);
|
|
|
|
nsCOMPtr<nsIDOMSVGLength> length;
|
|
|
|
animLength->GetAnimVal(getter_AddRefs(length));
|
|
|
|
NS_ENSURE_TRUE(length, NS_ERROR_FAILURE);
|
|
|
|
|
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
|
|
|
length->GetValue(&width);
|
|
|
|
|
|
|
|
aDesiredSize.width = (int)(width*twipsPerPx);
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
float height;
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMSVGAnimatedLength> animLength;
|
|
|
|
SVGElement->GetHeight(getter_AddRefs(animLength));
|
|
|
|
NS_ENSURE_TRUE(animLength, NS_ERROR_FAILURE);
|
|
|
|
nsCOMPtr<nsIDOMSVGLength> length;
|
|
|
|
animLength->GetAnimVal(getter_AddRefs(length));
|
|
|
|
NS_ENSURE_TRUE(length, NS_ERROR_FAILURE);
|
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
|
|
|
|
|
|
|
length->GetValue(&height);
|
|
|
|
|
|
|
|
aDesiredSize.height = (int)(height*twipsPerPx);
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
|
|
|
aDesiredSize.descent = 0;
|
|
|
|
|
|
|
|
// XXX add in CSS borders ??
|
|
|
|
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
2002-05-28 22:50:43 +00:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
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
|
|
|
|
|
|
|
AddAsWidthHeightObserver();
|
|
|
|
|
|
|
|
UnsuspendRedraw();
|
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSVGOuterSVGFrame::DidReflow(nsPresContext* aPresContext,
|
2001-12-12 07:59:31 +00:00
|
|
|
const nsHTMLReflowState* aReflowState,
|
|
|
|
nsDidReflowStatus aStatus)
|
|
|
|
{
|
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
|
|
|
nsresult rv = nsSVGOuterSVGFrameBase::DidReflow(aPresContext,aReflowState,aStatus);
|
|
|
|
|
|
|
|
if (!mViewportInitialized) {
|
|
|
|
// it is now
|
|
|
|
mViewportInitialized = PR_TRUE;
|
|
|
|
|
|
|
|
// call InitialUpdate() on all frames:
|
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
|
|
|
while (kid) {
|
|
|
|
nsISVGChildFrame* SVGFrame=nsnull;
|
|
|
|
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
|
|
|
if (SVGFrame) {
|
|
|
|
SVGFrame->InitialUpdate();
|
|
|
|
}
|
|
|
|
kid = kid->GetNextSibling();
|
|
|
|
}
|
|
|
|
|
|
|
|
UnsuspendRedraw();
|
|
|
|
}
|
2001-12-12 07:59:31 +00:00
|
|
|
|
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 rv;
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// container methods
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 01:58:25 +00:00
|
|
|
nsSVGOuterSVGFrame::AppendFrames(nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
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
|
|
|
// append == insert at end:
|
2005-02-07 01:58:25 +00:00
|
|
|
return InsertFrames(aListName, mFrames.LastChild(), aFrameList);
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 01:58:25 +00:00
|
|
|
nsSVGOuterSVGFrame::InsertFrames(nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
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
|
|
|
// memorize last new frame
|
|
|
|
nsIFrame* lastNewFrame = nsnull;
|
|
|
|
{
|
|
|
|
nsFrameList tmpList(aFrameList);
|
|
|
|
lastNewFrame = tmpList.LastChild();
|
|
|
|
}
|
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
// Insert the new frames
|
|
|
|
mFrames.InsertFrames(this, aPrevFrame, aFrameList);
|
|
|
|
|
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
|
|
|
SuspendRedraw();
|
2001-12-12 07:59:31 +00:00
|
|
|
|
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
|
|
|
// call InitialUpdate() on all new frames:
|
|
|
|
|
|
|
|
nsIFrame* end = nsnull;
|
|
|
|
if (lastNewFrame)
|
|
|
|
end = lastNewFrame->GetNextSibling();
|
2001-12-12 07:59:31 +00:00
|
|
|
|
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
|
|
|
for (nsIFrame* kid = aFrameList; kid != end;
|
2003-07-08 11:00:00 +00:00
|
|
|
kid = kid->GetNextSibling()) {
|
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
|
|
|
nsISVGChildFrame* SVGFrame=nsnull;
|
|
|
|
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
2001-12-12 07:59:31 +00:00
|
|
|
if (SVGFrame) {
|
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
|
|
|
SVGFrame->InitialUpdate();
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
UnsuspendRedraw();
|
2001-12-12 07:59:31 +00:00
|
|
|
|
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;
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 01:58:25 +00:00
|
|
|
nsSVGOuterSVGFrame::RemoveFrame(nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame)
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
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
|
|
|
nsCOMPtr<nsISVGRendererRegion> dirty_region;
|
2001-12-12 07:59:31 +00:00
|
|
|
|
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
|
|
|
nsISVGChildFrame* SVGFrame=nsnull;
|
|
|
|
aOldFrame->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
2001-12-12 07:59:31 +00:00
|
|
|
|
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
|
|
|
if (SVGFrame)
|
|
|
|
dirty_region = SVGFrame->GetCoveredRegion();
|
2001-12-12 07:59:31 +00:00
|
|
|
|
2005-02-07 01:58:25 +00:00
|
|
|
PRBool result = mFrames.DestroyFrame(GetPresContext(), aOldFrame);
|
2001-12-12 07:59:31 +00:00
|
|
|
|
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
|
|
|
nsISVGOuterSVGFrame* outerSVGFrame = GetOuterSVGFrame();
|
|
|
|
NS_ASSERTION(outerSVGFrame, "no outer svg frame");
|
|
|
|
if (dirty_region && outerSVGFrame)
|
|
|
|
outerSVGFrame->InvalidateRegion(dirty_region, PR_TRUE);
|
2001-12-12 07:59:31 +00:00
|
|
|
|
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_ASSERTION(result, "didn't find frame to delete");
|
|
|
|
return result ? NS_OK : NS_ERROR_FAILURE;
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 01:58:25 +00:00
|
|
|
nsSVGOuterSVGFrame::ReplaceFrame(nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame)
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
2005-08-09 13:53:02 +00:00
|
|
|
NS_NOTYETIMPLEMENTED("nsSVGOuterSVGFrame::ReplaceFrame");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-12-31 01:13:27 +00:00
|
|
|
nsSVGOuterSVGFrame::AttributeChanged(nsIContent* aChild,
|
2001-12-12 07:59:31 +00:00
|
|
|
PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
2003-07-11 21:16:12 +00:00
|
|
|
PRInt32 aModType)
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
// {
|
|
|
|
// nsAutoString str;
|
|
|
|
// aAttribute->ToString(str);
|
2003-07-11 21:16:12 +00:00
|
|
|
// printf("** nsSVGOuterSVGFrame::AttributeChanged(%s)\n",
|
|
|
|
// NS_LossyConvertUCS2toASCII(str).get());
|
2001-12-12 07:59:31 +00:00
|
|
|
// }
|
|
|
|
#endif
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
2005-01-01 17:26:29 +00:00
|
|
|
nsSVGOuterSVGFrame::GetFrameForPoint(const nsPoint& aPoint,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
nsIFrame** aFrame)
|
|
|
|
{
|
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 This algorithm is really bad. Because we only have a
|
|
|
|
// singly-linked list we have to test each and every SVG element for
|
|
|
|
// a hit. What we really want is a double-linked list.
|
|
|
|
|
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
*aFrame = nsnull;
|
|
|
|
if (aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND) return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
float x = GetPxPerTwips() * ( aPoint.x - mRect.x);
|
|
|
|
float y = GetPxPerTwips() * ( aPoint.y - mRect.y);
|
|
|
|
|
|
|
|
PRBool inThisFrame = mRect.Contains(aPoint);
|
|
|
|
|
2005-02-18 16:30:12 +00:00
|
|
|
if (!inThisFrame || !mRenderer) {
|
2001-12-12 07:59:31 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aFrame = this;
|
|
|
|
nsIFrame* hit = nsnull;
|
2003-07-08 11:00:00 +00:00
|
|
|
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
|
|
kid = kid->GetNextSibling()) {
|
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
|
|
|
nsISVGChildFrame* SVGFrame=nsnull;
|
|
|
|
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
2001-12-12 07:59:31 +00:00
|
|
|
if (SVGFrame) {
|
2005-04-19 03:48:10 +00:00
|
|
|
nsresult rv = SVGFrame->GetFrameForPointSVG(x, y, &hit);
|
2001-12-12 07:59:31 +00:00
|
|
|
if (NS_SUCCEEDED(rv) && hit) {
|
|
|
|
*aFrame = hit;
|
|
|
|
// return NS_OK; can't return. we need reverse order but only
|
|
|
|
// have a singly linked list...
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// painting
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsSVGOuterSVGFrame::Paint(nsPresContext* aPresContext,
|
2001-12-12 07:59:31 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags)
|
|
|
|
{
|
|
|
|
|
|
|
|
// if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
2003-05-15 03:42:21 +00:00
|
|
|
// if (GetStyleDisplay()->IsVisible() && mRect.width && mRect.height) {
|
2001-12-12 07:59:31 +00:00
|
|
|
// // Paint our background and border
|
2003-05-15 03:42:21 +00:00
|
|
|
// const nsStyleBorder* border = GetStyleBorder();
|
|
|
|
// const nsStylePadding* padding = GetStylePadding();
|
|
|
|
// const nsStyleOutline* outline = GetStyleOutline();
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
// nsRect rect(0, 0, mRect.width, mRect.height);
|
|
|
|
// // nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
2003-02-23 02:49:22 +00:00
|
|
|
// // aDirtyRect, rect, *border, *padding, PR_TRUE);
|
2001-12-12 07:59:31 +00:00
|
|
|
// nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
|
|
|
// aDirtyRect, rect, *border, mStyleContext, 0);
|
|
|
|
// nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
|
|
|
|
// aDirtyRect, rect, *border, *outline, mStyleContext, 0);
|
|
|
|
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (aWhichLayer != NS_FRAME_PAINT_LAYER_FOREGROUND) return NS_OK;
|
|
|
|
if (aDirtyRect.width<=0 || aDirtyRect.height<=0) 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
|
|
|
#if defined(DEBUG) && defined(SVG_DEBUG_PRINTING)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDeviceContext> dx;
|
|
|
|
aRenderingContext.GetDeviceContext(*getter_AddRefs(dx));
|
|
|
|
float zoom,tzoom,scale;
|
|
|
|
dx->GetZoom(zoom);
|
|
|
|
dx->GetTextZoom(tzoom);
|
|
|
|
dx->GetCanonicalPixelScale(scale);
|
|
|
|
printf("nsSVGOuterSVGFrame(%p)::Paint()[ z=%f tz=%f ps=%f\n",this,zoom,tzoom,scale);
|
|
|
|
printf("dirtyrect= %d, %d, %d, %d\n", aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
|
|
|
|
nsTransform2D* xform;
|
|
|
|
aRenderingContext.GetCurrentTransform(xform);
|
|
|
|
printf("translation=(%f,%f)\n", xform->GetXTranslation(), xform->GetYTranslation());
|
|
|
|
float sx=1.0f,sy=1.0f;
|
|
|
|
xform->TransformNoXLate(&sx,&sy);
|
|
|
|
printf("scale=(%f,%f)\n", sx, sy);
|
2004-07-29 19:41:39 +00:00
|
|
|
float twipsPerScPx = aPresContext->ScaledPixelsToTwips();
|
|
|
|
float twipsPerPx = aPresContext->PixelsToTwips();
|
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
|
|
|
printf("tw/sc(px)=%f tw/px=%f\n", twipsPerScPx, twipsPerPx);
|
|
|
|
int fontsc;
|
|
|
|
aPresContext->GetFontScaler(&fontsc);
|
|
|
|
printf("font scale=%d\n",fontsc);
|
|
|
|
printf("]\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// initialize Mozilla rendering context
|
|
|
|
aRenderingContext.PushState();
|
|
|
|
|
2004-04-23 15:21:24 +00:00
|
|
|
aRenderingContext.SetClipRect(aDirtyRect, nsClipCombine_kIntersect);
|
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
|
|
|
|
|
|
|
#if defined(DEBUG) && defined(SVG_DEBUG_PAINT_TIMING)
|
|
|
|
PRTime start = PR_Now();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
float pxPerTwips = GetPxPerTwips();
|
2004-03-23 19:57:01 +00:00
|
|
|
int x0 = (int)(aDirtyRect.x*pxPerTwips);
|
|
|
|
int y0 = (int)(aDirtyRect.y*pxPerTwips);
|
|
|
|
int x1 = (int)ceil((aDirtyRect.x+aDirtyRect.width)*pxPerTwips);
|
|
|
|
int y1 = (int)ceil((aDirtyRect.y+aDirtyRect.height)*pxPerTwips);
|
|
|
|
NS_ASSERTION(x0>=0 && y0>=0, "unexpected negative coordinates");
|
|
|
|
NS_ASSERTION(x1-x0>0 && y1-y0>0, "zero sized dirtyRect");
|
|
|
|
nsRect dirtyRectPx(x0, y0, x1-x0, y1-y0);
|
2005-02-18 16:30:12 +00:00
|
|
|
|
|
|
|
// If we don't have a renderer due to the component failing
|
|
|
|
// to load (gdi+ or cairo not available), indicate to the user
|
|
|
|
// what's going on by drawing a red "X" at the appropriate spot.
|
|
|
|
if (!mRenderer) {
|
|
|
|
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
|
|
|
aRenderingContext.DrawLine(mRect.x, mRect.y,
|
|
|
|
mRect.x + mRect.width, mRect.y + mRect.height);
|
|
|
|
aRenderingContext.DrawLine(mRect.x + mRect.width, mRect.y,
|
|
|
|
mRect.x, mRect.y + mRect.height);
|
|
|
|
aRenderingContext.PopState();
|
|
|
|
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
|
|
|
nsCOMPtr<nsISVGRendererCanvas> canvas;
|
|
|
|
mRenderer->CreateCanvas(&aRenderingContext, aPresContext, dirtyRectPx,
|
|
|
|
getter_AddRefs(canvas));
|
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
// paint children:
|
2003-07-08 11:00:00 +00:00
|
|
|
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
|
|
kid = kid->GetNextSibling()) {
|
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
|
|
|
nsISVGChildFrame* SVGFrame=nsnull;
|
|
|
|
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
2001-12-12 07:59:31 +00:00
|
|
|
if (SVGFrame)
|
2005-09-06 22:30:40 +00:00
|
|
|
SVGFrame->PaintSVG(canvas, aDirtyRect, PR_FALSE);
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
canvas->Flush();
|
|
|
|
|
|
|
|
canvas = nsnull;
|
|
|
|
|
|
|
|
#if defined(DEBUG) && defined(SVG_DEBUG_PAINT_TIMING)
|
|
|
|
PRTime end = PR_Now();
|
|
|
|
printf("SVG Paint Timing: %f ms\n", (end-start)/1000.0);
|
|
|
|
#endif
|
|
|
|
|
2004-04-18 13:13:35 +00:00
|
|
|
aRenderingContext.PopState();
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
// see if we have to draw a selection frame around this container
|
|
|
|
//return nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
|
|
|
}
|
|
|
|
|
2005-04-01 19:56:08 +00:00
|
|
|
nsIAtom *
|
|
|
|
nsSVGOuterSVGFrame::GetType() const
|
|
|
|
{
|
|
|
|
return nsLayoutAtoms::svgOuterSVGFrame;
|
|
|
|
}
|
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGValueObserver methods:
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-01-16 01:44:52 +00:00
|
|
|
nsSVGOuterSVGFrame::WillModifySVGObservable(nsISVGValue* observable,
|
|
|
|
nsISVGValue::modificationType aModType)
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-01-16 01:44:52 +00:00
|
|
|
nsSVGOuterSVGFrame::DidModifySVGObservable(nsISVGValue* observable,
|
|
|
|
nsISVGValue::modificationType aModType)
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
|
|
|
mNeedsReflow = 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
|
|
|
if (mRedrawSuspendCount==0) {
|
2001-12-12 07:59:31 +00:00
|
|
|
InitiateReflow();
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
// nsISVGOuterSVGFrame methods:
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
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
|
|
|
nsSVGOuterSVGFrame::InvalidateRegion(nsISVGRendererRegion* region, PRBool bRedraw)
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
|
|
|
// NS_ASSERTION(mView, "need a view!");
|
|
|
|
// if (!mView) return NS_ERROR_FAILURE;
|
2003-06-19 23:44:01 +00:00
|
|
|
|
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
|
|
|
if (!region && !bRedraw) return NS_OK;
|
|
|
|
|
|
|
|
// just ignore invalidates if painting is suppressed by the shell
|
|
|
|
PRBool suppressed = PR_FALSE;
|
2005-02-08 00:59:52 +00:00
|
|
|
GetPresContext()->PresShell()->IsPaintingSuppressed(&suppressed);
|
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
|
|
|
if (suppressed) return NS_OK;
|
|
|
|
|
2003-07-08 11:00:00 +00:00
|
|
|
nsIView* view = GetClosestView();
|
2001-12-12 07:59:31 +00:00
|
|
|
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
|
|
|
|
|
2003-07-08 11:00:00 +00:00
|
|
|
nsIViewManager* vm = view->GetViewManager();
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
vm->BeginUpdateViewBatch();
|
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
|
|
|
if (region) {
|
|
|
|
nsCOMPtr<nsISVGRectangleSink> sink = CreateVMRectInvalidator(vm, view,
|
|
|
|
(int)(GetTwipsPerPx()+0.5f));
|
|
|
|
NS_ASSERTION(sink, "could not create rectangle sink for viewmanager");
|
|
|
|
if (sink)
|
|
|
|
region->GetRectangleScans(sink);
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
2004-10-11 15:34:45 +00:00
|
|
|
vm->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
|
2001-12-12 07:59:31 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGOuterSVGFrame::IsRedrawSuspended(PRBool* isSuspended)
|
|
|
|
{
|
|
|
|
*isSuspended = (mRedrawSuspendCount>0) || !mViewportInitialized;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGOuterSVGFrame::GetRenderer(nsISVGRenderer**renderer)
|
|
|
|
{
|
|
|
|
*renderer = mRenderer;
|
|
|
|
NS_IF_ADDREF(*renderer);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGSVGFrame methods:
|
|
|
|
|
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
NS_IMETHODIMP
|
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
|
|
|
nsSVGOuterSVGFrame::SuspendRedraw()
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
2005-02-18 16:30:12 +00:00
|
|
|
if (!mRenderer)
|
|
|
|
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
|
|
|
#ifdef DEBUG
|
|
|
|
//printf("suspend redraw (count=%d)\n", mRedrawSuspendCount);
|
|
|
|
#endif
|
|
|
|
if (++mRedrawSuspendCount != 1)
|
|
|
|
return NS_OK;
|
2001-12-12 07:59:31 +00:00
|
|
|
|
2003-07-08 11:00:00 +00:00
|
|
|
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
|
|
kid = kid->GetNextSibling()) {
|
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
|
|
|
nsISVGChildFrame* SVGFrame=nsnull;
|
2005-08-24 01:03:42 +00:00
|
|
|
CallQueryInterface(kid, &SVGFrame);
|
2001-12-12 07:59:31 +00:00
|
|
|
if (SVGFrame) {
|
|
|
|
SVGFrame->NotifyRedrawSuspended();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
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
|
|
|
nsSVGOuterSVGFrame::UnsuspendRedraw()
|
2001-12-12 07:59:31 +00:00
|
|
|
{
|
2005-02-18 16:30:12 +00:00
|
|
|
if (!mRenderer)
|
|
|
|
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
|
|
|
#ifdef DEBUG
|
|
|
|
// printf("unsuspend redraw (count=%d)\n", mRedrawSuspendCount);
|
|
|
|
#endif
|
|
|
|
if (--mRedrawSuspendCount > 0)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
NS_ASSERTION(mRedrawSuspendCount >=0, "unbalanced suspend count!");
|
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
// If we need to reflow, do so before we update any of our
|
|
|
|
// children. Reflows are likely to affect the display of children:
|
|
|
|
if (mNeedsReflow)
|
|
|
|
InitiateReflow();
|
|
|
|
|
2003-07-08 11:00:00 +00:00
|
|
|
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
|
|
|
kid = kid->GetNextSibling()) {
|
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
|
|
|
nsISVGChildFrame* SVGFrame=nsnull;
|
2005-08-24 01:03:42 +00:00
|
|
|
CallQueryInterface(kid, &SVGFrame);
|
2001-12-12 07:59:31 +00:00
|
|
|
if (SVGFrame) {
|
|
|
|
SVGFrame->NotifyRedrawUnsuspended();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSVGOuterSVGFrame::NotifyViewportChange()
|
|
|
|
{
|
2005-02-18 16:30:12 +00:00
|
|
|
if (!mRenderer)
|
|
|
|
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
|
|
|
// no point in doing anything when were not init'ed yet:
|
|
|
|
if (!mViewportInitialized) return NS_OK;
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
// make sure canvas transform matrix gets (lazily) recalculated:
|
|
|
|
mCanvasTM = nsnull;
|
|
|
|
|
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
|
|
|
// inform children
|
|
|
|
SuspendRedraw();
|
|
|
|
nsIFrame* kid = mFrames.FirstChild();
|
|
|
|
while (kid) {
|
|
|
|
nsISVGChildFrame* SVGFrame=nsnull;
|
|
|
|
kid->QueryInterface(NS_GET_IID(nsISVGChildFrame),(void**)&SVGFrame);
|
|
|
|
if (SVGFrame)
|
2005-09-06 22:30:40 +00:00
|
|
|
SVGFrame->NotifyCanvasTMChanged(PR_FALSE);
|
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
|
|
|
kid = kid->GetNextSibling();
|
|
|
|
}
|
|
|
|
UnsuspendRedraw();
|
2001-12-12 07:59:31 +00:00
|
|
|
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
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISVGContainerFrame methods:
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
nsISVGOuterSVGFrame *
|
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
|
|
|
nsSVGOuterSVGFrame::GetOuterSVGFrame()
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2004-08-05 09:01:13 +00:00
|
|
|
already_AddRefed<nsIDOMSVGMatrix>
|
|
|
|
nsSVGOuterSVGFrame::GetCanvasTM()
|
|
|
|
{
|
|
|
|
if (!mCanvasTM) {
|
|
|
|
nsCOMPtr<nsIDOMSVGSVGElement> svgElement = do_QueryInterface(mContent);
|
|
|
|
NS_ASSERTION(svgElement, "wrong content element");
|
|
|
|
svgElement->GetViewboxToViewportTransform(getter_AddRefs(mCanvasTM));
|
2004-12-02 23:13:13 +00:00
|
|
|
|
2005-08-25 21:31:09 +00:00
|
|
|
if (mZoomAndPan) {
|
|
|
|
// our content is the document element so we must premultiply the values
|
|
|
|
// of it's currentScale and currentTranslate properties
|
|
|
|
PRUint16 val;
|
|
|
|
mZoomAndPan->GetIntegerValue(val);
|
|
|
|
if (val == nsIDOMSVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY) {
|
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> zoomPanMatrix;
|
|
|
|
nsCOMPtr<nsIDOMSVGMatrix> temp;
|
|
|
|
float scale, x, y;
|
|
|
|
mCurrentScale->GetValue(&scale);
|
|
|
|
mCurrentTranslate->GetX(&x);
|
|
|
|
mCurrentTranslate->GetY(&y);
|
|
|
|
svgElement->CreateSVGMatrix(getter_AddRefs(zoomPanMatrix));
|
|
|
|
zoomPanMatrix->Translate(x, y, getter_AddRefs(temp));
|
|
|
|
temp->Scale(scale, getter_AddRefs(zoomPanMatrix));
|
|
|
|
zoomPanMatrix->Multiply(mCanvasTM, getter_AddRefs(temp));
|
|
|
|
temp.swap(mCanvasTM);
|
|
|
|
}
|
2004-12-02 23:13:13 +00:00
|
|
|
}
|
2004-08-05 09:01:13 +00:00
|
|
|
}
|
|
|
|
nsIDOMSVGMatrix* retval = mCanvasTM.get();
|
|
|
|
NS_IF_ADDREF(retval);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<nsSVGCoordCtxProvider>
|
|
|
|
nsSVGOuterSVGFrame::GetCoordContextProvider()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mContent, "null parent");
|
|
|
|
|
|
|
|
// Our <svg> content element is the CoordContextProvider for our children:
|
|
|
|
nsSVGCoordCtxProvider *provider;
|
2005-08-24 00:05:39 +00:00
|
|
|
CallQueryInterface(mContent, &provider);
|
2004-08-05 09:01:13 +00:00
|
|
|
|
|
|
|
return provider;
|
|
|
|
}
|
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
|
|
|
|
2001-12-12 07:59:31 +00:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Implementation helpers
|
|
|
|
|
|
|
|
float nsSVGOuterSVGFrame::GetPxPerTwips()
|
|
|
|
{
|
|
|
|
float val = GetTwipsPerPx();
|
|
|
|
|
|
|
|
NS_ASSERTION(val!=0.0f, "invalid px/twips");
|
|
|
|
if (val == 0.0) val = 1e-20f;
|
|
|
|
|
|
|
|
return 1.0f/val;
|
|
|
|
}
|
|
|
|
|
|
|
|
float nsSVGOuterSVGFrame::GetTwipsPerPx()
|
|
|
|
{
|
2004-07-29 19:41:39 +00:00
|
|
|
return GetPresContext()->ScaledPixelsToTwips();
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsSVGOuterSVGFrame::InitiateReflow()
|
|
|
|
{
|
|
|
|
mNeedsReflow = PR_FALSE;
|
|
|
|
|
|
|
|
// Generate a reflow command to reflow ourselves
|
2005-02-08 00:59:52 +00:00
|
|
|
nsIPresShell* presShell = GetPresContext()->PresShell();
|
|
|
|
presShell->AppendReflowCommand(this, eReflowType_ReflowDirty, nsnull);
|
2004-05-27 22:08:42 +00:00
|
|
|
// XXXbz why is this synchronously flushing reflows, exactly? If it
|
|
|
|
// needs to, why is it not using the presshell's reflow batching
|
|
|
|
// instead of hacking its own?
|
2005-02-08 00:59:52 +00:00
|
|
|
presShell->FlushPendingNotifications(Flush_OnlyReflow);
|
2001-12-12 07:59:31 +00:00
|
|
|
}
|
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
|
|
|
|
|
|
|
|
|
|
|
void nsSVGOuterSVGFrame::AddAsWidthHeightObserver()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMSVGSVGElement> svgElement = do_QueryInterface(mContent);
|
|
|
|
NS_ASSERTION(svgElement, "wrong content element");
|
|
|
|
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMSVGAnimatedLength> animLength;
|
|
|
|
svgElement->GetWidth(getter_AddRefs(animLength));
|
|
|
|
NS_ASSERTION(animLength, "could not get <svg>:width");
|
|
|
|
nsCOMPtr<nsIDOMSVGLength> length;
|
|
|
|
animLength->GetAnimVal(getter_AddRefs(length));
|
|
|
|
NS_ASSERTION(length, "could not get <svg>:width:animval");
|
|
|
|
NS_ADD_SVGVALUE_OBSERVER(length);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMSVGAnimatedLength> animLength;
|
|
|
|
svgElement->GetHeight(getter_AddRefs(animLength));
|
|
|
|
NS_ASSERTION(animLength, "could not get <svg>:height");
|
|
|
|
nsCOMPtr<nsIDOMSVGLength> length;
|
|
|
|
animLength->GetAnimVal(getter_AddRefs(length));
|
|
|
|
NS_ASSERTION(length, "could not get <svg>:height:animval");
|
|
|
|
NS_ADD_SVGVALUE_OBSERVER(length);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsSVGOuterSVGFrame::RemoveAsWidthHeightObserver()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMSVGSVGElement> svgElement = do_QueryInterface(mContent);
|
|
|
|
NS_ASSERTION(svgElement, "wrong content element");
|
|
|
|
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMSVGAnimatedLength> animLength;
|
|
|
|
svgElement->GetWidth(getter_AddRefs(animLength));
|
|
|
|
NS_ASSERTION(animLength, "could not get <svg>:width");
|
|
|
|
nsCOMPtr<nsIDOMSVGLength> length;
|
|
|
|
animLength->GetAnimVal(getter_AddRefs(length));
|
|
|
|
NS_ASSERTION(length, "could not get <svg>:width:animval");
|
|
|
|
NS_REMOVE_SVGVALUE_OBSERVER(length);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMSVGAnimatedLength> animLength;
|
|
|
|
svgElement->GetHeight(getter_AddRefs(animLength));
|
|
|
|
NS_ASSERTION(animLength, "could not get <svg>:height");
|
|
|
|
nsCOMPtr<nsIDOMSVGLength> length;
|
|
|
|
animLength->GetAnimVal(getter_AddRefs(length));
|
|
|
|
NS_ASSERTION(length, "could not get <svg>:height:animval");
|
|
|
|
NS_REMOVE_SVGVALUE_OBSERVER(length);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsSVGOuterSVGFrame::CalculateAvailableSpace(nsRect *maxRect,
|
|
|
|
nsRect *preferredRect,
|
2004-07-31 23:15:21 +00:00
|
|
|
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
|
|
|
const nsHTMLReflowState& aReflowState)
|
|
|
|
{
|
|
|
|
*preferredRect = aPresContext->GetVisibleArea();
|
|
|
|
|
|
|
|
if (aReflowState.availableWidth != NS_INTRINSICSIZE)
|
|
|
|
maxRect->width = aReflowState.availableWidth;
|
|
|
|
else if (aReflowState.parentReflowState &&
|
|
|
|
aReflowState.parentReflowState->mComputedWidth != NS_INTRINSICSIZE)
|
|
|
|
maxRect->width = aReflowState.parentReflowState->mComputedWidth;
|
|
|
|
else
|
|
|
|
maxRect->width = NS_MAXSIZE;
|
|
|
|
|
|
|
|
if (aReflowState.availableHeight != NS_INTRINSICSIZE)
|
|
|
|
maxRect->height = aReflowState.availableHeight;
|
|
|
|
else if (aReflowState.parentReflowState &&
|
|
|
|
aReflowState.parentReflowState->mComputedHeight != NS_INTRINSICSIZE)
|
|
|
|
maxRect->height = aReflowState.parentReflowState->mComputedHeight;
|
|
|
|
else
|
|
|
|
maxRect->height = NS_MAXSIZE;
|
|
|
|
|
|
|
|
if (preferredRect->width > maxRect->width)
|
|
|
|
preferredRect->width = maxRect->width;
|
|
|
|
if (preferredRect->height > maxRect->height)
|
|
|
|
preferredRect->height = maxRect->height;
|
|
|
|
}
|