2008-07-09 08:22:20 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
2012-05-21 11:12:37 +00: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/. */
|
2008-07-09 08:22:20 +00:00
|
|
|
|
|
|
|
/* rendering object for the HTML <video> element */
|
|
|
|
|
|
|
|
#ifndef nsVideoFrame_h___
|
|
|
|
#define nsVideoFrame_h___
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2008-07-09 08:22:20 +00:00
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
#include "nsIAnonymousContentCreator.h"
|
2012-09-16 22:25:33 +00:00
|
|
|
#include "FrameLayerBuilder.h"
|
2012-07-31 00:42:26 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
class Layer;
|
|
|
|
class LayerManager;
|
|
|
|
}
|
|
|
|
}
|
2008-07-09 08:22:20 +00:00
|
|
|
|
2013-08-22 18:32:52 +00:00
|
|
|
class nsAString;
|
2010-04-10 20:10:12 +00:00
|
|
|
class nsPresContext;
|
2010-07-15 21:07:46 +00:00
|
|
|
class nsDisplayItem;
|
2013-08-22 18:32:52 +00:00
|
|
|
template <class T> class nsTArray;
|
2010-04-10 20:10:12 +00:00
|
|
|
|
2008-07-09 08:22:20 +00:00
|
|
|
nsIFrame* NS_NewVideoFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|
|
|
|
|
|
|
class nsVideoFrame : public nsContainerFrame, public nsIAnonymousContentCreator
|
|
|
|
{
|
|
|
|
public:
|
2010-03-01 23:41:49 +00:00
|
|
|
typedef mozilla::layers::Layer Layer;
|
|
|
|
typedef mozilla::layers::LayerManager LayerManager;
|
2013-09-27 06:01:16 +00:00
|
|
|
typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
|
2010-03-01 23:41:49 +00:00
|
|
|
|
2008-07-09 08:22:20 +00:00
|
|
|
nsVideoFrame(nsStyleContext* aContext);
|
|
|
|
|
2009-01-12 19:20:59 +00:00
|
|
|
NS_DECL_QUERYFRAME
|
2013-05-27 20:34:00 +00:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsVideoFrame)
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2008-07-09 08:22:20 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
|
2009-06-26 07:25:17 +00:00
|
|
|
nsIAtom* aAttribute,
|
2013-05-14 16:33:23 +00:00
|
|
|
int32_t aModType) MOZ_OVERRIDE;
|
2009-06-26 07:25:17 +00:00
|
|
|
|
2008-07-09 08:22:20 +00:00
|
|
|
/* get the size of the video's display */
|
2011-04-08 01:04:40 +00:00
|
|
|
nsSize GetVideoIntrinsicSize(nsRenderingContext *aRenderingContext);
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE;
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
2008-07-09 08:22:20 +00:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aFlags) MOZ_OVERRIDE;
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
|
|
|
virtual bool IsLeaf() const MOZ_OVERRIDE;
|
2008-07-09 08:22:20 +00:00
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2013-05-14 16:33:23 +00:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2008-07-09 08:22:20 +00:00
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2012-09-28 21:53:44 +00:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
|
2008-07-09 08:22:20 +00:00
|
|
|
#endif
|
|
|
|
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2008-07-09 08:22:20 +00:00
|
|
|
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
|
2008-07-09 08:22:20 +00:00
|
|
|
{
|
|
|
|
return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
|
|
|
|
}
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
|
2010-10-15 15:34:35 +00:00
|
|
|
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
2012-09-14 16:10:08 +00:00
|
|
|
uint32_t aFilters) MOZ_OVERRIDE;
|
2008-07-09 08:22:20 +00:00
|
|
|
|
2009-12-11 04:02:13 +00:00
|
|
|
nsIContent* GetPosterImage() { return mPosterImage; }
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
// Returns true if we should display the poster. Note that once we show
|
2009-12-11 04:02:13 +00:00
|
|
|
// a video frame, the poster will never be displayed again.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool ShouldDisplayPoster();
|
2009-12-11 04:02:13 +00:00
|
|
|
|
2013-02-26 21:06:51 +00:00
|
|
|
nsIContent *GetCaptionOverlay() { return mCaptionDiv; }
|
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2013-05-14 16:33:23 +00:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2008-07-09 08:22:20 +00:00
|
|
|
#endif
|
|
|
|
|
2010-03-01 23:41:49 +00:00
|
|
|
already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
|
2010-07-15 21:07:46 +00:00
|
|
|
LayerManager* aManager,
|
2012-09-16 22:25:33 +00:00
|
|
|
nsDisplayItem* aItem,
|
2013-09-27 06:01:16 +00:00
|
|
|
const ContainerLayerParameters& aContainerParameters);
|
2010-03-01 23:41:49 +00:00
|
|
|
|
2008-07-09 08:22:20 +00:00
|
|
|
protected:
|
2009-06-26 07:25:17 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
// Returns true if we're rendering for a video element. We still create
|
2009-06-26 07:25:17 +00:00
|
|
|
// nsVideoFrame to render controls for an audio element.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool HasVideoElement();
|
2009-06-26 07:25:17 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
// Returns true if there is video data to render. Can return false
|
2009-06-26 07:25:17 +00:00
|
|
|
// when we're the frame for an audio element, or we've created a video
|
|
|
|
// element for a media which is audio-only.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool HasVideoData();
|
2009-06-26 07:25:17 +00:00
|
|
|
|
|
|
|
// Sets the mPosterImage's src attribute to be the video's poster attribute,
|
2009-07-07 02:02:06 +00:00
|
|
|
// if we're the frame for a video element. Only call on frames for video
|
|
|
|
// elements, not for frames for audio elements.
|
2013-12-04 01:06:16 +00:00
|
|
|
void UpdatePosterSource(bool aNotify);
|
2008-12-17 00:27:46 +00:00
|
|
|
|
2008-07-09 08:22:20 +00:00
|
|
|
virtual ~nsVideoFrame();
|
|
|
|
|
|
|
|
nsMargin mBorderPadding;
|
2012-07-31 00:42:26 +00:00
|
|
|
|
2009-06-26 07:25:17 +00:00
|
|
|
// Anonymous child which is bound via XBL to the video controls.
|
2008-07-09 08:22:20 +00:00
|
|
|
nsCOMPtr<nsIContent> mVideoControls;
|
2012-07-31 00:42:26 +00:00
|
|
|
|
2009-06-26 07:25:17 +00:00
|
|
|
// Anonymous child which is the image element of the poster frame.
|
|
|
|
nsCOMPtr<nsIContent> mPosterImage;
|
2013-02-26 21:06:51 +00:00
|
|
|
|
|
|
|
// Anonymous child which is the text track caption display div.
|
|
|
|
nsCOMPtr<nsIContent> mCaptionDiv;
|
|
|
|
|
2008-07-09 08:22:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsVideoFrame_h___ */
|