Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef NSSVGFOREIGNOBJECTFRAME_H__ |
michael@0 | 7 | #define NSSVGFOREIGNOBJECTFRAME_H__ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/Attributes.h" |
michael@0 | 10 | #include "nsContainerFrame.h" |
michael@0 | 11 | #include "nsIPresShell.h" |
michael@0 | 12 | #include "nsISVGChildFrame.h" |
michael@0 | 13 | #include "nsRegion.h" |
michael@0 | 14 | #include "nsSVGUtils.h" |
michael@0 | 15 | |
michael@0 | 16 | class nsRenderingContext; |
michael@0 | 17 | class nsSVGOuterSVGFrame; |
michael@0 | 18 | |
michael@0 | 19 | typedef nsContainerFrame nsSVGForeignObjectFrameBase; |
michael@0 | 20 | |
michael@0 | 21 | class nsSVGForeignObjectFrame : public nsSVGForeignObjectFrameBase, |
michael@0 | 22 | public nsISVGChildFrame |
michael@0 | 23 | { |
michael@0 | 24 | friend nsIFrame* |
michael@0 | 25 | NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
michael@0 | 26 | protected: |
michael@0 | 27 | nsSVGForeignObjectFrame(nsStyleContext* aContext); |
michael@0 | 28 | |
michael@0 | 29 | public: |
michael@0 | 30 | NS_DECL_QUERYFRAME |
michael@0 | 31 | NS_DECL_FRAMEARENA_HELPERS |
michael@0 | 32 | |
michael@0 | 33 | // nsIFrame: |
michael@0 | 34 | virtual void Init(nsIContent* aContent, |
michael@0 | 35 | nsIFrame* aParent, |
michael@0 | 36 | nsIFrame* aPrevInFlow) MOZ_OVERRIDE; |
michael@0 | 37 | virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; |
michael@0 | 38 | virtual nsresult AttributeChanged(int32_t aNameSpaceID, |
michael@0 | 39 | nsIAtom* aAttribute, |
michael@0 | 40 | int32_t aModType) MOZ_OVERRIDE; |
michael@0 | 41 | |
michael@0 | 42 | virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE { |
michael@0 | 43 | return GetFirstPrincipalChild()->GetContentInsertionFrame(); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | virtual nsresult Reflow(nsPresContext* aPresContext, |
michael@0 | 47 | nsHTMLReflowMetrics& aDesiredSize, |
michael@0 | 48 | const nsHTMLReflowState& aReflowState, |
michael@0 | 49 | nsReflowStatus& aStatus) MOZ_OVERRIDE; |
michael@0 | 50 | |
michael@0 | 51 | virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, |
michael@0 | 52 | const nsRect& aDirtyRect, |
michael@0 | 53 | const nsDisplayListSet& aLists) MOZ_OVERRIDE; |
michael@0 | 54 | |
michael@0 | 55 | /** |
michael@0 | 56 | * Get the "type" of the frame |
michael@0 | 57 | * |
michael@0 | 58 | * @see nsGkAtoms::svgForeignObjectFrame |
michael@0 | 59 | */ |
michael@0 | 60 | virtual nsIAtom* GetType() const MOZ_OVERRIDE; |
michael@0 | 61 | |
michael@0 | 62 | virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE |
michael@0 | 63 | { |
michael@0 | 64 | return nsSVGForeignObjectFrameBase::IsFrameOfType(aFlags & |
michael@0 | 65 | ~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject)); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | virtual bool IsSVGTransformed(Matrix *aOwnTransform, |
michael@0 | 69 | Matrix *aFromParentTransform) const MOZ_OVERRIDE; |
michael@0 | 70 | |
michael@0 | 71 | #ifdef DEBUG_FRAME_DUMP |
michael@0 | 72 | virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE |
michael@0 | 73 | { |
michael@0 | 74 | return MakeFrameName(NS_LITERAL_STRING("SVGForeignObject"), aResult); |
michael@0 | 75 | } |
michael@0 | 76 | #endif |
michael@0 | 77 | |
michael@0 | 78 | // nsISVGChildFrame interface: |
michael@0 | 79 | virtual nsresult PaintSVG(nsRenderingContext *aContext, |
michael@0 | 80 | const nsIntRect *aDirtyRect, |
michael@0 | 81 | nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE; |
michael@0 | 82 | virtual nsIFrame* GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE; |
michael@0 | 83 | virtual nsRect GetCoveredRegion() MOZ_OVERRIDE; |
michael@0 | 84 | virtual void ReflowSVG() MOZ_OVERRIDE; |
michael@0 | 85 | virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE; |
michael@0 | 86 | virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace, |
michael@0 | 87 | uint32_t aFlags) MOZ_OVERRIDE; |
michael@0 | 88 | virtual bool IsDisplayContainer() MOZ_OVERRIDE { return true; } |
michael@0 | 89 | |
michael@0 | 90 | gfxMatrix GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot = nullptr); |
michael@0 | 91 | |
michael@0 | 92 | nsRect GetInvalidRegion(); |
michael@0 | 93 | |
michael@0 | 94 | protected: |
michael@0 | 95 | // implementation helpers: |
michael@0 | 96 | void DoReflow(); |
michael@0 | 97 | void RequestReflow(nsIPresShell::IntrinsicDirty aType); |
michael@0 | 98 | |
michael@0 | 99 | // If width or height is less than or equal to zero we must disable rendering |
michael@0 | 100 | bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; } |
michael@0 | 101 | |
michael@0 | 102 | nsAutoPtr<gfxMatrix> mCanvasTM; |
michael@0 | 103 | |
michael@0 | 104 | bool mInReflow; |
michael@0 | 105 | }; |
michael@0 | 106 | |
michael@0 | 107 | #endif |