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.
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;
19 }
20 }
22 class nsPresContext;
23 class nsDisplayItem;
24 class nsAString;
26 nsIFrame* NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
28 class nsHTMLCanvasFrame : public nsContainerFrame
29 {
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 nsHTMLCanvasFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
41 virtual void Init(nsIContent* aContent,
42 nsIFrame* aParent,
43 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
45 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
46 const nsRect& aDirtyRect,
47 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
49 already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
50 LayerManager* aManager,
51 nsDisplayItem* aItem,
52 const ContainerLayerParameters& aContainerParameters);
54 /* get the size of the canvas's image */
55 nsIntSize GetCanvasSize();
57 virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
58 virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
59 virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE;
61 virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
62 nsSize aCBSize, nscoord aAvailableWidth,
63 nsSize aMargin, nsSize aBorder, nsSize aPadding,
64 uint32_t aFlags) MOZ_OVERRIDE;
66 virtual nsresult Reflow(nsPresContext* aPresContext,
67 nsHTMLReflowMetrics& aDesiredSize,
68 const nsHTMLReflowState& aReflowState,
69 nsReflowStatus& aStatus) MOZ_OVERRIDE;
71 nsRect GetInnerArea() const;
73 #ifdef ACCESSIBILITY
74 virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
75 #endif
77 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
79 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
80 {
81 return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
82 }
84 #ifdef DEBUG_FRAME_DUMP
85 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
86 #endif
88 // Inserted child content gets its frames parented by our child block
89 virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
90 return GetFirstPrincipalChild()->GetContentInsertionFrame();
91 }
93 protected:
94 virtual ~nsHTMLCanvasFrame();
96 nscoord GetContinuationOffset(nscoord* aWidth = 0) const;
98 nsMargin mBorderPadding;
99 };
101 #endif /* nsHTMLCanvasFrame_h___ */