2015-05-03 12:32:37 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-31 11:16:48 -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/. */
|
|
|
|
|
2012-12-31 09:25:46 -08:00
|
|
|
#ifndef mozilla_dom_HTMLImageElement_h
|
|
|
|
#define mozilla_dom_HTMLImageElement_h
|
2012-05-31 11:16:48 -07:00
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-05-31 11:16:48 -07:00
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsImageLoadingContent.h"
|
|
|
|
#include "nsIDOMHTMLImageElement.h"
|
2012-12-31 10:48:55 -08:00
|
|
|
#include "imgRequestProxy.h"
|
2013-06-12 00:00:08 -07:00
|
|
|
#include "Units.h"
|
2014-10-13 13:36:01 -07:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2014-05-02 14:32:20 -07:00
|
|
|
|
|
|
|
// Only needed for IsPictureEnabled()
|
|
|
|
#include "mozilla/dom/HTMLPictureElement.h"
|
2012-05-31 11:16:48 -07:00
|
|
|
|
2012-12-31 09:25:46 -08:00
|
|
|
namespace mozilla {
|
2014-03-17 21:48:19 -07:00
|
|
|
class EventChainPreVisitor;
|
2012-12-31 09:25:46 -08:00
|
|
|
namespace dom {
|
|
|
|
|
2014-05-02 14:32:20 -07:00
|
|
|
class ResponsiveImageSelector;
|
2015-03-21 09:28:04 -07:00
|
|
|
class HTMLImageElement final : public nsGenericHTMLElement,
|
2015-03-27 11:52:19 -07:00
|
|
|
public nsImageLoadingContent,
|
|
|
|
public nsIDOMHTMLImageElement
|
2012-05-31 11:16:48 -07:00
|
|
|
{
|
2014-05-02 14:32:20 -07:00
|
|
|
friend class HTMLSourceElement;
|
2014-10-01 20:30:49 -07:00
|
|
|
friend class HTMLPictureElement;
|
|
|
|
friend class ImageLoadTask;
|
2012-05-31 11:16:48 -07:00
|
|
|
public:
|
2014-06-19 19:01:40 -07:00
|
|
|
explicit HTMLImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2012-05-31 11:16:48 -07:00
|
|
|
|
2013-01-22 02:53:13 -08:00
|
|
|
static already_AddRefed<HTMLImageElement>
|
2013-08-22 22:17:08 -07:00
|
|
|
Image(const GlobalObject& aGlobal,
|
|
|
|
const Optional<uint32_t>& aWidth,
|
|
|
|
const Optional<uint32_t>& aHeight,
|
|
|
|
ErrorResult& aError);
|
2013-01-22 02:53:13 -08:00
|
|
|
|
2014-10-13 13:36:01 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLImageElement,
|
|
|
|
nsGenericHTMLElement)
|
|
|
|
|
2012-05-31 11:16:48 -07:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool Draggable() const override;
|
2012-05-31 11:16:48 -07:00
|
|
|
|
2015-01-20 12:39:28 -08:00
|
|
|
// Element
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override;
|
2015-01-20 12:39:28 -08:00
|
|
|
|
2012-05-31 11:16:48 -07:00
|
|
|
// nsIDOMHTMLImageElement
|
|
|
|
NS_DECL_NSIDOMHTMLIMAGEELEMENT
|
|
|
|
|
2014-10-01 20:30:49 -07:00
|
|
|
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLImageElement, img)
|
|
|
|
|
2012-05-31 11:16:48 -07:00
|
|
|
// override from nsImageLoadingContent
|
2015-03-21 09:28:04 -07:00
|
|
|
CORSMode GetCORSMode() override;
|
2012-05-31 11:16:48 -07:00
|
|
|
|
|
|
|
// nsIContent
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2012-05-31 11:16:48 -07:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsAttrValue& aResult) override;
|
2012-05-31 11:16:48 -07:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2015-03-21 09:28:04 -07:00
|
|
|
int32_t aModType) const override;
|
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
|
|
|
|
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
2012-05-31 11:16:48 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) override;
|
2012-05-31 11:16:48 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
|
2012-05-31 11:16:48 -07:00
|
|
|
|
|
|
|
// SetAttr override. C++ is stupid, so have to override both
|
|
|
|
// overloaded methods.
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2012-05-31 11:16:48 -07:00
|
|
|
const nsAString& aValue, bool aNotify)
|
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
2012-05-31 11:16:48 -07:00
|
|
|
}
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2012-05-31 11:16:48 -07:00
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aNotify) override;
|
2012-05-31 11:16:48 -07:00
|
|
|
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aCompileEventHandlers) override;
|
|
|
|
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
2012-05-31 11:16:48 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual EventStates IntrinsicState() const override;
|
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
2012-05-31 11:16:48 -07:00
|
|
|
|
2012-12-31 09:25:46 -08:00
|
|
|
nsresult CopyInnerTo(Element* aDest);
|
2012-05-31 11:16:48 -07:00
|
|
|
|
|
|
|
void MaybeLoadImage();
|
2012-12-31 10:48:55 -08:00
|
|
|
|
2014-05-02 16:26:22 -07:00
|
|
|
static bool IsSrcsetEnabled();
|
|
|
|
|
2012-12-31 10:48:55 -08:00
|
|
|
bool IsMap()
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::ismap);
|
|
|
|
}
|
|
|
|
void SetIsMap(bool aIsMap, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::ismap, aIsMap, aError);
|
|
|
|
}
|
|
|
|
uint32_t Width()
|
|
|
|
{
|
|
|
|
return GetWidthHeightForImage(mCurrentRequest).width;
|
|
|
|
}
|
|
|
|
void SetWidth(uint32_t aWidth, ErrorResult& aError)
|
|
|
|
{
|
2013-04-04 00:03:50 -07:00
|
|
|
SetUnsignedIntAttr(nsGkAtoms::width, aWidth, aError);
|
2012-12-31 10:48:55 -08:00
|
|
|
}
|
|
|
|
uint32_t Height()
|
|
|
|
{
|
|
|
|
return GetWidthHeightForImage(mCurrentRequest).height;
|
|
|
|
}
|
|
|
|
void SetHeight(uint32_t aHeight, ErrorResult& aError)
|
|
|
|
{
|
2013-04-04 00:03:50 -07:00
|
|
|
SetUnsignedIntAttr(nsGkAtoms::height, aHeight, aError);
|
2012-12-31 10:48:55 -08:00
|
|
|
}
|
|
|
|
uint32_t NaturalWidth();
|
|
|
|
uint32_t NaturalHeight();
|
|
|
|
bool Complete();
|
2013-06-23 00:14:15 -07:00
|
|
|
uint32_t Hspace()
|
2012-12-31 10:48:55 -08:00
|
|
|
{
|
2013-06-23 00:14:15 -07:00
|
|
|
return GetUnsignedIntAttr(nsGkAtoms::hspace, 0);
|
2012-12-31 10:48:55 -08:00
|
|
|
}
|
2013-06-23 00:14:15 -07:00
|
|
|
void SetHspace(uint32_t aHspace, ErrorResult& aError)
|
2012-12-31 10:48:55 -08:00
|
|
|
{
|
2013-06-23 00:14:15 -07:00
|
|
|
SetUnsignedIntAttr(nsGkAtoms::hspace, aHspace, aError);
|
2012-12-31 10:48:55 -08:00
|
|
|
}
|
2013-06-23 00:14:15 -07:00
|
|
|
uint32_t Vspace()
|
2012-12-31 10:48:55 -08:00
|
|
|
{
|
2013-06-23 00:14:15 -07:00
|
|
|
return GetUnsignedIntAttr(nsGkAtoms::vspace, 0);
|
2012-12-31 10:48:55 -08:00
|
|
|
}
|
2013-06-23 00:14:15 -07:00
|
|
|
void SetVspace(uint32_t aVspace, ErrorResult& aError)
|
2012-12-31 10:48:55 -08:00
|
|
|
{
|
2013-06-23 00:14:15 -07:00
|
|
|
SetUnsignedIntAttr(nsGkAtoms::vspace, aVspace, aError);
|
2012-12-31 10:48:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// The XPCOM versions of the following getters work for Web IDL bindings as well
|
|
|
|
void SetAlt(const nsAString& aAlt, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::alt, aAlt, aError);
|
|
|
|
}
|
|
|
|
void SetSrc(const nsAString& aSrc, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::src, aSrc, aError);
|
|
|
|
}
|
2014-03-19 14:18:24 -07:00
|
|
|
void SetSrcset(const nsAString& aSrcset, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::srcset, aSrcset, aError);
|
|
|
|
}
|
2014-09-05 19:42:33 -07:00
|
|
|
void GetCrossOrigin(nsAString& aResult)
|
|
|
|
{
|
|
|
|
// Null for both missing and invalid defaults is ok, since we
|
|
|
|
// always parse to an enum value, so we don't need an invalid
|
|
|
|
// default, and we _want_ the missing default to be null.
|
|
|
|
GetEnumAttr(nsGkAtoms::crossorigin, nullptr, aResult);
|
|
|
|
}
|
2012-12-31 10:48:55 -08:00
|
|
|
void SetCrossOrigin(const nsAString& aCrossOrigin, ErrorResult& aError)
|
|
|
|
{
|
2014-09-05 19:42:33 -07:00
|
|
|
SetOrRemoveNullableStringAttr(nsGkAtoms::crossorigin, aCrossOrigin, aError);
|
2012-12-31 10:48:55 -08:00
|
|
|
}
|
|
|
|
void SetUseMap(const nsAString& aUseMap, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::usemap, aUseMap, aError);
|
|
|
|
}
|
|
|
|
void SetName(const nsAString& aName, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::name, aName, aError);
|
|
|
|
}
|
|
|
|
void SetAlign(const nsAString& aAlign, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
|
|
|
}
|
|
|
|
void SetLongDesc(const nsAString& aLongDesc, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::longdesc, aLongDesc, aError);
|
|
|
|
}
|
2014-03-19 14:18:57 -07:00
|
|
|
void SetSizes(const nsAString& aSizes, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::sizes, aSizes, aError);
|
|
|
|
}
|
2012-12-31 10:48:55 -08:00
|
|
|
void SetBorder(const nsAString& aBorder, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::border, aBorder, aError);
|
|
|
|
}
|
2015-11-30 16:13:03 -08:00
|
|
|
void SetReferrerPolicy(const nsAString& aReferrer, ErrorResult& aError)
|
2015-06-05 15:25:24 -07:00
|
|
|
{
|
2015-11-30 16:13:03 -08:00
|
|
|
SetHTMLAttr(nsGkAtoms::referrerpolicy, aReferrer, aError);
|
2015-06-05 15:25:24 -07:00
|
|
|
}
|
2015-11-30 16:13:03 -08:00
|
|
|
void GetReferrerPolicy(nsAString& aReferrer)
|
2015-06-05 15:25:24 -07:00
|
|
|
{
|
2015-11-30 16:13:03 -08:00
|
|
|
GetHTMLAttr(nsGkAtoms::referrerpolicy, aReferrer);
|
2015-06-05 15:25:24 -07:00
|
|
|
}
|
|
|
|
|
2015-07-13 18:04:42 -07:00
|
|
|
net::ReferrerPolicy
|
2015-07-02 16:31:48 -07:00
|
|
|
GetImageReferrerPolicy() override
|
2015-06-05 15:25:24 -07:00
|
|
|
{
|
2015-11-30 16:13:03 -08:00
|
|
|
return GetReferrerPolicyAsEnum();
|
2015-06-05 15:25:24 -07:00
|
|
|
}
|
2012-12-31 10:48:55 -08:00
|
|
|
|
2013-06-02 08:38:25 -07:00
|
|
|
int32_t X();
|
|
|
|
int32_t Y();
|
|
|
|
// Uses XPCOM GetLowsrc.
|
|
|
|
void SetLowsrc(const nsAString& aLowsrc, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::lowsrc, aLowsrc, aError);
|
|
|
|
}
|
|
|
|
|
2013-06-18 05:53:23 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
nsIDOMHTMLFormElement* GetForm() const;
|
|
|
|
#endif
|
|
|
|
void SetForm(nsIDOMHTMLFormElement* aForm);
|
|
|
|
void ClearForm(bool aRemoveFromForm);
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void DestroyContent() override;
|
2014-05-02 16:26:22 -07:00
|
|
|
|
2015-05-11 15:07:49 -07:00
|
|
|
void MediaFeatureValuesChanged();
|
|
|
|
|
2014-12-10 15:53:00 -08:00
|
|
|
/**
|
|
|
|
* Given a hypothetical <img> or <source> tag with the given parameters,
|
|
|
|
* return what URI we would attempt to use, if any. Used by the preloader to
|
|
|
|
* resolve sources prior to DOM creation.
|
|
|
|
*
|
|
|
|
* @param aDocument The document this image would be for, for referencing
|
|
|
|
* viewport width and DPI/zoom
|
|
|
|
* @param aIsSourceTag If these parameters are for a <source> tag (as in a
|
|
|
|
* <picture>) rather than an <img> tag. Note that some attrs are unused
|
|
|
|
* when this is true an vice versa
|
|
|
|
* @param aSrcAttr [ignored if aIsSourceTag] The src attr for this image.
|
|
|
|
* @param aSrcsetAttr The srcset attr for this image/source
|
|
|
|
* @param aSizesAttr The sizes attr for this image/source
|
|
|
|
* @param aTypeAttr [ignored if !aIsSourceTag] The type attr for this source.
|
|
|
|
* Should be a void string to differentiate no type attribute
|
|
|
|
* from an empty one.
|
|
|
|
* @param aMediaAttr [ignored if !aIsSourceTag] The media attr for this
|
|
|
|
* source. Should be a void string to differentiate no
|
|
|
|
* media attribute from an empty one.
|
|
|
|
* @param aResult A reference to store the resulting URL spec in if we
|
|
|
|
* selected a source. This value is not guaranteed to parse to
|
|
|
|
* a valid URL, merely the URL that the tag would attempt to
|
|
|
|
* resolve and load (which may be the empty string). This
|
|
|
|
* parameter is not modified if return value is false.
|
|
|
|
* @return True if we were able to select a final source, false if further
|
|
|
|
* sources would be considered. It follows that this always returns
|
|
|
|
* true if !aIsSourceTag.
|
|
|
|
*
|
|
|
|
* Note that the return value may be true with an empty string as the result,
|
|
|
|
* which implies that the parameters provided describe a tag that would select
|
|
|
|
* no source. This is distinct from a return of false which implies that
|
|
|
|
* further <source> or <img> tags would be considered.
|
|
|
|
*/
|
|
|
|
static bool
|
|
|
|
SelectSourceForTagWithAttrs(nsIDocument *aDocument,
|
|
|
|
bool aIsSourceTag,
|
|
|
|
const nsAString& aSrcAttr,
|
|
|
|
const nsAString& aSrcsetAttr,
|
|
|
|
const nsAString& aSizesAttr,
|
|
|
|
const nsAString& aTypeAttr,
|
|
|
|
const nsAString& aMediaAttr,
|
|
|
|
nsAString& aResult);
|
|
|
|
|
2015-03-17 12:25:35 -07:00
|
|
|
/**
|
|
|
|
* If this image's src pointers to an SVG document, flush the SVG document's
|
|
|
|
* use counters to telemetry. Only used for testing purposes.
|
|
|
|
*/
|
|
|
|
void FlushUseCounters();
|
|
|
|
|
2012-05-31 11:16:48 -07:00
|
|
|
protected:
|
2014-07-08 14:23:16 -07:00
|
|
|
virtual ~HTMLImageElement();
|
|
|
|
|
2014-10-01 20:59:56 -07:00
|
|
|
// Queues a task to run LoadSelectedImage pending stable state.
|
|
|
|
//
|
|
|
|
// Pending Bug 1076583 this is only used by the responsive image
|
|
|
|
// algorithm (InResponsiveMode()) -- synchronous actions when just
|
|
|
|
// using img.src will bypass this, and update source and kick off
|
|
|
|
// image load synchronously.
|
2015-08-31 12:29:40 -07:00
|
|
|
void QueueImageLoadTask(bool aAlwaysLoad);
|
2014-10-01 20:30:49 -07:00
|
|
|
|
2014-10-01 20:59:56 -07:00
|
|
|
// True if we have a srcset attribute or a <picture> parent, regardless of if
|
|
|
|
// any valid responsive sources were parsed from either.
|
|
|
|
bool HaveSrcsetOrInPicture();
|
|
|
|
|
|
|
|
// True if we are using the newer image loading algorithm. This will be the
|
|
|
|
// only mode after Bug 1076583
|
|
|
|
bool InResponsiveMode();
|
|
|
|
|
2014-05-02 16:26:22 -07:00
|
|
|
// Resolve and load the current mResponsiveSelector (responsive mode) or src
|
|
|
|
// attr image.
|
2015-08-31 12:29:40 -07:00
|
|
|
nsresult LoadSelectedImage(bool aForce, bool aNotify, bool aAlwaysLoad);
|
2014-05-02 16:26:22 -07:00
|
|
|
|
2014-12-10 15:53:00 -08:00
|
|
|
// True if this string represents a type we would support on <source type>
|
|
|
|
static bool SupportedPictureSourceType(const nsAString& aType);
|
|
|
|
|
2014-05-02 16:26:22 -07:00
|
|
|
// Update/create/destroy mResponsiveSelector
|
2014-05-02 14:32:20 -07:00
|
|
|
void PictureSourceSrcsetChanged(nsIContent *aSourceNode,
|
|
|
|
const nsAString& aNewValue, bool aNotify);
|
|
|
|
void PictureSourceSizesChanged(nsIContent *aSourceNode,
|
|
|
|
const nsAString& aNewValue, bool aNotify);
|
2014-10-08 14:01:19 -07:00
|
|
|
// As we re-run the source selection on these mutations regardless,
|
|
|
|
// we don't actually care which changed or to what
|
|
|
|
void PictureSourceMediaOrTypeChanged(nsIContent *aSourceNode, bool aNotify);
|
2014-05-02 14:32:20 -07:00
|
|
|
|
|
|
|
void PictureSourceAdded(nsIContent *aSourceNode);
|
|
|
|
// This should be called prior to the unbind, such that nextsibling works
|
|
|
|
void PictureSourceRemoved(nsIContent *aSourceNode);
|
|
|
|
|
2014-10-01 20:30:49 -07:00
|
|
|
// Re-evaluates all source nodes (picture <source>,<img>) and finds
|
|
|
|
// the best source set for mResponsiveSelector. If a better source
|
|
|
|
// is found, creates a new selector and feeds the source to it. If
|
|
|
|
// the current ResponsiveSelector is not changed, runs
|
|
|
|
// SelectImage(true) to re-evaluate its candidates.
|
|
|
|
//
|
|
|
|
// Because keeping the existing selector is the common case (and we
|
|
|
|
// often do no-op reselections), this does not re-parse values for
|
|
|
|
// the existing mResponsiveSelector, meaning you need to update its
|
|
|
|
// parameters as appropriate before calling (or null it out to force
|
|
|
|
// recreation)
|
2015-08-31 12:29:40 -07:00
|
|
|
//
|
|
|
|
// Returns true if the source has changed, and false otherwise.
|
|
|
|
bool UpdateResponsiveSource();
|
2014-05-02 14:32:20 -07:00
|
|
|
|
|
|
|
// Given a <source> node that is a previous sibling *or* ourselves, try to
|
|
|
|
// create a ResponsiveSelector.
|
|
|
|
|
|
|
|
// If the node's srcset/sizes make for an invalid selector, returns
|
|
|
|
// false. This does not guarantee the resulting selector matches an image,
|
|
|
|
// only that it is valid.
|
|
|
|
bool TryCreateResponsiveSelector(nsIContent *aSourceNode,
|
|
|
|
const nsAString *aSrcset = nullptr,
|
|
|
|
const nsAString *aSizes = nullptr);
|
2014-05-02 16:26:22 -07:00
|
|
|
|
2013-06-12 00:00:08 -07:00
|
|
|
CSSIntPoint GetXY();
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void GetItemValueText(DOMString& text) override;
|
|
|
|
virtual void SetItemValueText(const nsAString& text) override;
|
|
|
|
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-06-18 05:53:23 -07:00
|
|
|
void UpdateFormOwner();
|
|
|
|
|
|
|
|
virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2015-07-31 22:14:06 -07:00
|
|
|
nsAttrValueOrString* aValue,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aNotify) override;
|
2013-06-18 05:53:23 -07:00
|
|
|
|
|
|
|
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsAttrValue* aValue, bool aNotify) override;
|
2013-06-18 05:53:23 -07:00
|
|
|
|
|
|
|
// This is a weak reference that this element and the HTMLFormElement
|
|
|
|
// cooperate in maintaining.
|
2013-06-19 07:24:37 -07:00
|
|
|
HTMLFormElement* mForm;
|
2013-11-19 11:21:29 -08:00
|
|
|
|
2014-05-02 16:26:22 -07:00
|
|
|
// Created when we're tracking responsive image state
|
2015-10-17 22:24:48 -07:00
|
|
|
RefPtr<ResponsiveImageSelector> mResponsiveSelector;
|
2014-05-02 16:26:22 -07:00
|
|
|
|
2013-11-19 11:21:29 -08:00
|
|
|
private:
|
2015-05-11 15:07:49 -07:00
|
|
|
bool SourceElementMatches(nsIContent* aSourceNode);
|
|
|
|
|
2013-11-19 11:21:29 -08:00
|
|
|
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
2014-10-01 20:30:49 -07:00
|
|
|
|
2015-08-31 12:29:40 -07:00
|
|
|
bool mInDocResponsiveContent;
|
2014-10-01 20:30:49 -07:00
|
|
|
nsCOMPtr<nsIRunnable> mPendingImageLoadTask;
|
2012-05-31 11:16:48 -07:00
|
|
|
};
|
|
|
|
|
2012-12-31 09:25:46 -08:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_HTMLImageElement_h */
|