Bumping manifests a=b2g-bump
[gecko.git] / layout / generic / nsHTMLCanvasFrame.h
blob0067efe3d2de8d92e797ebc9c41a5fde7b8a38c5
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 mozilla::IntrinsicSize GetIntrinsicSize() MOZ_OVERRIDE;
62 virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE;
64 virtual mozilla::LogicalSize
65 ComputeSize(nsRenderingContext *aRenderingContext,
66 mozilla::WritingMode aWritingMode,
67 const mozilla::LogicalSize& aCBSize,
68 nscoord aAvailableISize,
69 const mozilla::LogicalSize& aMargin,
70 const mozilla::LogicalSize& aBorder,
71 const mozilla::LogicalSize& aPadding,
72 ComputeSizeFlags aFlags) MOZ_OVERRIDE;
74 virtual void Reflow(nsPresContext* aPresContext,
75 nsHTMLReflowMetrics& aDesiredSize,
76 const nsHTMLReflowState& aReflowState,
77 nsReflowStatus& aStatus) MOZ_OVERRIDE;
79 nsRect GetInnerArea() const;
81 #ifdef ACCESSIBILITY
82 virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
83 #endif
85 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
87 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
89 return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
92 #ifdef DEBUG_FRAME_DUMP
93 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
94 #endif
96 // Inserted child content gets its frames parented by our child block
97 virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
98 return GetFirstPrincipalChild()->GetContentInsertionFrame();
101 protected:
102 virtual ~nsHTMLCanvasFrame();
104 nscoord GetContinuationOffset(nscoord* aWidth = 0) const;
106 mozilla::LogicalMargin mBorderPadding;
109 #endif /* nsHTMLCanvasFrame_h___ */