2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is the Mozilla SVG project.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Crocodile Clips Ltd..
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef __NS_SVGOUTERSVGFRAME_H__
|
|
|
|
#define __NS_SVGOUTERSVGFRAME_H__
|
|
|
|
|
2009-04-28 21:31:34 -07:00
|
|
|
#include "gfxMatrix.h"
|
2012-03-20 05:15:55 -07:00
|
|
|
#include "nsISVGSVGFrame.h"
|
|
|
|
#include "nsSVGContainerFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsSVGOuterSVGFrame class
|
|
|
|
|
|
|
|
typedef nsSVGDisplayContainerFrame nsSVGOuterSVGFrameBase;
|
|
|
|
|
|
|
|
class nsSVGOuterSVGFrame : public nsSVGOuterSVGFrameBase,
|
|
|
|
public nsISVGSVGFrame
|
|
|
|
{
|
|
|
|
friend nsIFrame*
|
2009-01-19 10:31:34 -08:00
|
|
|
NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
nsSVGOuterSVGFrame(nsStyleContext* aContext);
|
|
|
|
|
|
|
|
public:
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2007-11-20 01:10:18 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIFrame:
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
2007-11-18 04:09:03 -08:00
|
|
|
|
|
|
|
virtual IntrinsicSize GetIntrinsicSize();
|
|
|
|
virtual nsSize GetIntrinsicRatio();
|
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
2007-11-18 04:09:03 -08:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
2012-03-16 11:01:05 -07:00
|
|
|
PRUint32 aFlags) MOZ_OVERRIDE;
|
2007-06-12 11:27:09 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
|
|
|
NS_IMETHOD DidReflow(nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState* aReflowState,
|
|
|
|
nsDidReflowStatus aStatus);
|
|
|
|
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
2007-08-30 10:01:37 -07:00
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
|
2008-02-22 02:50:32 -08:00
|
|
|
virtual nsSplittableType GetSplittableType() const;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::svgOuterSVGFrame
|
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
2010-10-14 18:03:45 -07:00
|
|
|
void Paint(const nsDisplayListBuilder* aBuilder,
|
2012-03-02 00:28:59 -08:00
|
|
|
nsRenderingContext* aContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsRect& aDirtyRect, nsPoint aPt);
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGOuterSVG"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aModType);
|
|
|
|
|
2012-05-16 21:05:09 -07:00
|
|
|
virtual bool IsSVGTransformed(gfxMatrix *aOwnTransform,
|
|
|
|
gfxMatrix *aFromParentTransform) const {
|
|
|
|
// Outer-<svg> can transform its children with viewBox, currentScale and
|
|
|
|
// currentTranslate, but it itself is not transformed by SVG transforms.
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsISVGSVGFrame interface:
|
2012-05-03 09:05:53 -07:00
|
|
|
virtual void NotifyViewportOrTransformChanged(PRUint32 aFlags);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsSVGContainerFrame methods:
|
2009-04-28 21:31:34 -07:00
|
|
|
virtual gfxMatrix GetCanvasTM();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-16 21:05:09 -07:00
|
|
|
virtual bool HasChildrenOnlyTransform(gfxMatrix *aTransform) const;
|
|
|
|
|
2012-03-02 15:38:36 -08:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
bool BitmapFallbackEnabled() const {
|
|
|
|
return mEnableBitmapFallback;
|
|
|
|
}
|
|
|
|
void SetBitmapFallbackEnabled(bool aVal) {
|
|
|
|
NS_NOTREACHED("don't think me need this any more"); // comment in bug 732429 if we do
|
|
|
|
mEnableBitmapFallback = aVal;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-03-19 01:34:19 -07:00
|
|
|
/**
|
|
|
|
* Return true only if the height is unspecified (defaulting to 100%) or else
|
|
|
|
* the height is explicitly set to a percentage value no greater than 100%.
|
|
|
|
*/
|
|
|
|
bool VerticalScrollbarNotNeeded() const;
|
|
|
|
|
2012-03-20 05:15:53 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
bool IsCallingUpdateBounds() const {
|
|
|
|
return mCallingUpdateBounds;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
2012-03-20 05:15:53 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
bool mCallingUpdateBounds;
|
|
|
|
#endif
|
|
|
|
|
2007-11-18 04:09:03 -08:00
|
|
|
/* Returns true if our content is the document element and our document is
|
|
|
|
* embedded in an HTML 'object', 'embed' or 'applet' element. Set
|
|
|
|
* aEmbeddingFrame to obtain the nsIFrame for the embedding HTML element.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsRootOfReplacedElementSubDoc(nsIFrame **aEmbeddingFrame = nsnull);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-09-08 13:40:39 -07:00
|
|
|
/* Returns true if our content is the document element and our document is
|
|
|
|
* being used as an image.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsRootOfImage();
|
2010-09-08 13:40:39 -07:00
|
|
|
|
2011-09-25 14:04:32 -07:00
|
|
|
nsAutoPtr<gfxMatrix> mCanvasTM;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-12-03 20:40:52 -08:00
|
|
|
float mFullZoom;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mViewportInitialized;
|
2008-01-09 14:53:59 -08:00
|
|
|
#ifdef XP_MACOSX
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mEnableBitmapFallback;
|
2008-01-09 14:53:59 -08:00
|
|
|
#endif
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsRootContent;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|