Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / layout / generic / nsHTMLCanvasFrame.h
blob86deec2775686572243c08a7d5441851c5d9af9b
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* rendering object for the HTML <canvas> element */
9 #ifndef nsHTMLCanvasFrame_h___
10 #define nsHTMLCanvasFrame_h___
12 #include "mozilla/Attributes.h"
13 #include "nsContainerFrame.h"
14 #include "nsStringFwd.h"
16 namespace mozilla {
17 class PresShell;
18 namespace layers {
19 class CanvasRenderer;
20 class Layer;
21 class LayerManager;
22 class WebRenderCanvasData;
23 } // namespace layers
24 } // namespace mozilla
26 class nsPresContext;
28 nsIFrame* NS_NewHTMLCanvasFrame(mozilla::PresShell* aPresShell,
29 mozilla::ComputedStyle* aStyle);
31 class nsHTMLCanvasFrame final : public nsContainerFrame {
32 public:
33 typedef mozilla::layers::CanvasRenderer CanvasRenderer;
34 typedef mozilla::layers::LayerManager LayerManager;
35 typedef mozilla::layers::WebRenderCanvasData WebRenderCanvasData;
37 NS_DECL_QUERYFRAME
38 NS_DECL_FRAMEARENA_HELPERS(nsHTMLCanvasFrame)
40 nsHTMLCanvasFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
41 : nsContainerFrame(aStyle, aPresContext, kClassID) {}
43 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
44 const nsDisplayListSet& aLists) override;
46 void Destroy(DestroyContext&) override;
48 bool UpdateWebRenderCanvasData(nsDisplayListBuilder* aBuilder,
49 WebRenderCanvasData* aCanvasData);
51 /* get the size of the canvas's image */
52 nsIntSize GetCanvasSize() const;
54 virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
55 virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
56 virtual mozilla::IntrinsicSize GetIntrinsicSize() override;
57 mozilla::AspectRatio GetIntrinsicRatio() const override;
59 void UnionChildOverflow(mozilla::OverflowAreas& aOverflowAreas) override;
61 SizeComputationResult ComputeSize(
62 gfxContext* aRenderingContext, mozilla::WritingMode aWM,
63 const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
64 const mozilla::LogicalSize& aMargin,
65 const mozilla::LogicalSize& aBorderPadding,
66 const mozilla::StyleSizeOverrides& aSizeOverrides,
67 mozilla::ComputeSizeFlags aFlags) override;
69 virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
70 const ReflowInput& aReflowInput,
71 nsReflowStatus& aStatus) override;
73 #ifdef ACCESSIBILITY
74 virtual mozilla::a11y::AccType AccessibleType() override;
75 #endif
77 #ifdef DEBUG_FRAME_DUMP
78 virtual nsresult GetFrameName(nsAString& aResult) const override;
79 #endif
81 // Inserted child content gets its frames parented by our child block
82 virtual nsContainerFrame* GetContentInsertionFrame() override {
83 return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
86 // Return the ::-moz-html-canvas-content anonymous box.
87 void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
89 protected:
90 virtual ~nsHTMLCanvasFrame();
93 #endif /* nsHTMLCanvasFrame_h___ */