mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 23:59:46 +00:00
089cacb631
- Bug 1184867: [vp9] P1. VPXDecoder pass DTS to VideoData::Create. r=jya (18c5dfa2f)
- Bug 1184867: [MSE] P2. Update WebMContainerParser to be compatible with new MSE. r=kinetik (8ad865692)
- Bug 1184867: [MSE] P3. Use WebMDemuxer in TrackBuffersManager. r=jya (957b2f1bf)
- Bug 1185792: [webm] P1. Make MediaInfo.mFrame nsIntRect for visible area. r=jya (af461bb88)
- Bug 1185792: [webm] P2. AndroidDecoderModule requires API 16 or later. r=snorp (a0710615f)
- Bug 1185792: [webm] P3. Enable WebMDemuxer/MediaFormatReader by default. r=kinetik (9c9dbe96d)
- Bug 1180535 - Dispatch the media-playback notification when navigating away from a page that has a media element playing; r=baku (8dfc42c1f)
- Bug 1177259 - Improve the names of the methods of nsIAudioChannelAgent, r=alwu (760512d4f)
- Bug 1156472 - Part 1 - Allow to capture all HTMLMediaElements and AudioContexts for a document. r=baku,padenot (da382bae7)
- Bug 1156472 - Part 2 - Rename MediaEngineWebRTCAudioSource to MediaEngineWebRTCMicrophoneSource. r=jesup (91622741c)
- Bug 1156472 - Part 3 - Implement AudioCaptureStream. r=roc (857eb8ede)
- Bug 1156472 - Part 4 - Add a new MediaStreamGraph API to connect a MediaStream to a capture stream. r=jesup,roc (a3f1a5d9d)
- Bug 1181428 - Add persist option to OriginKey to skip saving of temporal keys. r=mt (9af4b9425)
- Bug 1181428 - Defer persisting until gUM succeeds or persistent permission. r=mt (db55b5e98)
- Bug 1156472 - Part 5 - Add MediaEngineWebRTCAudioCaptureSource as a new audio source, and "audioCapture" as a new MediaSource. r=jesup,bz (bee21be1d)
- Bug 1181428 - Move code to reuse test for active gum or persistent permission. r=mt (be4009601)
- Bug 1181428 - Plumb origin through to success path. r=mt (7f1dba49d)
- bug 1116382 reuse some UTF8toUTF16 code r=bholley (4f2411821)
- bug 1116382 accept abstract strings in NewURIFromString() r=bholley (3f54ab677)
- bug 1116382 resolve MediaSource urls on Source element src attributes when set r=bholley (6a804840e)
- bug 1116382 resolve MediaSource urls on media element src attributes when set r=bholley (44d6e9cd3)
- no need to RemoveMediaElementFromURITable, it is done already in ShutdownDecoder (7159dc04c)
- bug 1116382 always ShutdownDecoder() so that MediaSourceDecoder alone can manage MediaSource::Detach() r=bholley (d675be4c5)
- no need to RemoveMediaElementFromURITable (dcbb55480)
- Bug 1162639 - Make consistent how to handle MediaStreamURI r=roc (572c17214)
- no need to RemoveMediaElementFromURITable (647db2f47)
- bug 1116382 use MediaSource from resolution of MediaSource urls when set r=bholley (b6055f2f8)
- bug 1116382 no need to check IsMediaSourceURI(mLoadingSrc) once mMediaSource has been set r=bholley (ec34fb8b5)
- bug 1116382 auto revoke MediaSource object URLs r=bholley (b4f6e1847)
- bug 1116382 adjust explict revoke test to fail if revocation fails r=bholley (d2185e611)
- bug 1116382 test opening referenced MediaSource after URL.revokeObjectURL() r=bholley (6d7b80343)
- bug 1116382 test auto-revoking behavior with URL.createObjectURL(MediaSource) r=bholley (70fda515d)
- fix patch error (c56103f58)
- bit of Bug 659285 - Extend media.autoplay.enabled to provide a way to disable untrusted play() invocations. (d1265c47a)
- Bug 1135013 - Remove unused media-eme-metadataloaded notification. r=gerald (248717ff3)
- Bug 1183700 - Don't prevent playback of media elements in a muted tab on desktop, r=ehsan (fffeb70b4)
- Bug 1185303 - HTMLMediaElement should not be paused when visibility changed and when muted by the AudioChannel policy, r=ehsan (954f10541)
- Bug 1156472 - Part 6 - Connect HTMLMediaElement and AudioContext to the capture stream when capturing is needed. r=roc (0a845b985)
- Bug 1156472 - Part 7 - Allow to un-capture an HTMLMediaElement. r=pehrsons,jwwang (e07f287e5)
- Bug 1156472 - Part 8 - Use fatal asserts in AudioChannelUpmix, because it would have crashed anyways. r=roc (9c57a5b32)
- Bug 1157701 - Properly remove usage of Array.prototype.includes(). r=jib (7040e053c)
- Bug 1169338 - Part 3: Do a GC before each webrtc mochitest, so there isn't too much buildup. r=mt (b7f812bff)
- Bug 1156472 - Part 10 - Test AudioCaptureStream. r=pehrsons (f084533a2)
- Bug 1156472 - Part 11 - Unbitrot MediaManager.cpp over jib's changes. r=jib (4b5552125)
- Bug 1156472 - Part 12 - Allow to pipe the AudioCaptureStream into an AudioContext. r=mt,roc (8067c2512)
- Bug 1156472 - Part 13 - Make necessary adjustments for integer audio. r=jesup (deaf8e09e)
- Bug 1156472 - Part 14 - Null check the window, because it can be different during the window's shutdown. r=baku (65351205f)
- missing comment of 1153344 (83297ee81)
- Bug 1183518. Part 1 - move calls to mResource->SetReadMode out of Mediadecoder::{Start,Stop}ProgressUpdates since they are not related to progress update. r=roc. (b78e2f712)
- Bug 1183518. Part 2 - Move update of mIgnoreProgressData to main thread. r=cpearce. (33f73d117)
- Bug 1183518. Part 3 - early bailout from MediaDecoder::NotifyBytesConsumed when shutting down. r=jya. (f4b8234fc)
- Bug 1177452: Ensure start time is always calculated on first frame decoding. r=jwwang (cb4d66300)
- Bug 1185407. Part 1 - have AudioSink::Init() return a promise. r=kinetik. (dca5aee79)
- Bug 1185407. Part 2 - remove unused code. r=kinetik. (aeca11114)
- Bug 1185407. Part 3 - don't shutdown AudioStream prematurely. r=kinetik. (be11cfe89)
- Bug 1190496 - Remove dependency on VideoUtils.h for stack size. r=cpearce (d2b9a9c7c)
- Bug 1186358. Part 1 - Remove dependency on MediaDecoderStateMachine from AudioSink. r=kinetik. (96015551d)
- Bug 1186358. Part 2 - remove unnecessary/insufficient includes. r=kinetik. (6498e2f6e)
- Bug 1186299 - Consolidate AudioSink::PrepareToShutdown and AudioSink::Shutdown into one function. r=kinetik. (e6f755f9e)
- fix include (14742ce82)
- Bug 1184874. Part 1 - fix indentation. r=cpearce. (6f82906b3)
- Bug 1184874. Part 2 - add the ability to know which item is popped from the MediaQueue. r=cpearce. (54a65afc7)
- Bug 1184874. Part 3 - call mDecoder->UpdatePlaybackOffset in On{Audio,Video}Popped and remove MediaDecoderStateMachine::DispatchOnPlaybackOffsetUpdate. r=cpearce. (d280e80ce)
- Bug 1186801 - Remove decoder monitor from AudioSink. r=kinetik. (0fb442870)
191 lines
6.2 KiB
C++
191 lines
6.2 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* 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/. */
|
|
|
|
#include "mozilla/dom/HTMLSourceElement.h"
|
|
#include "mozilla/dom/HTMLSourceElementBinding.h"
|
|
|
|
#include "mozilla/dom/HTMLImageElement.h"
|
|
#include "mozilla/dom/ResponsiveImageSelector.h"
|
|
#include "mozilla/dom/MediaSource.h"
|
|
|
|
#include "nsGkAtoms.h"
|
|
|
|
#include "nsIMediaList.h"
|
|
#include "nsCSSParser.h"
|
|
#include "nsHostObjectProtocolHandler.h"
|
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Source)
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
HTMLSourceElement::HTMLSourceElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
|
: nsGenericHTMLElement(aNodeInfo)
|
|
{
|
|
}
|
|
|
|
HTMLSourceElement::~HTMLSourceElement()
|
|
{
|
|
}
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLSourceElement, nsGenericHTMLElement,
|
|
mSrcMediaSource)
|
|
|
|
NS_IMPL_ADDREF_INHERITED(HTMLSourceElement, nsGenericHTMLElement)
|
|
NS_IMPL_RELEASE_INHERITED(HTMLSourceElement, nsGenericHTMLElement)
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLSourceElement)
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLSourceElement)
|
|
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
|
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLSourceElement)
|
|
|
|
NS_IMPL_URI_ATTR(HTMLSourceElement, Src, src)
|
|
NS_IMPL_STRING_ATTR(HTMLSourceElement, Type, type)
|
|
NS_IMPL_STRING_ATTR(HTMLSourceElement, Srcset, srcset)
|
|
NS_IMPL_STRING_ATTR(HTMLSourceElement, Sizes, sizes)
|
|
NS_IMPL_STRING_ATTR(HTMLSourceElement, Media, media)
|
|
|
|
bool
|
|
HTMLSourceElement::MatchesCurrentMedia()
|
|
{
|
|
if (mMediaList) {
|
|
nsIPresShell* presShell = OwnerDoc()->GetShell();
|
|
nsPresContext* pctx = presShell ? presShell->GetPresContext() : nullptr;
|
|
return pctx && mMediaList->Matches(pctx, nullptr);
|
|
}
|
|
|
|
// No media specified
|
|
return true;
|
|
}
|
|
|
|
/* static */ bool
|
|
HTMLSourceElement::WouldMatchMediaForDocument(const nsAString& aMedia,
|
|
const nsIDocument *aDocument)
|
|
{
|
|
if (aMedia.IsEmpty()) {
|
|
return true;
|
|
}
|
|
|
|
nsIPresShell* presShell = aDocument->GetShell();
|
|
nsPresContext* pctx = presShell ? presShell->GetPresContext() : nullptr;
|
|
MOZ_ASSERT(pctx, "Called for document with no prescontext");
|
|
|
|
nsCSSParser cssParser;
|
|
nsRefPtr<nsMediaList> mediaList = new nsMediaList();
|
|
cssParser.ParseMediaList(aMedia, nullptr, 0, mediaList, false);
|
|
|
|
return pctx && mediaList->Matches(pctx, nullptr);
|
|
}
|
|
|
|
nsresult
|
|
HTMLSourceElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
const nsAttrValue* aValue, bool aNotify)
|
|
{
|
|
// If we are associated with a <picture> with a valid <img>, notify it of
|
|
// responsive parameter changes
|
|
Element *parent = nsINode::GetParentElement();
|
|
if (aNameSpaceID == kNameSpaceID_None &&
|
|
(aName == nsGkAtoms::srcset ||
|
|
aName == nsGkAtoms::sizes ||
|
|
aName == nsGkAtoms::media ||
|
|
aName == nsGkAtoms::type) &&
|
|
parent && parent->IsHTMLElement(nsGkAtoms::picture)) {
|
|
nsString strVal = aValue ? aValue->GetStringValue() : EmptyString();
|
|
// Find all img siblings after this <source> and notify them of the change
|
|
nsCOMPtr<nsIContent> sibling = AsContent();
|
|
while ( (sibling = sibling->GetNextSibling()) ) {
|
|
if (sibling->IsHTMLElement(nsGkAtoms::img)) {
|
|
HTMLImageElement *img = static_cast<HTMLImageElement*>(sibling.get());
|
|
if (aName == nsGkAtoms::srcset) {
|
|
img->PictureSourceSrcsetChanged(AsContent(), strVal, aNotify);
|
|
} else if (aName == nsGkAtoms::sizes) {
|
|
img->PictureSourceSizesChanged(AsContent(), strVal, aNotify);
|
|
} else if (aName == nsGkAtoms::media ||
|
|
aName == nsGkAtoms::type) {
|
|
img->PictureSourceMediaOrTypeChanged(AsContent(), aNotify);
|
|
}
|
|
}
|
|
}
|
|
|
|
} else if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::media) {
|
|
mMediaList = nullptr;
|
|
if (aValue) {
|
|
nsString mediaStr = aValue->GetStringValue();
|
|
if (!mediaStr.IsEmpty()) {
|
|
nsCSSParser cssParser;
|
|
mMediaList = new nsMediaList();
|
|
cssParser.ParseMediaList(mediaStr, nullptr, 0, mMediaList, false);
|
|
}
|
|
}
|
|
} else if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::src) {
|
|
mSrcMediaSource = nullptr;
|
|
if (aValue) {
|
|
nsString srcStr = aValue->GetStringValue();
|
|
nsCOMPtr<nsIURI> uri;
|
|
NewURIFromString(srcStr, getter_AddRefs(uri));
|
|
if (uri && IsMediaSourceURI(uri)) {
|
|
NS_GetSourceForMediaSourceURI(uri, getter_AddRefs(mSrcMediaSource));
|
|
}
|
|
}
|
|
}
|
|
|
|
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName,
|
|
aValue, aNotify);
|
|
}
|
|
|
|
void
|
|
HTMLSourceElement::GetItemValueText(DOMString& aValue)
|
|
{
|
|
GetSrc(aValue);
|
|
}
|
|
|
|
void
|
|
HTMLSourceElement::SetItemValueText(const nsAString& aValue)
|
|
{
|
|
SetSrc(aValue);
|
|
}
|
|
|
|
nsresult
|
|
HTMLSourceElement::BindToTree(nsIDocument *aDocument,
|
|
nsIContent *aParent,
|
|
nsIContent *aBindingParent,
|
|
bool aCompileEventHandlers)
|
|
{
|
|
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument,
|
|
aParent,
|
|
aBindingParent,
|
|
aCompileEventHandlers);
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (aParent && aParent->IsNodeOfType(nsINode::eMEDIA)) {
|
|
HTMLMediaElement* media = static_cast<HTMLMediaElement*>(aParent);
|
|
media->NotifyAddedSource();
|
|
} else if (aParent && aParent->IsHTMLElement(nsGkAtoms::picture)) {
|
|
// Find any img siblings after this <source> and notify them
|
|
nsCOMPtr<nsIContent> sibling = AsContent();
|
|
while ( (sibling = sibling->GetNextSibling()) ) {
|
|
if (sibling->IsHTMLElement(nsGkAtoms::img)) {
|
|
HTMLImageElement *img = static_cast<HTMLImageElement*>(sibling.get());
|
|
img->PictureSourceAdded(AsContent());
|
|
}
|
|
}
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
JSObject*
|
|
HTMLSourceElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
|
{
|
|
return HTMLSourceElementBinding::Wrap(aCx, this, aGivenProto);
|
|
}
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|