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-02-17 20:26:37 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsAString.h"
|
|
|
|
#include "nsIIOService.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;
|
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;
|
|
|
|
|
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
|
|
|
|
2011-02-04 10:11:24 -08:00
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
2010-05-17 21:04:22 -07:00
|
|
|
already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
|
2010-07-15 14:07:46 -07:00
|
|
|
LayerManager* aManager,
|
|
|
|
nsDisplayItem* aItem);
|
|
|
|
|
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
|
|
|
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
2007-06-12 11:27:09 -07:00
|
|
|
virtual nsSize GetIntrinsicRatio();
|
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-03-16 11:01:05 -07:00
|
|
|
PRUint32 aFlags) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
2012-07-30 17:42:26 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsRect GetInnerArea() const;
|
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2012-05-28 18:18:45 -07:00
|
|
|
virtual already_AddRefed<Accessible> CreateAccessible();
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsFrameOfType(PRUint32 aFlags) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
#endif
|
|
|
|
|
2012-02-17 20:26:37 -08:00
|
|
|
// Inserted child content gets its frames parented by our child block
|
|
|
|
virtual nsIFrame* GetContentInsertionFrame() {
|
|
|
|
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___ */
|