Bug 857022 - Remove MOZ_MEDIA from content. r=cpearce

Remove the MOZ_MEDIA build-time define in the content
module, enabling this code unconditionally.
This commit is contained in:
Ralph Giles 2013-04-04 15:07:00 -07:00
parent f3b8f80ec4
commit 5fc8f9429e
16 changed files with 18 additions and 112 deletions

View File

@ -53,12 +53,10 @@
0xa6cf90f5, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
#ifdef MOZ_MEDIA
#define NS_HTMLAUDIOELEMENT_CID \
{ /* 1d40026b-4c44-4f6f-b158-26bb5e9c65e9 */ \
0x1d40026b, 0x4c44, 0x4f6f, \
{0xb1, 0x58, 0x26, 0xbb, 0x5e, 0x9c, 0x65, 0xe9}}
#endif
#define NS_NAMESPACEMANAGER_CID \
{ /* d9783472-8fe9-11d2-9d3c-0060088f9ff7 */ \
@ -151,15 +149,11 @@
0xb7f44954, 0x11d1, 0x11b2, \
{0x8c, 0x2e, 0xc2, 0xfe, 0xab, 0x41, 0x86, 0xbc}}
#ifdef MOZ_MEDIA
// {d899a152-9412-46b2-b651-2e71c5c2f05f}
#define NS_VIDEODOCUMENT_CID \
{ 0xd899a152, 0x9412, 0x46b2, \
{ 0xb6, 0x51, 0x2e, 0x71, 0xc5, 0xc2, 0xf0, 0x5f } }
#endif
#define NS_EVENTLISTENERSERVICE_CID \
{ /* baa34652-f1f1-4185-b224-244ee82a413a */ \
0xbaa34652, 0xf1f1, 0x4185, \

View File

@ -2490,10 +2490,8 @@ NS_NewSVGDocument(nsIDocument** aInstancePtrResult);
nsresult
NS_NewImageDocument(nsIDocument** aInstancePtrResult);
#ifdef MOZ_MEDIA
nsresult
NS_NewVideoDocument(nsIDocument** aInstancePtrResult);
#endif
already_AddRefed<mozilla::dom::DocumentFragment>
NS_NewDocumentFragment(nsNodeInfoManager* aNodeInfoManager,

View File

@ -30,6 +30,7 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/TextDecoderBase.h"
#include "mozilla/Likely.h"
@ -168,9 +169,6 @@
#ifdef IBMBIDI
#include "nsIBidiKeyboard.h"
#endif
#ifdef MOZ_MEDIA
#include "mozilla/dom/HTMLMediaElement.h"
#endif
extern "C" int MOZ_XMLTranslateEntity(const char* ptr, const char* end,
const char** next, PRUnichar* result);
@ -1268,9 +1266,7 @@ nsContentUtils::IsHTMLVoid(nsIAtom* aLocalName)
(aLocalName == nsGkAtoms::link) ||
(aLocalName == nsGkAtoms::meta) ||
(aLocalName == nsGkAtoms::param) ||
#ifdef MOZ_MEDIA
(aLocalName == nsGkAtoms::source) ||
#endif
(aLocalName == nsGkAtoms::track) ||
(aLocalName == nsGkAtoms::wbr);
}
@ -6453,7 +6449,6 @@ nsContentUtils::FindInternalContentViewer(const char* aType,
return docFactory.forget();
}
#ifdef MOZ_MEDIA
if (DecoderTraits::IsSupportedInVideoDocument(nsDependentCString(aType))) {
docFactory = do_GetService("@mozilla.org/content/document-loader-factory;1");
if (docFactory && aLoaderType) {
@ -6461,7 +6456,6 @@ nsContentUtils::FindInternalContentViewer(const char* aType,
}
return docFactory.forget();
}
#endif // MOZ_MEDIA
return nullptr;
}

View File

@ -148,9 +148,7 @@
#include "nsObjectLoadingContent.h"
#include "nsHtml5TreeOpExecutor.h"
#include "nsIDOMElementReplaceEvent.h"
#ifdef MOZ_MEDIA
#include "mozilla/dom/HTMLMediaElement.h"
#endif // MOZ_MEDIA
#ifdef MOZ_WEBRTC
#include "IPeerConnection.h"
#endif // MOZ_WEBRTC
@ -4060,13 +4058,11 @@ nsDocument::SetScopeObject(nsIGlobalObject* aGlobal)
static void
NotifyActivityChanged(nsIContent *aContent, void *aUnused)
{
#ifdef MOZ_MEDIA
nsCOMPtr<nsIDOMHTMLMediaElement> domMediaElem(do_QueryInterface(aContent));
if (domMediaElem) {
HTMLMediaElement* mediaElem = static_cast<HTMLMediaElement*>(aContent);
mediaElem->NotifyOwnerDocumentActivityChanged();
}
#endif
nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aContent));
if (objectLoadingContent) {
nsObjectLoadingContent* olc = static_cast<nsObjectLoadingContent*>(objectLoadingContent.get());
@ -9016,13 +9012,11 @@ nsDocument::AddImage(imgIRequest* aImage)
static void
NotifyAudioAvailableListener(nsIContent *aContent, void *aUnused)
{
#ifdef MOZ_MEDIA
nsCOMPtr<nsIDOMHTMLMediaElement> domMediaElem(do_QueryInterface(aContent));
if (domMediaElem) {
HTMLMediaElement* mediaElem = static_cast<HTMLMediaElement*>(aContent);
mediaElem->NotifyAudioAvailableListener();
}
#endif
}
void

View File

@ -24,9 +24,7 @@
#endif
#include "nsBindingManager.h"
#include "nsGenericHTMLElement.h"
#ifdef MOZ_MEDIA
#include "mozilla/dom/HTMLMediaElement.h"
#endif // MOZ_MEDIA
#include "nsWrapperCacheInlines.h"
#include "nsObjectLoadingContent.h"
#include "nsDOMMutationObserver.h"
@ -491,11 +489,9 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
if (elm->MayHavePaintEventListener()) {
window->SetHasPaintEventListeners();
}
#ifdef MOZ_MEDIA
if (elm->MayHaveAudioAvailableEventListener()) {
window->SetHasAudioAvailableEventListeners();
}
#endif
if (elm->MayHaveTouchEventListener()) {
window->SetHasTouchEventListeners();
}
@ -507,13 +503,11 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
}
if (wasRegistered && oldDoc != newDoc) {
#ifdef MOZ_MEDIA
nsCOMPtr<nsIDOMHTMLMediaElement> domMediaElem(do_QueryInterface(aNode));
if (domMediaElem) {
HTMLMediaElement* mediaElem = static_cast<HTMLMediaElement*>(aNode);
mediaElem->NotifyOwnerDocumentActivityChanged();
}
#endif
nsCOMPtr<nsIObjectLoadingContent> objectLoadingContent(do_QueryInterface(aNode));
if (objectLoadingContent) {
nsObjectLoadingContent* olc = static_cast<nsObjectLoadingContent*>(objectLoadingContent.get());

View File

@ -36,9 +36,7 @@ nsIAtom** const kElementsHTML[] = {
&nsGkAtoms::area,
&nsGkAtoms::article,
&nsGkAtoms::aside,
#ifdef MOZ_MEDIA
&nsGkAtoms::audio,
#endif
&nsGkAtoms::b,
&nsGkAtoms::bdi,
&nsGkAtoms::bdo,
@ -116,9 +114,7 @@ nsIAtom** const kElementsHTML[] = {
&nsGkAtoms::section,
&nsGkAtoms::select,
&nsGkAtoms::small,
#ifdef MOZ_MEDIA
&nsGkAtoms::source,
#endif
&nsGkAtoms::span,
&nsGkAtoms::strike,
&nsGkAtoms::strong,
@ -136,16 +132,12 @@ nsIAtom** const kElementsHTML[] = {
&nsGkAtoms::time,
// title checked specially
&nsGkAtoms::tr,
#ifdef MOZ_MEDIA
&nsGkAtoms::track,
#endif
&nsGkAtoms::tt,
&nsGkAtoms::u,
&nsGkAtoms::ul,
&nsGkAtoms::var,
#ifdef MOZ_MEDIA
&nsGkAtoms::video,
#endif
&nsGkAtoms::wbr,
nullptr
};
@ -159,9 +151,7 @@ nsIAtom** const kAttributesHTML[] = {
&nsGkAtoms::alt,
&nsGkAtoms::autocomplete,
&nsGkAtoms::autofocus,
#ifdef MOZ_MEDIA
&nsGkAtoms::autoplay,
#endif
&nsGkAtoms::axis,
&nsGkAtoms::_char,
&nsGkAtoms::charoff,
@ -174,9 +164,7 @@ nsIAtom** const kAttributesHTML[] = {
&nsGkAtoms::content,
&nsGkAtoms::contenteditable,
&nsGkAtoms::contextmenu,
#ifdef MOZ_MEDIA
&nsGkAtoms::controls,
#endif
&nsGkAtoms::coords,
&nsGkAtoms::datetime,
&nsGkAtoms::dir,
@ -205,9 +193,7 @@ nsIAtom** const kAttributesHTML[] = {
&nsGkAtoms::lang,
&nsGkAtoms::list,
&nsGkAtoms::longdesc,
#ifdef MOZ_MEDIA
&nsGkAtoms::loop,
#endif
&nsGkAtoms::low,
&nsGkAtoms::max,
&nsGkAtoms::maxlength,
@ -216,9 +202,7 @@ nsIAtom** const kAttributesHTML[] = {
&nsGkAtoms::min,
&nsGkAtoms::mozdonotsend,
&nsGkAtoms::multiple,
#ifdef MOZ_MEDIA
&nsGkAtoms::muted,
#endif
&nsGkAtoms::name,
&nsGkAtoms::nohref,
&nsGkAtoms::novalidate,
@ -227,13 +211,9 @@ nsIAtom** const kAttributesHTML[] = {
&nsGkAtoms::optimum,
&nsGkAtoms::pattern,
&nsGkAtoms::placeholder,
#ifdef MOZ_MEDIA
&nsGkAtoms::playbackrate,
#endif
#ifdef MOZ_MEDIA
&nsGkAtoms::poster,
&nsGkAtoms::preload,
#endif
&nsGkAtoms::prompt,
&nsGkAtoms::pubdate,
&nsGkAtoms::radiogroup,
@ -1051,14 +1031,10 @@ nsTreeSanitizer::MustPrune(int32_t aNamespace,
nsGkAtoms::datalist == aLocal)) {
return true;
}
if (mDropMedia && (nsGkAtoms::img == aLocal
#ifdef MOZ_MEDIA
||
if (mDropMedia && (nsGkAtoms::img == aLocal ||
nsGkAtoms::video == aLocal ||
nsGkAtoms::audio == aLocal ||
nsGkAtoms::source == aLocal
#endif
)) {
nsGkAtoms::source == aLocal)) {
return true;
}
if (nsGkAtoms::meta == aLocal &&
@ -1298,7 +1274,6 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
i = ac; // i will be decremented immediately thanks to the for loop
}
#ifdef MOZ_MEDIA
// If we've got HTML audio or video, add the controls attribute, because
// otherwise the content is unplayable with scripts removed.
if (aElement->IsHTML(nsGkAtoms::video) ||
@ -1308,7 +1283,6 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
EmptyString(),
false);
}
#endif
}
bool

View File

@ -705,14 +705,12 @@ nsXHTMLContentSerializer::IsShorthandAttr(const nsIAtom* aAttrName,
return true;
}
#ifdef MOZ_MEDIA
// autoplay and controls
if ((aElementName == nsGkAtoms::video || aElementName == nsGkAtoms::audio) &&
(aAttrName == nsGkAtoms::autoplay || aAttrName == nsGkAtoms::muted ||
aAttrName == nsGkAtoms::controls)) {
return true;
}
#endif
return false;
}

View File

@ -262,14 +262,12 @@ nsEventListenerManager::AddEventListenerInternal(
if (window) {
window->SetHasPaintEventListeners();
}
#ifdef MOZ_MEDIA
} else if (aType == NS_MOZAUDIOAVAILABLE) {
mMayHaveAudioAvailableEventListener = true;
nsPIDOMWindow* window = GetInnerWindowForTarget();
if (window) {
window->SetHasAudioAvailableEventListeners();
}
#endif // MOZ_MEDIA
} else if (aType >= NS_MUTATION_START && aType <= NS_MUTATION_END) {
// For mutation listeners, we need to update the global bit on the DOM window.
// Otherwise we won't actually fire the mutation event.

View File

@ -63,6 +63,7 @@ EXPORTS_mozilla/dom = \
HTMLSharedElement.h \
HTMLSharedListElement.h \
HTMLSharedObjectElement.h \
HTMLSourceElement.h \
HTMLSpanElement.h \
HTMLStyleElement.h \
HTMLTableCaptionElement.h \
@ -76,6 +77,7 @@ EXPORTS_mozilla/dom = \
HTMLTimeElement.h \
HTMLTitleElement.h \
HTMLUnknownElement.h \
MediaError.h \
TimeRanges.h \
UndoManager.h \
ValidityState.h \
@ -92,6 +94,7 @@ CPPSRCS = \
HTMLElement.cpp \
HTMLAnchorElement.cpp \
HTMLAreaElement.cpp \
HTMLAudioElement.cpp \
HTMLBRElement.cpp \
HTMLBodyElement.cpp \
HTMLButtonElement.cpp \
@ -114,6 +117,7 @@ CPPSRCS = \
HTMLLegendElement.cpp \
HTMLLinkElement.cpp \
HTMLMapElement.cpp \
HTMLMediaElement.cpp \
HTMLMenuElement.cpp \
HTMLMenuItemElement.cpp \
HTMLMetaElement.cpp \
@ -132,6 +136,7 @@ CPPSRCS = \
HTMLSelectElement.cpp \
HTMLSharedElement.cpp \
HTMLSharedListElement.cpp \
HTMLSourceElement.cpp \
HTMLSpanElement.cpp \
HTMLStyleElement.cpp \
HTMLTableElement.cpp \
@ -144,7 +149,10 @@ CPPSRCS = \
HTMLTextAreaElement.cpp \
HTMLTimeElement.cpp \
HTMLTitleElement.cpp \
HTMLVideoElement.cpp \
HTMLUnknownElement.cpp \
MediaError.cpp \
TimeRanges.cpp \
ValidityState.cpp \
nsIConstraintValidation.cpp \
nsRadioVisitor.cpp \
@ -152,22 +160,6 @@ CPPSRCS = \
UndoManager.cpp \
$(NULL)
ifdef MOZ_MEDIA
EXPORTS_mozilla/dom += \
HTMLSourceElement.h \
MediaError.h \
$(NULL)
CPPSRCS += \
HTMLAudioElement.cpp \
HTMLMediaElement.cpp \
MediaError.cpp \
HTMLSourceElement.cpp \
TimeRanges.cpp \
HTMLVideoElement.cpp \
$(NULL)
endif
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1

View File

@ -1912,9 +1912,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Anchor)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Area)
#if defined(MOZ_MEDIA)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Audio)
#endif
NS_DECLARE_NS_NEW_HTML_ELEMENT(BR)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Body)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Button)
@ -1953,9 +1951,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Progress)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Select)
#if defined(MOZ_MEDIA)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Source)
#endif
NS_DECLARE_NS_NEW_HTML_ELEMENT(Span)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Style)
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableCaption)
@ -1972,9 +1968,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Thead)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Time)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Title)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Unknown)
#if defined(MOZ_MEDIA)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Video)
#endif
inline nsISupports*
ToSupports(nsGenericHTMLElement* aHTMLElement)

View File

@ -345,6 +345,7 @@ MOCHITEST_FILES = \
test_meta_attributes_reflection.html \
test_mod_attributes_reflection.html \
test_mozaudiochannel.html \
test_mozLoadFrom.html \
test_style_attributes_reflection.html \
test_bug629801.html \
test_bug839371.html \
@ -352,12 +353,6 @@ MOCHITEST_FILES = \
test_formData.html \
$(NULL)
ifdef MOZ_MEDIA
MOCHITEST_FILES += \
test_mozLoadFrom.html \
$(NULL)
endif
MOCHITEST_BROWSER_FILES = \
browser_bug649778.js \
file_bug649778.html \

View File

@ -20,12 +20,9 @@ CPPSRCS = \
ImageDocument.cpp \
MediaDocument.cpp \
PluginDocument.cpp \
VideoDocument.cpp \
$(NULL)
ifdef MOZ_MEDIA
CPPSRCS += VideoDocument.cpp
endif
EXPORTS = \
nsIHTMLDocument.h \
$(NULL)

View File

@ -680,10 +680,8 @@ SinkContext::OpenContainer(const nsIParserNode& aNode)
break;
case eHTMLTag_button:
#ifdef MOZ_MEDIA
case eHTMLTag_audio:
case eHTMLTag_video:
#endif
content->DoneCreatingElement();
break;
@ -792,10 +790,8 @@ SinkContext::CloseContainer(const nsHTMLTag aTag)
MOZ_NOT_REACHED("Must not use HTMLContentSink for forms.");
break;
#ifdef MOZ_MEDIA
case eHTMLTag_video:
case eHTMLTag_audio:
#endif
case eHTMLTag_select:
case eHTMLTag_textarea:
case eHTMLTag_object:

View File

@ -10,6 +10,7 @@ PARALLEL_DIRS += [
'events',
'html',
'mathml/content/src',
'media',
'smil',
'svg',
'xml',
@ -18,9 +19,6 @@ PARALLEL_DIRS += [
'xslt',
]
if CONFIG['MOZ_MEDIA']:
PARALLEL_DIRS += ['media']
TEST_TOOL_DIRS += ['test']
MODULE = 'content'

View File

@ -525,10 +525,8 @@ nsXMLContentSink::CloseElement(nsIContent* aContent)
if ((nodeInfo->NamespaceID() == kNameSpaceID_XHTML &&
(nodeInfo->NameAtom() == nsGkAtoms::select ||
nodeInfo->NameAtom() == nsGkAtoms::textarea ||
#ifdef MOZ_MEDIA
nodeInfo->NameAtom() == nsGkAtoms::video ||
nodeInfo->NameAtom() == nsGkAtoms::audio ||
#endif
nodeInfo->NameAtom() == nsGkAtoms::object ||
nodeInfo->NameAtom() == nsGkAtoms::applet))
|| nodeInfo->NameAtom() == nsGkAtoms::title
@ -1028,13 +1026,9 @@ nsXMLContentSink::HandleStartElement(const PRUnichar *aName,
if (nodeInfo->NamespaceID() == kNameSpaceID_XHTML) {
if (nodeInfo->NameAtom() == nsGkAtoms::input ||
nodeInfo->NameAtom() == nsGkAtoms::button ||
nodeInfo->NameAtom() == nsGkAtoms::menuitem
#ifdef MOZ_MEDIA
||
nodeInfo->NameAtom() == nsGkAtoms::menuitem ||
nodeInfo->NameAtom() == nsGkAtoms::audio ||
nodeInfo->NameAtom() == nsGkAtoms::video
#endif
) {
nodeInfo->NameAtom() == nsGkAtoms::video) {
content->DoneCreatingElement();
} else if (nodeInfo->NameAtom() == nsGkAtoms::head && !mCurrentHead) {
mCurrentHead = content;

View File

@ -309,13 +309,9 @@ txMozillaXMLOutput::endElement()
} else if (ns == kNameSpaceID_XHTML &&
(localName == nsGkAtoms::input ||
localName == nsGkAtoms::button ||
localName == nsGkAtoms::menuitem
#ifdef MOZ_MEDIA
||
localName == nsGkAtoms::menuitem ||
localName == nsGkAtoms::audio ||
localName == nsGkAtoms::video
#endif
)) {
localName == nsGkAtoms::video)) {
element->DoneCreatingElement();
}
}