2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* rendering object for the HTML <canvas> element */
|
|
|
|
|
|
|
|
#ifndef nsHTMLCanvasFrame_h___
|
|
|
|
#define nsHTMLCanvasFrame_h___
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-02-17 20:26:37 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2012-09-16 15:25:33 -07:00
|
|
|
#include "FrameLayerBuilder.h"
|
2012-07-30 17:42:26 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
class Layer;
|
|
|
|
class LayerManager;
|
|
|
|
}
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-10 13:10:12 -07:00
|
|
|
class nsPresContext;
|
2010-07-15 14:07:46 -07:00
|
|
|
class nsDisplayItem;
|
2013-08-22 11:32:52 -07:00
|
|
|
class nsAString;
|
2010-04-10 13:10:12 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIFrame* NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|
|
|
|
2012-02-17 20:26:37 -08:00
|
|
|
class nsHTMLCanvasFrame : public nsContainerFrame
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2010-05-17 21:04:22 -07:00
|
|
|
typedef mozilla::layers::Layer Layer;
|
|
|
|
typedef mozilla::layers::LayerManager LayerManager;
|
2013-09-26 23:01:16 -07:00
|
|
|
typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
|
2010-05-17 21:04:22 -07:00
|
|
|
|
2013-04-03 16:35:07 -07:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsHTMLCanvasFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2014-08-31 20:36:37 -07:00
|
|
|
explicit nsHTMLCanvasFrame(nsStyleContext* aContext)
|
2014-07-24 01:30:07 -07:00
|
|
|
: nsContainerFrame(aContext)
|
|
|
|
, mBorderPadding(GetWritingMode()) {}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-24 15:20:40 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
2011-02-04 10:11:24 -08:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
|
2010-07-15 14:07:46 -07:00
|
|
|
LayerManager* aManager,
|
2012-09-16 15:25:33 -07:00
|
|
|
nsDisplayItem* aItem,
|
2013-09-26 23:01:16 -07:00
|
|
|
const ContainerLayerParameters& aContainerParameters);
|
2010-07-15 14:07:46 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* get the size of the canvas's image */
|
2009-01-14 19:27:09 -08:00
|
|
|
nsIntSize GetCanvasSize();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual mozilla::IntrinsicSize GetIntrinsicSize() override;
|
|
|
|
virtual nsSize GetIntrinsicRatio() override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-08-24 07:34:44 -07:00
|
|
|
virtual mozilla::LogicalSize
|
|
|
|
ComputeSize(nsRenderingContext *aRenderingContext,
|
|
|
|
mozilla::WritingMode aWritingMode,
|
|
|
|
const mozilla::LogicalSize& aCBSize,
|
|
|
|
nscoord aAvailableISize,
|
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding,
|
2015-03-21 09:28:04 -07:00
|
|
|
ComputeSizeFlags aFlags) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-12 17:47:52 -07:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsReflowStatus& aStatus) override;
|
2012-07-30 17:42:26 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsRect GetInnerArea() const;
|
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() override;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
|
|
|
|
}
|
|
|
|
|
2014-01-05 15:31:14 -08:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2012-02-17 20:26:37 -08:00
|
|
|
// Inserted child content gets its frames parented by our child block
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsContainerFrame* GetContentInsertionFrame() override {
|
2012-02-17 20:26:37 -08:00
|
|
|
return GetFirstPrincipalChild()->GetContentInsertionFrame();
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
virtual ~nsHTMLCanvasFrame();
|
|
|
|
|
|
|
|
nscoord GetContinuationOffset(nscoord* aWidth = 0) const;
|
|
|
|
|
2014-07-24 01:30:07 -07:00
|
|
|
mozilla::LogicalMargin mBorderPadding;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsHTMLCanvasFrame_h___ */
|