michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* rendering object for the HTML element */ michael@0: michael@0: #ifndef nsHTMLCanvasFrame_h___ michael@0: #define nsHTMLCanvasFrame_h___ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsContainerFrame.h" michael@0: #include "FrameLayerBuilder.h" michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: class Layer; michael@0: class LayerManager; michael@0: } michael@0: } michael@0: michael@0: class nsPresContext; michael@0: class nsDisplayItem; michael@0: class nsAString; michael@0: michael@0: nsIFrame* NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell, nsStyleContext* aContext); michael@0: michael@0: class nsHTMLCanvasFrame : public nsContainerFrame michael@0: { michael@0: public: michael@0: typedef mozilla::layers::Layer Layer; michael@0: typedef mozilla::layers::LayerManager LayerManager; michael@0: typedef mozilla::ContainerLayerParameters ContainerLayerParameters; michael@0: michael@0: NS_DECL_QUERYFRAME_TARGET(nsHTMLCanvasFrame) michael@0: NS_DECL_QUERYFRAME michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: nsHTMLCanvasFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {} michael@0: michael@0: virtual void Init(nsIContent* aContent, michael@0: nsIFrame* aParent, michael@0: nsIFrame* aPrevInFlow) MOZ_OVERRIDE; michael@0: michael@0: virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, michael@0: const nsRect& aDirtyRect, michael@0: const nsDisplayListSet& aLists) MOZ_OVERRIDE; michael@0: michael@0: already_AddRefed BuildLayer(nsDisplayListBuilder* aBuilder, michael@0: LayerManager* aManager, michael@0: nsDisplayItem* aItem, michael@0: const ContainerLayerParameters& aContainerParameters); michael@0: michael@0: /* get the size of the canvas's image */ michael@0: nsIntSize GetCanvasSize(); michael@0: michael@0: virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; michael@0: virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; michael@0: virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE; michael@0: michael@0: virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext, michael@0: nsSize aCBSize, nscoord aAvailableWidth, michael@0: nsSize aMargin, nsSize aBorder, nsSize aPadding, michael@0: uint32_t aFlags) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult Reflow(nsPresContext* aPresContext, michael@0: nsHTMLReflowMetrics& aDesiredSize, michael@0: const nsHTMLReflowState& aReflowState, michael@0: nsReflowStatus& aStatus) MOZ_OVERRIDE; michael@0: michael@0: nsRect GetInnerArea() const; michael@0: michael@0: #ifdef ACCESSIBILITY michael@0: virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE; michael@0: #endif michael@0: michael@0: virtual nsIAtom* GetType() const MOZ_OVERRIDE; michael@0: michael@0: virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE michael@0: { michael@0: return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced)); michael@0: } michael@0: michael@0: #ifdef DEBUG_FRAME_DUMP michael@0: virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; michael@0: #endif michael@0: michael@0: // Inserted child content gets its frames parented by our child block michael@0: virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE { michael@0: return GetFirstPrincipalChild()->GetContentInsertionFrame(); michael@0: } michael@0: michael@0: protected: michael@0: virtual ~nsHTMLCanvasFrame(); michael@0: michael@0: nscoord GetContinuationOffset(nscoord* aWidth = 0) const; michael@0: michael@0: nsMargin mBorderPadding; michael@0: }; michael@0: michael@0: #endif /* nsHTMLCanvasFrame_h___ */