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
|
|
|
|
|
2012-02-17 20:26:37 -08:00
|
|
|
nsHTMLCanvasFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-03-19 18:47:48 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_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,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_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
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aFlags) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2012-07-30 17:42:26 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsRect GetInnerArea() const;
|
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2012-09-28 14:53:44 -07:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_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
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_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
|
2013-05-14 09:33:23 -07:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() MOZ_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;
|
|
|
|
|
|
|
|
nsMargin mBorderPadding;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsHTMLCanvasFrame_h___ */
|