2015-05-03 19:32:37 +00: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-06-12 22:01:25 +00: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/. */
|
|
|
|
|
2013-02-23 00:59:26 +00:00
|
|
|
#ifndef mozilla_dom_HTMLIFrameElement_h
|
|
|
|
#define mozilla_dom_HTMLIFrameElement_h
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-06-12 22:01:25 +00:00
|
|
|
#include "nsGenericHTMLFrameElement.h"
|
|
|
|
#include "nsIDOMHTMLIFrameElement.h"
|
2016-02-11 22:50:42 +00:00
|
|
|
#include "nsDOMTokenList.h"
|
2012-06-12 22:01:25 +00:00
|
|
|
|
2013-02-23 00:59:26 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class HTMLIFrameElement final : public nsGenericHTMLFrameElement
|
2015-03-27 18:52:19 +00:00
|
|
|
, public nsIDOMHTMLIFrameElement
|
2012-06-12 22:01:25 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit HTMLIFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
|
|
|
FromParser aFromParser = NOT_FROM_PARSER);
|
2012-06-12 22:01:25 +00:00
|
|
|
|
2013-02-23 00:59:26 +00:00
|
|
|
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLIFrameElement, iframe)
|
2012-09-26 14:17:51 +00:00
|
|
|
|
2012-06-12 22:01:25 +00:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2015-01-20 20:39:28 +00:00
|
|
|
// Element
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override
|
2015-01-20 20:39:28 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-06-12 22:01:25 +00:00
|
|
|
// nsIDOMHTMLIFrameElement
|
|
|
|
NS_DECL_NSIDOMHTMLIFRAMEELEMENT
|
|
|
|
|
|
|
|
// nsIContent
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2012-06-12 22:01:25 +00:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsAttrValue& aResult) override;
|
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
|
|
|
|
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
2012-06-12 22:01:25 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
2012-06-12 22:01:25 +00:00
|
|
|
|
2013-06-29 03:13:23 +00:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
const nsAString& aValue, bool aNotify)
|
|
|
|
{
|
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
|
|
|
}
|
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNotify) override;
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2012-08-20 18:34:32 +00:00
|
|
|
const nsAttrValue* aValue,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNotify) override;
|
2013-06-29 03:13:23 +00:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool aNotify) override;
|
2012-08-20 18:34:32 +00:00
|
|
|
|
2013-01-23 19:39:03 +00:00
|
|
|
uint32_t GetSandboxFlags();
|
2012-08-20 18:34:32 +00:00
|
|
|
|
2013-02-27 15:38:32 +00:00
|
|
|
// Web IDL binding methods
|
|
|
|
// The XPCOM GetSrc is fine for our purposes
|
|
|
|
void SetSrc(const nsAString& aSrc, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::src, aSrc, aError);
|
|
|
|
}
|
2013-06-29 03:13:23 +00:00
|
|
|
void GetSrcdoc(DOMString& aSrcdoc)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::srcdoc, aSrcdoc);
|
|
|
|
}
|
|
|
|
void SetSrcdoc(const nsAString& aSrcdoc, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::srcdoc, aSrcdoc, aError);
|
|
|
|
}
|
2013-02-27 15:38:32 +00:00
|
|
|
void GetName(DOMString& aName)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::name, aName);
|
|
|
|
}
|
|
|
|
void SetName(const nsAString& aName, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::name, aName, aError);
|
|
|
|
}
|
2016-02-11 22:50:42 +00:00
|
|
|
nsDOMTokenList* Sandbox()
|
2013-02-27 15:38:32 +00:00
|
|
|
{
|
2016-05-05 03:41:24 +00:00
|
|
|
return GetTokenList(nsGkAtoms::sandbox, sSupportedSandboxTokens);
|
2013-02-27 15:38:32 +00:00
|
|
|
}
|
|
|
|
bool AllowFullscreen() const
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::allowfullscreen);
|
|
|
|
}
|
|
|
|
void SetAllowFullscreen(bool aAllow, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::allowfullscreen, aAllow, aError);
|
|
|
|
}
|
|
|
|
void GetWidth(DOMString& aWidth)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::width, aWidth);
|
|
|
|
}
|
|
|
|
void SetWidth(const nsAString& aWidth, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::width, aWidth, aError);
|
|
|
|
}
|
|
|
|
void GetHeight(DOMString& aHeight)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::height, aHeight);
|
|
|
|
}
|
|
|
|
void SetHeight(const nsAString& aHeight, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::height, aHeight, aError);
|
|
|
|
}
|
|
|
|
using nsGenericHTMLFrameElement::GetContentDocument;
|
|
|
|
using nsGenericHTMLFrameElement::GetContentWindow;
|
|
|
|
void GetAlign(DOMString& aAlign)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::align, aAlign);
|
|
|
|
}
|
|
|
|
void SetAlign(const nsAString& aAlign, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
|
|
|
|
}
|
|
|
|
void GetScrolling(DOMString& aScrolling)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::scrolling, aScrolling);
|
|
|
|
}
|
|
|
|
void SetScrolling(const nsAString& aScrolling, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::scrolling, aScrolling, aError);
|
|
|
|
}
|
|
|
|
void GetFrameBorder(DOMString& aFrameBorder)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::frameborder, aFrameBorder);
|
|
|
|
}
|
|
|
|
void SetFrameBorder(const nsAString& aFrameBorder, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::frameborder, aFrameBorder, aError);
|
|
|
|
}
|
|
|
|
// The XPCOM GetLongDesc is fine
|
|
|
|
void SetLongDesc(const nsAString& aLongDesc, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::longdesc, aLongDesc, aError);
|
|
|
|
}
|
|
|
|
void GetMarginWidth(DOMString& aMarginWidth)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::marginwidth, aMarginWidth);
|
|
|
|
}
|
|
|
|
void SetMarginWidth(const nsAString& aMarginWidth, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::marginwidth, aMarginWidth, aError);
|
|
|
|
}
|
|
|
|
void GetMarginHeight(DOMString& aMarginHeight)
|
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::marginheight, aMarginHeight);
|
|
|
|
}
|
|
|
|
void SetMarginHeight(const nsAString& aMarginHeight, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::marginheight, aMarginHeight, aError);
|
|
|
|
}
|
2015-12-01 00:13:03 +00:00
|
|
|
void SetReferrerPolicy(const nsAString& aReferrer, ErrorResult& aError)
|
2015-07-17 17:46:19 +00:00
|
|
|
{
|
2015-12-01 00:13:03 +00:00
|
|
|
SetHTMLAttr(nsGkAtoms::referrerpolicy, aReferrer, aError);
|
2015-07-17 17:46:19 +00:00
|
|
|
}
|
2015-12-01 00:13:03 +00:00
|
|
|
void GetReferrerPolicy(nsAString& aReferrer)
|
2015-07-17 17:46:19 +00:00
|
|
|
{
|
2016-04-18 10:35:47 +00:00
|
|
|
GetEnumAttr(nsGkAtoms::referrerpolicy, EmptyCString().get(), aReferrer);
|
2015-07-17 17:46:19 +00:00
|
|
|
}
|
2013-02-27 15:38:32 +00:00
|
|
|
nsIDocument* GetSVGDocument()
|
|
|
|
{
|
|
|
|
return GetContentDocument();
|
|
|
|
}
|
|
|
|
bool Mozbrowser() const
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::mozbrowser);
|
|
|
|
}
|
|
|
|
void SetMozbrowser(bool aAllow, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::mozbrowser, aAllow, aError);
|
|
|
|
}
|
|
|
|
using nsGenericHTMLFrameElement::SetMozbrowser;
|
|
|
|
// nsGenericHTMLFrameElement::GetFrameLoader is fine
|
|
|
|
// nsGenericHTMLFrameElement::GetAppManifestURL is fine
|
|
|
|
|
2015-10-08 06:47:39 +00:00
|
|
|
// The fullscreen flag is set to true only when requestFullscreen is
|
|
|
|
// explicitly called on this <iframe> element. In case this flag is
|
|
|
|
// set, the fullscreen state of this element will not be reverted
|
|
|
|
// automatically when its subdocument exits fullscreen.
|
|
|
|
bool FullscreenFlag() const { return mFullscreenFlag; }
|
|
|
|
void SetFullscreenFlag(bool aValue) { mFullscreenFlag = aValue; }
|
|
|
|
|
2012-06-12 22:01:25 +00:00
|
|
|
protected:
|
2014-07-08 21:23:16 +00:00
|
|
|
virtual ~HTMLIFrameElement();
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-11-19 19:21:29 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
2016-05-05 03:41:24 +00:00
|
|
|
|
|
|
|
static const DOMTokenListSupportedToken sSupportedSandboxTokens[];
|
2012-06-12 22:01:25 +00:00
|
|
|
};
|
2013-02-23 00:59:26 +00:00
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|