1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/svg/nsSVGForeignObjectFrame.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,107 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef NSSVGFOREIGNOBJECTFRAME_H__ 1.10 +#define NSSVGFOREIGNOBJECTFRAME_H__ 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 +#include "nsContainerFrame.h" 1.14 +#include "nsIPresShell.h" 1.15 +#include "nsISVGChildFrame.h" 1.16 +#include "nsRegion.h" 1.17 +#include "nsSVGUtils.h" 1.18 + 1.19 +class nsRenderingContext; 1.20 +class nsSVGOuterSVGFrame; 1.21 + 1.22 +typedef nsContainerFrame nsSVGForeignObjectFrameBase; 1.23 + 1.24 +class nsSVGForeignObjectFrame : public nsSVGForeignObjectFrameBase, 1.25 + public nsISVGChildFrame 1.26 +{ 1.27 + friend nsIFrame* 1.28 + NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); 1.29 +protected: 1.30 + nsSVGForeignObjectFrame(nsStyleContext* aContext); 1.31 + 1.32 +public: 1.33 + NS_DECL_QUERYFRAME 1.34 + NS_DECL_FRAMEARENA_HELPERS 1.35 + 1.36 + // nsIFrame: 1.37 + virtual void Init(nsIContent* aContent, 1.38 + nsIFrame* aParent, 1.39 + nsIFrame* aPrevInFlow) MOZ_OVERRIDE; 1.40 + virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; 1.41 + virtual nsresult AttributeChanged(int32_t aNameSpaceID, 1.42 + nsIAtom* aAttribute, 1.43 + int32_t aModType) MOZ_OVERRIDE; 1.44 + 1.45 + virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE { 1.46 + return GetFirstPrincipalChild()->GetContentInsertionFrame(); 1.47 + } 1.48 + 1.49 + virtual nsresult Reflow(nsPresContext* aPresContext, 1.50 + nsHTMLReflowMetrics& aDesiredSize, 1.51 + const nsHTMLReflowState& aReflowState, 1.52 + nsReflowStatus& aStatus) MOZ_OVERRIDE; 1.53 + 1.54 + virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, 1.55 + const nsRect& aDirtyRect, 1.56 + const nsDisplayListSet& aLists) MOZ_OVERRIDE; 1.57 + 1.58 + /** 1.59 + * Get the "type" of the frame 1.60 + * 1.61 + * @see nsGkAtoms::svgForeignObjectFrame 1.62 + */ 1.63 + virtual nsIAtom* GetType() const MOZ_OVERRIDE; 1.64 + 1.65 + virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE 1.66 + { 1.67 + return nsSVGForeignObjectFrameBase::IsFrameOfType(aFlags & 1.68 + ~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject)); 1.69 + } 1.70 + 1.71 + virtual bool IsSVGTransformed(Matrix *aOwnTransform, 1.72 + Matrix *aFromParentTransform) const MOZ_OVERRIDE; 1.73 + 1.74 +#ifdef DEBUG_FRAME_DUMP 1.75 + virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE 1.76 + { 1.77 + return MakeFrameName(NS_LITERAL_STRING("SVGForeignObject"), aResult); 1.78 + } 1.79 +#endif 1.80 + 1.81 + // nsISVGChildFrame interface: 1.82 + virtual nsresult PaintSVG(nsRenderingContext *aContext, 1.83 + const nsIntRect *aDirtyRect, 1.84 + nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE; 1.85 + virtual nsIFrame* GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE; 1.86 + virtual nsRect GetCoveredRegion() MOZ_OVERRIDE; 1.87 + virtual void ReflowSVG() MOZ_OVERRIDE; 1.88 + virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE; 1.89 + virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace, 1.90 + uint32_t aFlags) MOZ_OVERRIDE; 1.91 + virtual bool IsDisplayContainer() MOZ_OVERRIDE { return true; } 1.92 + 1.93 + gfxMatrix GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot = nullptr); 1.94 + 1.95 + nsRect GetInvalidRegion(); 1.96 + 1.97 +protected: 1.98 + // implementation helpers: 1.99 + void DoReflow(); 1.100 + void RequestReflow(nsIPresShell::IntrinsicDirty aType); 1.101 + 1.102 + // If width or height is less than or equal to zero we must disable rendering 1.103 + bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; } 1.104 + 1.105 + nsAutoPtr<gfxMatrix> mCanvasTM; 1.106 + 1.107 + bool mInReflow; 1.108 +}; 1.109 + 1.110 +#endif