2015-05-03 22:32:37 +03: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 22:16:48 +04: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 21:25:46 +04:00
|
|
|
#ifndef mozilla_dom_HTMLImageElement_h
|
|
|
|
#define mozilla_dom_HTMLImageElement_h
|
2012-05-31 22:16:48 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-05-31 22:16:48 +04:00
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsImageLoadingContent.h"
|
|
|
|
#include "nsIDOMHTMLImageElement.h"
|
2012-12-31 22:48:55 +04:00
|
|
|
#include "imgRequestProxy.h"
|
2013-06-12 11:00:08 +04:00
|
|
|
#include "Units.h"
|
2014-10-14 00:36:01 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2014-05-03 01:32:20 +04:00
|
|
|
|
|
|
|
// Only needed for IsPictureEnabled()
|
|
|
|
#include "mozilla/dom/HTMLPictureElement.h"
|
2012-05-31 22:16:48 +04:00
|
|
|
|
2012-12-31 21:25:46 +04:00
|
|
|
namespace mozilla {
|
2014-03-18 08:48:19 +04:00
|
|
|
class EventChainPreVisitor;
|
2012-12-31 21:25:46 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2016-03-30 19:39:59 +03:00
|
|
|
class ImageLoadTask;
|
|
|
|
|
2014-05-03 01:32:20 +04:00
|
|
|
class ResponsiveImageSelector;
|
2015-03-21 19:28:04 +03:00
|
|
|
class HTMLImageElement final : public nsGenericHTMLElement,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsImageLoadingContent,
|
|
|
|
public nsIDOMHTMLImageElement
|
2012-05-31 22:16:48 +04:00
|
|
|
{
|
2014-05-03 01:32:20 +04:00
|
|
|
friend class HTMLSourceElement;
|
2014-10-02 07:30:49 +04:00
|
|
|
friend class HTMLPictureElement;
|
|
|
|
friend class ImageLoadTask;
|
2012-05-31 22:16:48 +04:00
|
|
|
public:
|
2014-06-20 06:01:40 +04:00
|
|
|
explicit HTMLImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2012-05-31 22:16:48 +04:00
|
|
|
|
2013-01-22 14:53:13 +04:00
|
|
|
static already_AddRefed<HTMLImageElement>
|
2013-08-23 09:17:08 +04:00
|
|
|
Image(const GlobalObject& aGlobal,
|
|
|
|
const Optional<uint32_t>& aWidth,
|
|
|
|
const Optional<uint32_t>& aHeight,
|
|
|
|
ErrorResult& aError);
|
2013-01-22 14:53:13 +04:00
|
|
|
|
2014-10-14 00:36:01 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLImageElement,
|
|
|
|
nsGenericHTMLElement)
|
|
|
|
|
2012-05-31 22:16:48 +04:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool Draggable() const override;
|
2012-05-31 22:16:48 +04:00
|
|
|
|
2015-01-20 23:39:28 +03:00
|
|
|
// Element
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override;
|
2015-01-20 23:39:28 +03:00
|
|
|
|
2012-05-31 22:16:48 +04:00
|
|
|
// nsIDOMHTMLImageElement
|
|
|
|
NS_DECL_NSIDOMHTMLIMAGEELEMENT
|
|
|
|
|
2014-10-02 07:30:49 +04:00
|
|
|
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLImageElement, img)
|
|
|
|
|
2012-05-31 22:16:48 +04:00
|
|
|
// override from nsImageLoadingContent
|
2015-03-21 19:28:04 +03:00
|
|
|
CORSMode GetCORSMode() override;
|
2012-05-31 22:16:48 +04:00
|
|
|
|
|
|
|
// nsIContent
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2012-05-31 22:16:48 +04:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsAttrValue& aResult) override;
|
2012-05-31 22:16:48 +04:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) const override;
|
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
|
|
|
|
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
2012-05-31 22:16:48 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) override;
|
2012-05-31 22:16:48 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
|
2012-05-31 22:16:48 +04:00
|
|
|
|
|
|
|
// SetAttr override. C++ is stupid, so have to override both
|
|
|
|
// overloaded methods.
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2012-05-31 22:16:48 +04:00
|
|
|
const nsAString& aValue, bool aNotify)
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
2012-05-31 22:16:48 +04:00
|
|
|
}
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2012-05-31 22:16:48 +04:00
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2012-05-31 22:16:48 +04:00
|
|
|
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aCompileEventHandlers) override;
|
|
|
|
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
2012-05-31 22:16:48 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual EventStates IntrinsicState() const override;
|
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
2012-05-31 22:16:48 +04:00
|
|
|
|
2012-12-31 21:25:46 +04:00
|
|
|
nsresult CopyInnerTo(Element* aDest);
|
2012-05-31 22:16:48 +04:00
|
|
|
|
|
|
|
void MaybeLoadImage();
|
2012-12-31 22:48:55 +04:00
|
|
|
|
2014-05-03 03:26:22 +04:00
|
|
|
static bool IsSrcsetEnabled();
|
|
|
|
|
2012-12-31 22:48:55 +04: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)
|
|
|
|
{
|
2016-05-05 21:29:54 +03:00
|
|
|
SetUnsignedIntAttr(nsGkAtoms::width, aWidth, 0, aError);
|
2012-12-31 22:48:55 +04:00
|
|
|
}
|
|
|
|
uint32_t Height()
|
|
|
|
{
|
|
|
|
return GetWidthHeightForImage(mCurrentRequest).height;
|
|
|
|
}
|
|
|
|
void SetHeight(uint32_t aHeight, ErrorResult& aError)
|
|
|
|
{
|
2016-05-05 21:29:54 +03:00
|
|
|
SetUnsignedIntAttr(nsGkAtoms::height, aHeight, 0, aError);
|
2012-12-31 22:48:55 +04:00
|
|
|
}
|
|
|
|
uint32_t NaturalWidth();
|
|
|
|
uint32_t NaturalHeight();
|
|
|
|
bool Complete();
|
2013-06-23 11:14:15 +04:00
|
|
|
uint32_t Hspace()
|
2012-12-31 22:48:55 +04:00
|
|
|
{
|
2013-06-23 11:14:15 +04:00
|
|
|
return GetUnsignedIntAttr(nsGkAtoms::hspace, 0);
|
2012-12-31 22:48:55 +04:00
|
|
|
}
|
2013-06-23 11:14:15 +04:00
|
|
|
void SetHspace(uint32_t aHspace, ErrorResult& aError)
|
2012-12-31 22:48:55 +04:00
|
|
|
{
|
2016-05-05 21:29:54 +03:00
|
|
|
SetUnsignedIntAttr(nsGkAtoms::hspace, aHspace, 0, aError);
|
2012-12-31 22:48:55 +04:00
|
|
|
}
|
2013-06-23 11:14:15 +04:00
|
|
|
uint32_t Vspace()
|
2012-12-31 22:48:55 +04:00
|
|
|
{
|
2013-06-23 11:14:15 +04:00
|
|
|
return GetUnsignedIntAttr(nsGkAtoms::vspace, 0);
|
2012-12-31 22:48:55 +04:00
|
|
|
}
|
2013-06-23 11:14:15 +04:00
|
|
|
void SetVspace(uint32_t aVspace, ErrorResult& aError)
|
2012-12-31 22:48:55 +04:00
|
|
|
{
|
2016-05-05 21:29:54 +03:00
|
|
|
SetUnsignedIntAttr(nsGkAtoms::vspace, aVspace, 0, aError);
|
2012-12-31 22:48:55 +04: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-20 01:18:24 +04:00
|
|
|
void SetSrcset(const nsAString& aSrcset, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::srcset, aSrcset, aError);
|
|
|
|
}
|
2014-09-06 06:42:33 +04: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 22:48:55 +04:00
|
|
|
void SetCrossOrigin(const nsAString& aCrossOrigin, ErrorResult& aError)
|
|
|
|
{
|
2014-09-06 06:42:33 +04:00
|
|
|
SetOrRemoveNullableStringAttr(nsGkAtoms::crossorigin, aCrossOrigin, aError);
|
2012-12-31 22:48:55 +04: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-20 01:18:57 +04:00
|
|
|
void SetSizes(const nsAString& aSizes, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::sizes, aSizes, aError);
|
|
|
|
}
|
2012-12-31 22:48:55 +04:00
|
|
|
void SetBorder(const nsAString& aBorder, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::border, aBorder, aError);
|
|
|
|
}
|
2015-12-01 03:13:03 +03:00
|
|
|
void SetReferrerPolicy(const nsAString& aReferrer, ErrorResult& aError)
|
2015-06-06 01:25:24 +03:00
|
|
|
{
|
2015-12-01 03:13:03 +03:00
|
|
|
SetHTMLAttr(nsGkAtoms::referrerpolicy, aReferrer, aError);
|
2015-06-06 01:25:24 +03:00
|
|
|
}
|
2015-12-01 03:13:03 +03:00
|
|
|
void GetReferrerPolicy(nsAString& aReferrer)
|
2015-06-06 01:25:24 +03:00
|
|
|
{
|
2016-04-18 13:35:47 +03:00
|
|
|
GetEnumAttr(nsGkAtoms::referrerpolicy, EmptyCString().get(), aReferrer);
|
2015-06-06 01:25:24 +03:00
|
|
|
}
|
|
|
|
|
2015-07-14 04:04:42 +03:00
|
|
|
net::ReferrerPolicy
|
2015-07-03 02:31:48 +03:00
|
|
|
GetImageReferrerPolicy() override
|
2015-06-06 01:25:24 +03:00
|
|
|
{
|
2015-12-01 03:13:03 +03:00
|
|
|
return GetReferrerPolicyAsEnum();
|
2015-06-06 01:25:24 +03:00
|
|
|
}
|
2012-12-31 22:48:55 +04:00
|
|
|
|
2013-06-02 19:38:25 +04: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 16:53:23 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
nsIDOMHTMLFormElement* GetForm() const;
|
|
|
|
#endif
|
|
|
|
void SetForm(nsIDOMHTMLFormElement* aForm);
|
|
|
|
void ClearForm(bool aRemoveFromForm);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DestroyContent() override;
|
2014-05-03 03:26:22 +04:00
|
|
|
|
2015-05-12 01:07:49 +03:00
|
|
|
void MediaFeatureValuesChanged();
|
|
|
|
|
2014-12-11 02:53:00 +03: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 22:25:35 +03: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 22:16:48 +04:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~HTMLImageElement();
|
|
|
|
|
2014-10-02 07:59:56 +04: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 22:29:40 +03:00
|
|
|
void QueueImageLoadTask(bool aAlwaysLoad);
|
2014-10-02 07:30:49 +04:00
|
|
|
|
2014-10-02 07:59:56 +04: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-03 03:26:22 +04:00
|
|
|
// Resolve and load the current mResponsiveSelector (responsive mode) or src
|
|
|
|
// attr image.
|
2015-08-31 22:29:40 +03:00
|
|
|
nsresult LoadSelectedImage(bool aForce, bool aNotify, bool aAlwaysLoad);
|
2014-05-03 03:26:22 +04:00
|
|
|
|
2014-12-11 02:53:00 +03:00
|
|
|
// True if this string represents a type we would support on <source type>
|
|
|
|
static bool SupportedPictureSourceType(const nsAString& aType);
|
|
|
|
|
2014-05-03 03:26:22 +04:00
|
|
|
// Update/create/destroy mResponsiveSelector
|
2014-05-03 01:32:20 +04:00
|
|
|
void PictureSourceSrcsetChanged(nsIContent *aSourceNode,
|
|
|
|
const nsAString& aNewValue, bool aNotify);
|
|
|
|
void PictureSourceSizesChanged(nsIContent *aSourceNode,
|
|
|
|
const nsAString& aNewValue, bool aNotify);
|
2014-10-09 01:01:19 +04: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-03 01:32:20 +04:00
|
|
|
|
|
|
|
void PictureSourceAdded(nsIContent *aSourceNode);
|
|
|
|
// This should be called prior to the unbind, such that nextsibling works
|
|
|
|
void PictureSourceRemoved(nsIContent *aSourceNode);
|
|
|
|
|
2014-10-02 07:30:49 +04: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 22:29:40 +03:00
|
|
|
//
|
|
|
|
// Returns true if the source has changed, and false otherwise.
|
|
|
|
bool UpdateResponsiveSource();
|
2014-05-03 01:32:20 +04: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-03 03:26:22 +04:00
|
|
|
|
2013-06-12 11:00:08 +04:00
|
|
|
CSSIntPoint GetXY();
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-06-18 16:53:23 +04:00
|
|
|
void UpdateFormOwner();
|
|
|
|
|
|
|
|
virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2015-08-01 08:14:06 +03:00
|
|
|
nsAttrValueOrString* aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2013-06-18 16:53:23 +04:00
|
|
|
|
|
|
|
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsAttrValue* aValue, bool aNotify) override;
|
2013-06-18 16:53:23 +04:00
|
|
|
|
|
|
|
// This is a weak reference that this element and the HTMLFormElement
|
|
|
|
// cooperate in maintaining.
|
2013-06-19 18:24:37 +04:00
|
|
|
HTMLFormElement* mForm;
|
2013-11-19 23:21:29 +04:00
|
|
|
|
2014-05-03 03:26:22 +04:00
|
|
|
// Created when we're tracking responsive image state
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ResponsiveImageSelector> mResponsiveSelector;
|
2014-05-03 03:26:22 +04:00
|
|
|
|
2013-11-19 23:21:29 +04:00
|
|
|
private:
|
2015-05-12 01:07:49 +03:00
|
|
|
bool SourceElementMatches(nsIContent* aSourceNode);
|
|
|
|
|
2013-11-19 23:21:29 +04:00
|
|
|
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
2014-10-02 07:30:49 +04:00
|
|
|
|
2015-08-31 22:29:40 +03:00
|
|
|
bool mInDocResponsiveContent;
|
2016-03-30 19:39:59 +03:00
|
|
|
RefPtr<ImageLoadTask> mPendingImageLoadTask;
|
2012-05-31 22:16:48 +04:00
|
|
|
};
|
|
|
|
|
2012-12-31 21:25:46 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* mozilla_dom_HTMLImageElement_h */
|