2008-07-09 01:22:20 -07: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 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/. */
|
2008-07-09 01:22:20 -07:00
|
|
|
|
|
|
|
/* rendering object for the HTML <video> element */
|
|
|
|
|
|
|
|
#ifndef nsVideoFrame_h___
|
|
|
|
#define nsVideoFrame_h___
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2008-07-09 01:22:20 -07:00
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
#include "nsIAnonymousContentCreator.h"
|
2014-03-15 12:00:17 -07:00
|
|
|
#include "nsTArrayForwardDeclare.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;
|
|
|
|
}
|
|
|
|
}
|
2008-07-09 01:22:20 -07:00
|
|
|
|
2013-08-22 11:32:52 -07:00
|
|
|
class nsAString;
|
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
|
|
|
|
2008-07-09 01:22:20 -07:00
|
|
|
class nsVideoFrame : public nsContainerFrame, public nsIAnonymousContentCreator
|
|
|
|
{
|
|
|
|
public:
|
2010-03-01 15:41:49 -08:00
|
|
|
typedef mozilla::layers::Layer Layer;
|
|
|
|
typedef mozilla::layers::LayerManager LayerManager;
|
2013-09-26 23:01:16 -07:00
|
|
|
typedef mozilla::ContainerLayerParameters ContainerLayerParameters;
|
2010-03-01 15:41:49 -08:00
|
|
|
|
2014-08-31 20:36:37 -07:00
|
|
|
explicit nsVideoFrame(nsStyleContext* aContext);
|
2008-07-09 01:22:20 -07:00
|
|
|
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2013-05-27 13:34:00 -07:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsVideoFrame)
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
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;
|
2008-07-09 01:22:20 -07:00
|
|
|
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2014-02-18 00:36:33 -08:00
|
|
|
nsIAtom* aAttribute,
|
2015-03-21 09:28:04 -07:00
|
|
|
int32_t aModType) override;
|
2009-06-26 00:25:17 -07:00
|
|
|
|
2008-07-09 01:22:20 -07:00
|
|
|
/* get the size of the video's display */
|
2011-04-07 18:04:40 -07:00
|
|
|
nsSize GetVideoIntrinsicSize(nsRenderingContext *aRenderingContext);
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsSize GetIntrinsicRatio() override;
|
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;
|
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
|
|
|
virtual bool IsLeaf() const override;
|
2008-07-09 01:22:20 -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;
|
2008-07-09 01:22:20 -07:00
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual mozilla::a11y::AccType AccessibleType() override;
|
2008-07-09 01:22:20 -07:00
|
|
|
#endif
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2008-07-09 01:22:20 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2008-07-09 01:22:20 -07:00
|
|
|
{
|
|
|
|
return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
|
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
2014-07-16 11:41:57 -07:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2015-03-21 09:28:04 -07:00
|
|
|
uint32_t aFilters) override;
|
2008-07-09 01:22:20 -07:00
|
|
|
|
2009-12-10 20:02:13 -08:00
|
|
|
nsIContent* GetPosterImage() { return mPosterImage; }
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
// Returns true if we should display the poster. Note that once we show
|
2009-12-10 20:02:13 -08:00
|
|
|
// a video frame, the poster will never be displayed again.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ShouldDisplayPoster();
|
2009-12-10 20:02:13 -08:00
|
|
|
|
2013-02-26 13:06:51 -08:00
|
|
|
nsIContent *GetCaptionOverlay() { return mCaptionDiv; }
|
|
|
|
|
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;
|
2008-07-09 01:22:20 -07:00
|
|
|
#endif
|
|
|
|
|
2010-03-01 15:41:49 -08: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-03-01 15:41:49 -08:00
|
|
|
|
2008-07-09 01:22:20 -07:00
|
|
|
protected:
|
2009-06-26 00:25:17 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
// Returns true if we're rendering for a video element. We still create
|
2009-06-26 00:25:17 -07:00
|
|
|
// nsVideoFrame to render controls for an audio element.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HasVideoElement();
|
2009-06-26 00:25:17 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
// Returns true if there is video data to render. Can return false
|
2009-06-26 00:25:17 -07: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-28 23:19:26 -07:00
|
|
|
bool HasVideoData();
|
2009-06-26 00:25:17 -07:00
|
|
|
|
|
|
|
// Sets the mPosterImage's src attribute to be the video's poster attribute,
|
2009-07-06 19:02:06 -07: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-03 17:06:16 -08:00
|
|
|
void UpdatePosterSource(bool aNotify);
|
2008-12-16 16:27:46 -08:00
|
|
|
|
2008-07-09 01:22:20 -07:00
|
|
|
virtual ~nsVideoFrame();
|
|
|
|
|
|
|
|
nsMargin mBorderPadding;
|
2012-07-30 17:42:26 -07:00
|
|
|
|
2009-06-26 00:25:17 -07:00
|
|
|
// Anonymous child which is bound via XBL to the video controls.
|
2008-07-09 01:22:20 -07:00
|
|
|
nsCOMPtr<nsIContent> mVideoControls;
|
2012-07-30 17:42:26 -07:00
|
|
|
|
2009-06-26 00:25:17 -07:00
|
|
|
// Anonymous child which is the image element of the poster frame.
|
|
|
|
nsCOMPtr<nsIContent> mPosterImage;
|
2013-02-26 13:06:51 -08:00
|
|
|
|
|
|
|
// Anonymous child which is the text track caption display div.
|
|
|
|
nsCOMPtr<nsIContent> mCaptionDiv;
|
|
|
|
|
2008-07-09 01:22:20 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsVideoFrame_h___ */
|