layout/generic/nsHTMLCanvasFrame.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/generic/nsHTMLCanvasFrame.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,101 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/* rendering object for the HTML <canvas> element */
    1.10 +
    1.11 +#ifndef nsHTMLCanvasFrame_h___
    1.12 +#define nsHTMLCanvasFrame_h___
    1.13 +
    1.14 +#include "mozilla/Attributes.h"
    1.15 +#include "nsContainerFrame.h"
    1.16 +#include "FrameLayerBuilder.h"
    1.17 +
    1.18 +namespace mozilla {
    1.19 +namespace layers {
    1.20 +class Layer;
    1.21 +class LayerManager;
    1.22 +}
    1.23 +}
    1.24 +
    1.25 +class nsPresContext;
    1.26 +class nsDisplayItem;
    1.27 +class nsAString;
    1.28 +
    1.29 +nsIFrame* NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
    1.30 +
    1.31 +class nsHTMLCanvasFrame : public nsContainerFrame
    1.32 +{
    1.33 +public:
    1.34 +  typedef mozilla::layers::Layer Layer;
    1.35 +  typedef mozilla::layers::LayerManager LayerManager;
    1.36 +  typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
    1.37 +
    1.38 +  NS_DECL_QUERYFRAME_TARGET(nsHTMLCanvasFrame)
    1.39 +  NS_DECL_QUERYFRAME
    1.40 +  NS_DECL_FRAMEARENA_HELPERS
    1.41 +
    1.42 +  nsHTMLCanvasFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
    1.43 +
    1.44 +  virtual void Init(nsIContent* aContent,
    1.45 +                    nsIFrame*   aParent,
    1.46 +                    nsIFrame*   aPrevInFlow) MOZ_OVERRIDE;
    1.47 +
    1.48 +  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
    1.49 +                                const nsRect&           aDirtyRect,
    1.50 +                                const nsDisplayListSet& aLists) MOZ_OVERRIDE;
    1.51 +
    1.52 +  already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
    1.53 +                                     LayerManager* aManager,
    1.54 +                                     nsDisplayItem* aItem,
    1.55 +                                     const ContainerLayerParameters& aContainerParameters);
    1.56 +
    1.57 +  /* get the size of the canvas's image */
    1.58 +  nsIntSize GetCanvasSize();
    1.59 +
    1.60 +  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    1.61 +  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    1.62 +  virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE;
    1.63 +
    1.64 +  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
    1.65 +                             nsSize aCBSize, nscoord aAvailableWidth,
    1.66 +                             nsSize aMargin, nsSize aBorder, nsSize aPadding,
    1.67 +                             uint32_t aFlags) MOZ_OVERRIDE;
    1.68 +
    1.69 +  virtual nsresult Reflow(nsPresContext*           aPresContext,
    1.70 +                          nsHTMLReflowMetrics&     aDesiredSize,
    1.71 +                          const nsHTMLReflowState& aReflowState,
    1.72 +                          nsReflowStatus&          aStatus) MOZ_OVERRIDE;
    1.73 +
    1.74 +  nsRect GetInnerArea() const;
    1.75 +
    1.76 +#ifdef ACCESSIBILITY
    1.77 +  virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
    1.78 +#endif
    1.79 +
    1.80 +  virtual nsIAtom* GetType() const MOZ_OVERRIDE;
    1.81 +
    1.82 +  virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
    1.83 +  {
    1.84 +    return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
    1.85 +  }
    1.86 +
    1.87 +#ifdef DEBUG_FRAME_DUMP
    1.88 +  virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
    1.89 +#endif
    1.90 +
    1.91 +  // Inserted child content gets its frames parented by our child block
    1.92 +  virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
    1.93 +    return GetFirstPrincipalChild()->GetContentInsertionFrame();
    1.94 +  }
    1.95 +
    1.96 +protected:
    1.97 +  virtual ~nsHTMLCanvasFrame();
    1.98 +
    1.99 +  nscoord GetContinuationOffset(nscoord* aWidth = 0) const;
   1.100 +
   1.101 +  nsMargin mBorderPadding;
   1.102 +};
   1.103 +
   1.104 +#endif /* nsHTMLCanvasFrame_h___ */

mercurial