зеркало из https://github.com/mozilla/gecko-dev.git
Bug 825527 - Part 2: Rename nsHTMLImageElement to mozilla::dom::HTMLImageElement; r=bzbarsky
--HG-- rename : content/html/content/src/nsHTMLImageElement.cpp => content/html/content/src/HTMLImageElement.cpp rename : content/html/content/src/nsHTMLImageElement.h => content/html/content/src/HTMLImageElement.h
This commit is contained in:
Родитель
87bbd55993
Коммит
4f58470032
|
@ -94,7 +94,7 @@
|
||||||
#include "nsJSUtils.h"
|
#include "nsJSUtils.h"
|
||||||
#include "XPCQuickStubs.h"
|
#include "XPCQuickStubs.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
#include "nsHTMLImageElement.h"
|
#include "mozilla/dom/HTMLImageElement.h"
|
||||||
#include "nsHTMLVideoElement.h"
|
#include "nsHTMLVideoElement.h"
|
||||||
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
|
#include "mozilla/dom/CanvasRenderingContext2DBinding.h"
|
||||||
#include <cstdlib> // for std::abs(int/long)
|
#include <cstdlib> // for std::abs(int/long)
|
||||||
|
@ -2944,7 +2944,7 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (image.IsHTMLImageElement()) {
|
if (image.IsHTMLImageElement()) {
|
||||||
nsHTMLImageElement* img = image.GetAsHTMLImageElement();
|
HTMLImageElement* img = image.GetAsHTMLImageElement();
|
||||||
element = img;
|
element = img;
|
||||||
} else {
|
} else {
|
||||||
nsHTMLVideoElement* video = image.GetAsHTMLVideoElement();
|
nsHTMLVideoElement* video = image.GetAsHTMLVideoElement();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "mozilla/Util.h"
|
#include "mozilla/Util.h"
|
||||||
|
|
||||||
#include "nsHTMLImageElement.h"
|
#include "mozilla/dom/HTMLImageElement.h"
|
||||||
#include "nsIDOMEventTarget.h"
|
#include "nsIDOMEventTarget.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
|
@ -41,15 +41,12 @@
|
||||||
|
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::dom;
|
|
||||||
|
|
||||||
nsGenericHTMLElement*
|
nsGenericHTMLElement*
|
||||||
NS_NewHTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
NS_NewHTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||||
FromParser aFromParser)
|
mozilla::dom::FromParser aFromParser)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* nsHTMLImageElement's will be created without a nsINodeInfo passed in
|
* HTMLImageElement's will be created without a nsINodeInfo passed in
|
||||||
* if someone says "var img = new Image();" in JavaScript, in a case like
|
* if someone says "var img = new Image();" in JavaScript, in a case like
|
||||||
* that we request the nsINodeInfo from the document's nodeinfo list.
|
* that we request the nsINodeInfo from the document's nodeinfo list.
|
||||||
*/
|
*/
|
||||||
|
@ -65,74 +62,77 @@ NS_NewHTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||||
NS_ENSURE_TRUE(nodeInfo, nullptr);
|
NS_ENSURE_TRUE(nodeInfo, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new nsHTMLImageElement(nodeInfo.forget());
|
return new mozilla::dom::HTMLImageElement(nodeInfo.forget());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsHTMLImageElement::nsHTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
DOMCI_NODE_DATA(HTMLImageElement, mozilla::dom::HTMLImageElement)
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
HTMLImageElement::HTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||||
: nsGenericHTMLElement(aNodeInfo)
|
: nsGenericHTMLElement(aNodeInfo)
|
||||||
{
|
{
|
||||||
// We start out broken
|
// We start out broken
|
||||||
AddStatesSilently(NS_EVENT_STATE_BROKEN);
|
AddStatesSilently(NS_EVENT_STATE_BROKEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsHTMLImageElement::~nsHTMLImageElement()
|
HTMLImageElement::~HTMLImageElement()
|
||||||
{
|
{
|
||||||
DestroyImageLoadingContent();
|
DestroyImageLoadingContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLImageElement, Element)
|
NS_IMPL_ADDREF_INHERITED(HTMLImageElement, Element)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLImageElement, Element)
|
NS_IMPL_RELEASE_INHERITED(HTMLImageElement, Element)
|
||||||
|
|
||||||
|
|
||||||
DOMCI_NODE_DATA(HTMLImageElement, nsHTMLImageElement)
|
// QueryInterface implementation for HTMLImageElement
|
||||||
|
NS_INTERFACE_TABLE_HEAD(HTMLImageElement)
|
||||||
// QueryInterface implementation for nsHTMLImageElement
|
NS_HTML_CONTENT_INTERFACE_TABLE5(HTMLImageElement,
|
||||||
NS_INTERFACE_TABLE_HEAD(nsHTMLImageElement)
|
|
||||||
NS_HTML_CONTENT_INTERFACE_TABLE5(nsHTMLImageElement,
|
|
||||||
nsIDOMHTMLImageElement,
|
nsIDOMHTMLImageElement,
|
||||||
nsIJSNativeInitializer,
|
nsIJSNativeInitializer,
|
||||||
nsIImageLoadingContent,
|
nsIImageLoadingContent,
|
||||||
imgIOnloadBlocker,
|
imgIOnloadBlocker,
|
||||||
imgINotificationObserver)
|
imgINotificationObserver)
|
||||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLImageElement,
|
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLImageElement,
|
||||||
nsGenericHTMLElement)
|
nsGenericHTMLElement)
|
||||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLImageElement)
|
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLImageElement)
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_ELEMENT_CLONE(nsHTMLImageElement)
|
NS_IMPL_ELEMENT_CLONE(HTMLImageElement)
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Name, name)
|
NS_IMPL_STRING_ATTR(HTMLImageElement, Name, name)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Align, align)
|
NS_IMPL_STRING_ATTR(HTMLImageElement, Align, align)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Alt, alt)
|
NS_IMPL_STRING_ATTR(HTMLImageElement, Alt, alt)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Border, border)
|
NS_IMPL_STRING_ATTR(HTMLImageElement, Border, border)
|
||||||
NS_IMPL_INT_ATTR(nsHTMLImageElement, Hspace, hspace)
|
NS_IMPL_INT_ATTR(HTMLImageElement, Hspace, hspace)
|
||||||
NS_IMPL_BOOL_ATTR(nsHTMLImageElement, IsMap, ismap)
|
NS_IMPL_BOOL_ATTR(HTMLImageElement, IsMap, ismap)
|
||||||
NS_IMPL_URI_ATTR(nsHTMLImageElement, LongDesc, longdesc)
|
NS_IMPL_URI_ATTR(HTMLImageElement, LongDesc, longdesc)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Lowsrc, lowsrc)
|
NS_IMPL_STRING_ATTR(HTMLImageElement, Lowsrc, lowsrc)
|
||||||
NS_IMPL_URI_ATTR(nsHTMLImageElement, Src, src)
|
NS_IMPL_URI_ATTR(HTMLImageElement, Src, src)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, UseMap, usemap)
|
NS_IMPL_STRING_ATTR(HTMLImageElement, UseMap, usemap)
|
||||||
NS_IMPL_INT_ATTR(nsHTMLImageElement, Vspace, vspace)
|
NS_IMPL_INT_ATTR(HTMLImageElement, Vspace, vspace)
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHTMLImageElement::GetItemValueText(nsAString& aValue)
|
HTMLImageElement::GetItemValueText(nsAString& aValue)
|
||||||
{
|
{
|
||||||
GetSrc(aValue);
|
GetSrc(aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHTMLImageElement::SetItemValueText(const nsAString& aValue)
|
HTMLImageElement::SetItemValueText(const nsAString& aValue)
|
||||||
{
|
{
|
||||||
SetSrc(aValue);
|
SetSrc(aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// crossorigin is not "limited to only known values" per spec, so it's
|
// crossorigin is not "limited to only known values" per spec, so it's
|
||||||
// just a string attr purposes of the DOM crossOrigin property.
|
// just a string attr purposes of the DOM crossOrigin property.
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, CrossOrigin, crossorigin)
|
NS_IMPL_STRING_ATTR(HTMLImageElement, CrossOrigin, crossorigin)
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsHTMLImageElement::Draggable() const
|
HTMLImageElement::Draggable() const
|
||||||
{
|
{
|
||||||
// images may be dragged unless the draggable attribute is false
|
// images may be dragged unless the draggable attribute is false
|
||||||
return !AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
|
return !AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
|
||||||
|
@ -140,7 +140,7 @@ nsHTMLImageElement::Draggable() const
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::GetComplete(bool* aComplete)
|
HTMLImageElement::GetComplete(bool* aComplete)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aComplete, "Null out param!");
|
NS_PRECONDITION(aComplete, "Null out param!");
|
||||||
*aComplete = true;
|
*aComplete = true;
|
||||||
|
@ -159,7 +159,7 @@ nsHTMLImageElement::GetComplete(bool* aComplete)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntPoint
|
nsIntPoint
|
||||||
nsHTMLImageElement::GetXY()
|
HTMLImageElement::GetXY()
|
||||||
{
|
{
|
||||||
nsIntPoint point(0, 0);
|
nsIntPoint point(0, 0);
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ nsHTMLImageElement::GetXY()
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::GetX(int32_t* aX)
|
HTMLImageElement::GetX(int32_t* aX)
|
||||||
{
|
{
|
||||||
*aX = GetXY().x;
|
*aX = GetXY().x;
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ nsHTMLImageElement::GetX(int32_t* aX)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::GetY(int32_t* aY)
|
HTMLImageElement::GetY(int32_t* aY)
|
||||||
{
|
{
|
||||||
*aY = GetXY().y;
|
*aY = GetXY().y;
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ nsHTMLImageElement::GetY(int32_t* aY)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::GetHeight(uint32_t* aHeight)
|
HTMLImageElement::GetHeight(uint32_t* aHeight)
|
||||||
{
|
{
|
||||||
*aHeight = GetWidthHeightForImage(mCurrentRequest).height;
|
*aHeight = GetWidthHeightForImage(mCurrentRequest).height;
|
||||||
|
|
||||||
|
@ -203,13 +203,13 @@ nsHTMLImageElement::GetHeight(uint32_t* aHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::SetHeight(uint32_t aHeight)
|
HTMLImageElement::SetHeight(uint32_t aHeight)
|
||||||
{
|
{
|
||||||
return nsGenericHTMLElement::SetUnsignedIntAttr(nsGkAtoms::height, aHeight);
|
return nsGenericHTMLElement::SetUnsignedIntAttr(nsGkAtoms::height, aHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::GetWidth(uint32_t* aWidth)
|
HTMLImageElement::GetWidth(uint32_t* aWidth)
|
||||||
{
|
{
|
||||||
*aWidth = GetWidthHeightForImage(mCurrentRequest).width;
|
*aWidth = GetWidthHeightForImage(mCurrentRequest).width;
|
||||||
|
|
||||||
|
@ -217,13 +217,13 @@ nsHTMLImageElement::GetWidth(uint32_t* aWidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::SetWidth(uint32_t aWidth)
|
HTMLImageElement::SetWidth(uint32_t aWidth)
|
||||||
{
|
{
|
||||||
return nsGenericHTMLElement::SetUnsignedIntAttr(nsGkAtoms::width, aWidth);
|
return nsGenericHTMLElement::SetUnsignedIntAttr(nsGkAtoms::width, aWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsHTMLImageElement::ParseAttribute(int32_t aNamespaceID,
|
HTMLImageElement::ParseAttribute(int32_t aNamespaceID,
|
||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
const nsAString& aValue,
|
const nsAString& aValue,
|
||||||
nsAttrValue& aResult)
|
nsAttrValue& aResult)
|
||||||
|
@ -257,7 +257,7 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsChangeHint
|
nsChangeHint
|
||||||
nsHTMLImageElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
HTMLImageElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||||
int32_t aModType) const
|
int32_t aModType) const
|
||||||
{
|
{
|
||||||
nsChangeHint retval =
|
nsChangeHint retval =
|
||||||
|
@ -270,7 +270,7 @@ nsHTMLImageElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(bool)
|
NS_IMETHODIMP_(bool)
|
||||||
nsHTMLImageElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
HTMLImageElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||||
{
|
{
|
||||||
static const MappedAttributeEntry* const map[] = {
|
static const MappedAttributeEntry* const map[] = {
|
||||||
sCommonAttributeMap,
|
sCommonAttributeMap,
|
||||||
|
@ -284,14 +284,14 @@ nsHTMLImageElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||||
|
|
||||||
|
|
||||||
nsMapRuleToAttributesFunc
|
nsMapRuleToAttributesFunc
|
||||||
nsHTMLImageElement::GetAttributeMappingFunction() const
|
HTMLImageElement::GetAttributeMappingFunction() const
|
||||||
{
|
{
|
||||||
return &MapAttributesIntoRule;
|
return &MapAttributesIntoRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLImageElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
HTMLImageElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||||
{
|
{
|
||||||
// If we are a map and get a mouse click, don't let it be handled by
|
// If we are a map and get a mouse click, don't let it be handled by
|
||||||
// the Generic Element as this could cause a click event to fire
|
// the Generic Element as this could cause a click event to fire
|
||||||
|
@ -311,7 +311,7 @@ nsHTMLImageElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nsHTMLImageElement::IsHTMLFocusable(bool aWithMouse,
|
HTMLImageElement::IsHTMLFocusable(bool aWithMouse,
|
||||||
bool *aIsFocusable, int32_t *aTabIndex)
|
bool *aIsFocusable, int32_t *aTabIndex)
|
||||||
{
|
{
|
||||||
int32_t tabIndex = TabIndex();
|
int32_t tabIndex = TabIndex();
|
||||||
|
@ -350,7 +350,7 @@ nsHTMLImageElement::IsHTMLFocusable(bool aWithMouse,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLImageElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
HTMLImageElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||||
nsIAtom* aPrefix, const nsAString& aValue,
|
nsIAtom* aPrefix, const nsAString& aValue,
|
||||||
bool aNotify)
|
bool aNotify)
|
||||||
{
|
{
|
||||||
|
@ -385,7 +385,7 @@ nsHTMLImageElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLImageElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
HTMLImageElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||||
bool aNotify)
|
bool aNotify)
|
||||||
{
|
{
|
||||||
if (aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::src) {
|
if (aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::src) {
|
||||||
|
@ -396,7 +396,7 @@ nsHTMLImageElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||||
nsIContent* aBindingParent,
|
nsIContent* aBindingParent,
|
||||||
bool aCompileEventHandlers)
|
bool aCompileEventHandlers)
|
||||||
{
|
{
|
||||||
|
@ -418,7 +418,7 @@ nsHTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||||
// loading.
|
// loading.
|
||||||
if (LoadingEnabled()) {
|
if (LoadingEnabled()) {
|
||||||
nsContentUtils::AddScriptRunner(
|
nsContentUtils::AddScriptRunner(
|
||||||
NS_NewRunnableMethod(this, &nsHTMLImageElement::MaybeLoadImage));
|
NS_NewRunnableMethod(this, &HTMLImageElement::MaybeLoadImage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,14 +426,14 @@ nsHTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHTMLImageElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
HTMLImageElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||||
{
|
{
|
||||||
nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent);
|
nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent);
|
||||||
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHTMLImageElement::MaybeLoadImage()
|
HTMLImageElement::MaybeLoadImage()
|
||||||
{
|
{
|
||||||
// Our base URI may have changed; claim that our URI changed, and the
|
// Our base URI may have changed; claim that our URI changed, and the
|
||||||
// nsImageLoadingContent will decide whether a new image load is warranted.
|
// nsImageLoadingContent will decide whether a new image load is warranted.
|
||||||
|
@ -447,14 +447,14 @@ nsHTMLImageElement::MaybeLoadImage()
|
||||||
}
|
}
|
||||||
|
|
||||||
nsEventStates
|
nsEventStates
|
||||||
nsHTMLImageElement::IntrinsicState() const
|
HTMLImageElement::IntrinsicState() const
|
||||||
{
|
{
|
||||||
return nsGenericHTMLElement::IntrinsicState() |
|
return nsGenericHTMLElement::IntrinsicState() |
|
||||||
nsImageLoadingContent::ImageState();
|
nsImageLoadingContent::ImageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::Initialize(nsISupports* aOwner, JSContext* aContext,
|
HTMLImageElement::Initialize(nsISupports* aOwner, JSContext* aContext,
|
||||||
JSObject *aObj, uint32_t argc, jsval *argv)
|
JSObject *aObj, uint32_t argc, jsval *argv)
|
||||||
{
|
{
|
||||||
if (argc <= 0) {
|
if (argc <= 0) {
|
||||||
|
@ -483,7 +483,7 @@ nsHTMLImageElement::Initialize(nsISupports* aOwner, JSContext* aContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::GetNaturalHeight(uint32_t* aNaturalHeight)
|
HTMLImageElement::GetNaturalHeight(uint32_t* aNaturalHeight)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aNaturalHeight);
|
NS_ENSURE_ARG_POINTER(aNaturalHeight);
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ nsHTMLImageElement::GetNaturalHeight(uint32_t* aNaturalHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::GetNaturalWidth(uint32_t* aNaturalWidth)
|
HTMLImageElement::GetNaturalWidth(uint32_t* aNaturalWidth)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aNaturalWidth);
|
NS_ENSURE_ARG_POINTER(aNaturalWidth);
|
||||||
|
|
||||||
|
@ -531,16 +531,19 @@ nsHTMLImageElement::GetNaturalWidth(uint32_t* aNaturalWidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLImageElement::CopyInnerTo(Element* aDest)
|
HTMLImageElement::CopyInnerTo(Element* aDest)
|
||||||
{
|
{
|
||||||
if (aDest->OwnerDoc()->IsStaticDocument()) {
|
if (aDest->OwnerDoc()->IsStaticDocument()) {
|
||||||
CreateStaticImageClone(static_cast<nsHTMLImageElement*>(aDest));
|
CreateStaticImageClone(static_cast<HTMLImageElement*>(aDest));
|
||||||
}
|
}
|
||||||
return nsGenericHTMLElement::CopyInnerTo(aDest);
|
return nsGenericHTMLElement::CopyInnerTo(aDest);
|
||||||
}
|
}
|
||||||
|
|
||||||
CORSMode
|
CORSMode
|
||||||
nsHTMLImageElement::GetCORSMode()
|
HTMLImageElement::GetCORSMode()
|
||||||
{
|
{
|
||||||
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
|
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
|
@ -3,22 +3,25 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#ifndef nsHTMLImageElement_h
|
#ifndef mozilla_dom_HTMLImageElement_h
|
||||||
#define nsHTMLImageElement_h
|
#define mozilla_dom_HTMLImageElement_h
|
||||||
|
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "nsImageLoadingContent.h"
|
#include "nsImageLoadingContent.h"
|
||||||
#include "nsIDOMHTMLImageElement.h"
|
#include "nsIDOMHTMLImageElement.h"
|
||||||
#include "nsIJSNativeInitializer.h"
|
#include "nsIJSNativeInitializer.h"
|
||||||
|
|
||||||
class nsHTMLImageElement : public nsGenericHTMLElement,
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
|
||||||
|
class HTMLImageElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||||
public nsImageLoadingContent,
|
public nsImageLoadingContent,
|
||||||
public nsIDOMHTMLImageElement,
|
public nsIDOMHTMLImageElement,
|
||||||
public nsIJSNativeInitializer
|
public nsIJSNativeInitializer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsHTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
explicit HTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||||
virtual ~nsHTMLImageElement();
|
virtual ~HTMLImageElement();
|
||||||
|
|
||||||
// nsISupports
|
// nsISupports
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
@ -38,7 +41,7 @@ public:
|
||||||
NS_DECL_NSIDOMHTMLIMAGEELEMENT
|
NS_DECL_NSIDOMHTMLIMAGEELEMENT
|
||||||
|
|
||||||
// override from nsImageLoadingContent
|
// override from nsImageLoadingContent
|
||||||
mozilla::CORSMode GetCORSMode();
|
CORSMode GetCORSMode();
|
||||||
|
|
||||||
// nsIJSNativeInitializer
|
// nsIJSNativeInitializer
|
||||||
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext,
|
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext,
|
||||||
|
@ -79,7 +82,7 @@ public:
|
||||||
virtual nsEventStates IntrinsicState() const;
|
virtual nsEventStates IntrinsicState() const;
|
||||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||||
|
|
||||||
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
|
nsresult CopyInnerTo(Element* aDest);
|
||||||
|
|
||||||
void MaybeLoadImage();
|
void MaybeLoadImage();
|
||||||
virtual nsXPCClassInfo* GetClassInfo();
|
virtual nsXPCClassInfo* GetClassInfo();
|
||||||
|
@ -90,4 +93,7 @@ protected:
|
||||||
virtual void SetItemValueText(const nsAString& text);
|
virtual void SetItemValueText(const nsAString& text);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* nsHTMLImageElement_h */
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#endif /* mozilla_dom_HTMLImageElement_h */
|
|
@ -36,6 +36,7 @@ EXPORTS_mozilla/dom = \
|
||||||
HTMLFontElement.h \
|
HTMLFontElement.h \
|
||||||
HTMLFrameSetElement.h \
|
HTMLFrameSetElement.h \
|
||||||
HTMLHeadingElement.h \
|
HTMLHeadingElement.h \
|
||||||
|
HTMLImageElement.h \
|
||||||
HTMLLabelElement.h \
|
HTMLLabelElement.h \
|
||||||
HTMLTitleElement.h \
|
HTMLTitleElement.h \
|
||||||
HTMLUnknownElement.h
|
HTMLUnknownElement.h
|
||||||
|
@ -65,7 +66,7 @@ CPPSRCS = \
|
||||||
nsHTMLHRElement.cpp \
|
nsHTMLHRElement.cpp \
|
||||||
HTMLHeadingElement.cpp \
|
HTMLHeadingElement.cpp \
|
||||||
nsHTMLIFrameElement.cpp \
|
nsHTMLIFrameElement.cpp \
|
||||||
nsHTMLImageElement.cpp \
|
HTMLImageElement.cpp \
|
||||||
nsHTMLInputElement.cpp \
|
nsHTMLInputElement.cpp \
|
||||||
nsHTMLLIElement.cpp \
|
nsHTMLLIElement.cpp \
|
||||||
HTMLLabelElement.cpp \
|
HTMLLabelElement.cpp \
|
||||||
|
|
|
@ -1023,7 +1023,6 @@ def addExternalHTMLElement(element):
|
||||||
|
|
||||||
addExternalHTMLElement('HTMLCanvasElement')
|
addExternalHTMLElement('HTMLCanvasElement')
|
||||||
addExternalHTMLElement('HTMLFormElement')
|
addExternalHTMLElement('HTMLFormElement')
|
||||||
addExternalHTMLElement('HTMLImageElement')
|
|
||||||
addExternalHTMLElement('HTMLMenuElement')
|
addExternalHTMLElement('HTMLMenuElement')
|
||||||
addExternalHTMLElement('HTMLOptionElement')
|
addExternalHTMLElement('HTMLOptionElement')
|
||||||
addExternalHTMLElement('HTMLOptGroupElement')
|
addExternalHTMLElement('HTMLOptGroupElement')
|
||||||
|
@ -1041,6 +1040,7 @@ addExternalIface('DOMStringList')
|
||||||
addExternalIface('File')
|
addExternalIface('File')
|
||||||
addExternalIface('HitRegionOptions', nativeType='nsISupports')
|
addExternalIface('HitRegionOptions', nativeType='nsISupports')
|
||||||
addExternalIface('HTMLHeadElement', nativeType='mozilla::dom::Element')
|
addExternalIface('HTMLHeadElement', nativeType='mozilla::dom::Element')
|
||||||
|
addExternalIface('HTMLImageElement', nativeType='mozilla::dom::HTMLImageElement')
|
||||||
addExternalIface('LockedFile')
|
addExternalIface('LockedFile')
|
||||||
addExternalIface('MediaStream')
|
addExternalIface('MediaStream')
|
||||||
addExternalIface('NamedNodeMap')
|
addExternalIface('NamedNodeMap')
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "nsHTMLCanvasElement.h"
|
#include "nsHTMLCanvasElement.h"
|
||||||
#include "nsHTMLFormElement.h"
|
#include "nsHTMLFormElement.h"
|
||||||
#include "nsHTMLImageElement.h"
|
#include "mozilla/dom/HTMLImageElement.h"
|
||||||
#include "nsHTMLOptionElement.h"
|
#include "nsHTMLOptionElement.h"
|
||||||
#include "nsHTMLOptGroupElement.h"
|
#include "nsHTMLOptGroupElement.h"
|
||||||
#include "nsHTMLVideoElement.h"
|
#include "nsHTMLVideoElement.h"
|
||||||
|
@ -170,7 +170,7 @@ xpc_qsUnwrapArg<_clazz>(JSContext *cx, jsval v, _clazz **ppArg, \
|
||||||
|
|
||||||
DEFINE_UNWRAP_CAST_HTML(canvas, nsHTMLCanvasElement)
|
DEFINE_UNWRAP_CAST_HTML(canvas, nsHTMLCanvasElement)
|
||||||
DEFINE_UNWRAP_CAST_HTML(form, nsHTMLFormElement)
|
DEFINE_UNWRAP_CAST_HTML(form, nsHTMLFormElement)
|
||||||
DEFINE_UNWRAP_CAST_HTML(img, nsHTMLImageElement)
|
DEFINE_UNWRAP_CAST_HTML(img, mozilla::dom::HTMLImageElement)
|
||||||
DEFINE_UNWRAP_CAST_HTML(optgroup, nsHTMLOptGroupElement)
|
DEFINE_UNWRAP_CAST_HTML(optgroup, nsHTMLOptGroupElement)
|
||||||
DEFINE_UNWRAP_CAST_HTML(option, nsHTMLOptionElement)
|
DEFINE_UNWRAP_CAST_HTML(option, nsHTMLOptionElement)
|
||||||
DEFINE_UNWRAP_CAST_HTML(video, nsHTMLVideoElement)
|
DEFINE_UNWRAP_CAST_HTML(video, nsHTMLVideoElement)
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
#ifdef MOZ_MEDIA
|
#ifdef MOZ_MEDIA
|
||||||
#include "nsHTMLVideoElement.h"
|
#include "nsHTMLVideoElement.h"
|
||||||
#endif
|
#endif
|
||||||
#include "nsHTMLImageElement.h"
|
#include "mozilla/dom/HTMLImageElement.h"
|
||||||
#include "imgIRequest.h"
|
#include "imgIRequest.h"
|
||||||
#include "nsIImageLoadingContent.h"
|
#include "nsIImageLoadingContent.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
@ -4512,7 +4512,7 @@ nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsLayoutUtils::SurfaceFromElementResult
|
nsLayoutUtils::SurfaceFromElementResult
|
||||||
nsLayoutUtils::SurfaceFromElement(nsHTMLImageElement *aElement,
|
nsLayoutUtils::SurfaceFromElement(HTMLImageElement *aElement,
|
||||||
uint32_t aSurfaceFlags)
|
uint32_t aSurfaceFlags)
|
||||||
{
|
{
|
||||||
return SurfaceFromElement(static_cast<nsIImageLoadingContent*>(aElement),
|
return SurfaceFromElement(static_cast<nsIImageLoadingContent*>(aElement),
|
||||||
|
|
|
@ -21,7 +21,6 @@ class nsFontFaceList;
|
||||||
class nsHTMLCanvasElement;
|
class nsHTMLCanvasElement;
|
||||||
class nsHTMLVideoElement;
|
class nsHTMLVideoElement;
|
||||||
class nsIImageLoadingContent;
|
class nsIImageLoadingContent;
|
||||||
class nsHTMLImageElement;
|
|
||||||
|
|
||||||
#include "nsChangeHint.h"
|
#include "nsChangeHint.h"
|
||||||
#include "nsStyleContext.h"
|
#include "nsStyleContext.h"
|
||||||
|
@ -47,6 +46,7 @@ class gfxDrawable;
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
class Element;
|
class Element;
|
||||||
|
class HTMLImageElement;
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
@ -1471,10 +1471,10 @@ public:
|
||||||
uint32_t aSurfaceFlags = 0);
|
uint32_t aSurfaceFlags = 0);
|
||||||
static SurfaceFromElementResult SurfaceFromElement(nsIImageLoadingContent *aElement,
|
static SurfaceFromElementResult SurfaceFromElement(nsIImageLoadingContent *aElement,
|
||||||
uint32_t aSurfaceFlags = 0);
|
uint32_t aSurfaceFlags = 0);
|
||||||
// Need an nsHTMLImageElement overload, because otherwise the
|
// Need an HTMLImageElement overload, because otherwise the
|
||||||
// nsIImageLoadingContent and mozilla::dom::Element overloads are ambiguous
|
// nsIImageLoadingContent and mozilla::dom::Element overloads are ambiguous
|
||||||
// for nsHTMLImageElement.
|
// for HTMLImageElement.
|
||||||
static SurfaceFromElementResult SurfaceFromElement(nsHTMLImageElement *aElement,
|
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLImageElement *aElement,
|
||||||
uint32_t aSurfaceFlags = 0);
|
uint32_t aSurfaceFlags = 0);
|
||||||
static SurfaceFromElementResult SurfaceFromElement(nsHTMLCanvasElement *aElement,
|
static SurfaceFromElementResult SurfaceFromElement(nsHTMLCanvasElement *aElement,
|
||||||
uint32_t aSurfaceFlags = 0);
|
uint32_t aSurfaceFlags = 0);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче