Bumping manifests a=b2g-bump
[gecko.git] / layout / generic / nsHTMLCanvasFrame.h
blob4351f53effb6550cc16e5e91f043a894a2bac50e
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* rendering object for the HTML <canvas> element */
8 #ifndef nsHTMLCanvasFrame_h___
9 #define nsHTMLCanvasFrame_h___
11 #include "mozilla/Attributes.h"
12 #include "nsContainerFrame.h"
13 #include "FrameLayerBuilder.h"
15 namespace mozilla {
16 namespace layers {
17 class Layer;
18 class LayerManager;
22 class nsPresContext;
23 class nsDisplayItem;
24 class nsAString;
26 nsIFrame* NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
28 class nsHTMLCanvasFrame : public nsContainerFrame
30 public:
31 typedef mozilla::layers::Layer Layer;
32 typedef mozilla::layers::LayerManager LayerManager;
33 typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
35 NS_DECL_QUERYFRAME_TARGET(nsHTMLCanvasFrame)
36 NS_DECL_QUERYFRAME
37 NS_DECL_FRAMEARENA_HELPERS
39 explicit nsHTMLCanvasFrame(nsStyleContext* aContext)
40 : nsContainerFrame(aContext)
41 , mBorderPadding(GetWritingMode()) {}
43 virtual void Init(nsIContent* aContent,
44 nsContainerFrame* aParent,
45 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
47 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
48 const nsRect& aDirtyRect,
49 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
51 already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
52 LayerManager* aManager,
53 nsDisplayItem* aItem,
54 const ContainerLayerParameters& aContainerParameters);
56 /* get the size of the canvas's image */
57 nsIntSize GetCanvasSize();
59 virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
60 virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
61 virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE;
63 virtual mozilla::LogicalSize
64 ComputeSize(nsRenderingContext *aRenderingContext,
65 mozilla::WritingMode aWritingMode,
66 const mozilla::LogicalSize& aCBSize,
67 nscoord aAvailableISize,
68 const mozilla::LogicalSize& aMargin,
69 const mozilla::LogicalSize& aBorder,
70 const mozilla::LogicalSize& aPadding,
71 uint32_t aFlags) MOZ_OVERRIDE;
73 virtual void Reflow(nsPresContext* aPresContext,
74 nsHTMLReflowMetrics& aDesiredSize,
75 const nsHTMLReflowState& aReflowState,
76 nsReflowStatus& aStatus) MOZ_OVERRIDE;
78 nsRect GetInnerArea() const;
80 #ifdef ACCESSIBILITY
81 virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
82 #endif
84 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
86 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
88 return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
91 #ifdef DEBUG_FRAME_DUMP
92 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
93 #endif
95 // Inserted child content gets its frames parented by our child block
96 virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
97 return GetFirstPrincipalChild()->GetContentInsertionFrame();
100 protected:
101 virtual ~nsHTMLCanvasFrame();
103 nscoord GetContinuationOffset(nscoord* aWidth = 0) const;
105 mozilla::LogicalMargin mBorderPadding;
108 #endif /* nsHTMLCanvasFrame_h___ */