Bug 839022 - Rename nsHTMLSourceElement to HTMLSourceElement. r=Ms2ger

--HG--
rename : content/html/content/src/nsHTMLSourceElement.cpp => content/html/content/src/HTMLSourceElement.cpp
rename : content/html/content/src/nsHTMLSourceElement.cpp => content/html/content/src/HTMLSourceElement.h
This commit is contained in:
Andrea Marchesini 2013-02-07 10:38:26 -05:00
parent a5e2d190b0
commit c9edd19e18
4 changed files with 143 additions and 126 deletions

View File

@ -0,0 +1,79 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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"
NS_IMPL_NS_NEW_HTML_ELEMENT(Source)
DOMCI_NODE_DATA(HTMLSourceElement, mozilla::dom::HTMLSourceElement)
namespace mozilla {
namespace dom {
HTMLSourceElement::HTMLSourceElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
}
HTMLSourceElement::~HTMLSourceElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLSourceElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLSourceElement, Element)
// QueryInterface implementation for HTMLSourceElement
NS_INTERFACE_TABLE_HEAD(HTMLSourceElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLSourceElement, nsIDOMHTMLSourceElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLSourceElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLSourceElement)
NS_IMPL_ELEMENT_CLONE(HTMLSourceElement)
NS_IMPL_URI_ATTR(HTMLSourceElement, Src, src)
NS_IMPL_STRING_ATTR(HTMLSourceElement, Type, type)
NS_IMPL_STRING_ATTR(HTMLSourceElement, Media, media)
void
HTMLSourceElement::GetItemValueText(nsAString& 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))
return NS_OK;
nsHTMLMediaElement* media = static_cast<nsHTMLMediaElement*>(aParent);
media->NotifyAddedSource();
return NS_OK;
}
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,59 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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/. */
#ifndef mozilla_dom_HTMLSourceElement_h
#define mozilla_dom_HTMLSourceElement_h
#include "nsIDOMHTMLSourceElement.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLMediaElement.h"
namespace mozilla {
namespace dom {
class HTMLSourceElement : public nsGenericHTMLElement,
public nsIDOMHTMLSourceElement
{
public:
HTMLSourceElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLSourceElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLSourceElement
NS_DECL_NSIDOMHTMLSOURCEELEMENT
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
// Override BindToTree() so that we can trigger a load when we add a
// child source element.
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
nsIContent *aBindingParent,
bool aCompileEventHandlers);
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
virtual void GetItemValueText(nsAString& text);
virtual void SetItemValueText(const nsAString& text);
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_HTMLSourceElement_h

View File

@ -132,12 +132,16 @@ CPPSRCS = \
$(NULL)
ifdef MOZ_MEDIA
EXPORTS_mozilla/dom += \
HTMLSourceElement.h \
$(NULL)
CPPSRCS += \
nsHTMLAudioElement.cpp \
nsHTMLMediaElement.cpp \
nsMediaError.cpp \
nsMediaFragmentURIParser.cpp \
nsHTMLSourceElement.cpp \
HTMLSourceElement.cpp \
nsTimeRanges.cpp \
nsHTMLVideoElement.cpp \
$(NULL)

View File

@ -1,125 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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 "nsIDOMHTMLSourceElement.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsMappedAttributes.h"
#include "nsRuleData.h"
#include "nsHTMLMediaElement.h"
#include "nsCOMPtr.h"
#include "nsThreadUtils.h"
using namespace mozilla::dom;
class nsHTMLSourceElement : public nsGenericHTMLElement,
public nsIDOMHTMLSourceElement
{
public:
nsHTMLSourceElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLSourceElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLSourceElement
NS_DECL_NSIDOMHTMLSOURCEELEMENT
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
// Override BindToTree() so that we can trigger a load when we add a
// child source element.
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
nsIContent *aBindingParent,
bool aCompileEventHandlers);
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
virtual void GetItemValueText(nsAString& text);
virtual void SetItemValueText(const nsAString& text);
};
NS_IMPL_NS_NEW_HTML_ELEMENT(Source)
nsHTMLSourceElement::nsHTMLSourceElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
}
nsHTMLSourceElement::~nsHTMLSourceElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLSourceElement, Element)
NS_IMPL_RELEASE_INHERITED(nsHTMLSourceElement, Element)
DOMCI_NODE_DATA(HTMLSourceElement, nsHTMLSourceElement)
// QueryInterface implementation for nsHTMLSourceElement
NS_INTERFACE_TABLE_HEAD(nsHTMLSourceElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLSourceElement, nsIDOMHTMLSourceElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLSourceElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLSourceElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLSourceElement)
NS_IMPL_URI_ATTR(nsHTMLSourceElement, Src, src)
NS_IMPL_STRING_ATTR(nsHTMLSourceElement, Type, type)
NS_IMPL_STRING_ATTR(nsHTMLSourceElement, Media, media)
void
nsHTMLSourceElement::GetItemValueText(nsAString& aValue)
{
GetSrc(aValue);
}
void
nsHTMLSourceElement::SetItemValueText(const nsAString& aValue)
{
SetSrc(aValue);
}
nsresult
nsHTMLSourceElement::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))
return NS_OK;
nsHTMLMediaElement* media = static_cast<nsHTMLMediaElement*>(aParent);
media->NotifyAddedSource();
return NS_OK;
}