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-21 04:12:37 -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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifndef nsGenericHTMLElement_h___
|
|
|
|
#define nsGenericHTMLElement_h___
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2008-01-09 01:38:28 -08:00
|
|
|
#include "nsMappedAttributeElement.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDOMHTMLElement.h"
|
2014-02-27 15:04:46 -08:00
|
|
|
#include "nsNameSpaceManager.h" // for kNameSpaceID_None
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIFormControl.h"
|
2007-06-27 19:48:16 -07:00
|
|
|
#include "nsGkAtoms.h"
|
2010-08-17 07:13:55 -07:00
|
|
|
#include "nsContentCreatorFunctions.h"
|
2012-10-06 00:19:51 -07:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2012-11-10 15:30:15 -08:00
|
|
|
#include "nsIDOMHTMLMenuElement.h"
|
2013-09-20 03:21:03 -07:00
|
|
|
#include "mozilla/dom/DOMRect.h"
|
2013-01-16 10:01:01 -08:00
|
|
|
#include "mozilla/dom/ValidityState.h"
|
2013-10-02 13:09:18 -07:00
|
|
|
#include "mozilla/dom/ElementInlines.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-03-19 06:05:17 -07:00
|
|
|
class nsDOMSettableTokenList;
|
|
|
|
class nsIDOMHTMLMenuElement;
|
|
|
|
class nsIEditor;
|
|
|
|
class nsIFormControlFrame;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIFrame;
|
2014-03-19 06:05:17 -07:00
|
|
|
class nsILayoutHistoryState;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIURI;
|
|
|
|
class nsPresState;
|
|
|
|
struct nsSize;
|
2012-12-08 14:06:42 -08:00
|
|
|
|
2012-11-10 15:30:15 -08:00
|
|
|
namespace mozilla {
|
2014-03-17 21:48:20 -07:00
|
|
|
class EventChainPostVisitor;
|
2014-03-17 21:48:19 -07:00
|
|
|
class EventChainPreVisitor;
|
2014-03-17 21:48:18 -07:00
|
|
|
class EventChainVisitor;
|
2014-03-16 23:56:53 -07:00
|
|
|
class EventListenerManager;
|
2014-04-02 21:18:36 -07:00
|
|
|
class EventStates;
|
2013-09-20 03:21:03 -07:00
|
|
|
namespace dom {
|
2013-06-19 07:24:37 -07:00
|
|
|
class HTMLFormElement;
|
2012-11-10 15:30:15 -08:00
|
|
|
class HTMLPropertiesCollection;
|
2013-02-18 03:59:08 -08:00
|
|
|
class HTMLMenuElement;
|
2012-11-10 15:30:15 -08:00
|
|
|
}
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-01-09 01:38:28 -08:00
|
|
|
typedef nsMappedAttributeElement nsGenericHTMLElementBase;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A common superclass for HTML elements
|
|
|
|
*/
|
2013-08-07 13:23:08 -07:00
|
|
|
class nsGenericHTMLElement : public nsGenericHTMLElementBase,
|
|
|
|
public nsIDOMHTMLElement
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-08-05 06:19:51 -07:00
|
|
|
explicit nsGenericHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2013-11-20 12:23:43 -08:00
|
|
|
: nsGenericHTMLElementBase(aNodeInfo),
|
|
|
|
mScrollgrab(false)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2010-07-23 02:49:57 -07:00
|
|
|
NS_ASSERTION(mNodeInfo->NamespaceID() == kNameSpaceID_XHTML,
|
2009-10-01 13:17:26 -07:00
|
|
|
"Unexpected namespace");
|
2012-08-09 20:37:58 -07:00
|
|
|
AddStatesSilently(NS_EVENT_STATE_LTR);
|
2012-04-16 21:03:10 -07:00
|
|
|
SetFlags(NODE_HAS_DIRECTION_LTR);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2013-08-07 13:23:08 -07:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-07 13:23:08 -07:00
|
|
|
NS_IMPL_FROMCONTENT(nsGenericHTMLElement, kNameSpaceID_XHTML)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-11-14 14:10:08 -08:00
|
|
|
// From Element
|
|
|
|
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-02-12 17:27:39 -08:00
|
|
|
void GetTitle(mozilla::dom::DOMString& aTitle)
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::title, aTitle);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHODIMP SetTitle(const nsAString& aTitle) override
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::title, aTitle);
|
2013-08-07 13:23:08 -07:00
|
|
|
return NS_OK;
|
2012-11-10 15:30:15 -08:00
|
|
|
}
|
2015-02-12 17:27:39 -08:00
|
|
|
void GetLang(mozilla::dom::DOMString& aLang)
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::lang, aLang);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHODIMP SetLang(const nsAString& aLang) override
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::lang, aLang);
|
2013-08-07 13:23:08 -07:00
|
|
|
return NS_OK;
|
2012-11-10 15:30:15 -08:00
|
|
|
}
|
2015-02-12 17:27:39 -08:00
|
|
|
void GetDir(mozilla::dom::DOMString& aDir)
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
|
|
|
GetHTMLEnumAttr(nsGkAtoms::dir, aDir);
|
|
|
|
}
|
|
|
|
void SetDir(const nsAString& aDir, mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::dir, aDir, aError);
|
|
|
|
}
|
|
|
|
already_AddRefed<nsDOMStringMap> Dataset();
|
|
|
|
bool ItemScope() const
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::itemscope);
|
|
|
|
}
|
|
|
|
void SetItemScope(bool aItemScope, mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::itemscope, aItemScope, aError);
|
|
|
|
}
|
|
|
|
nsDOMSettableTokenList* ItemType()
|
|
|
|
{
|
|
|
|
return GetTokenList(nsGkAtoms::itemtype);
|
|
|
|
}
|
2013-08-07 13:23:08 -07:00
|
|
|
void GetItemId(nsString& aItemId)
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
|
|
|
GetHTMLURIAttr(nsGkAtoms::itemid, aItemId);
|
|
|
|
}
|
|
|
|
void SetItemId(const nsAString& aItemID, mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::itemid, aItemID, aError);
|
|
|
|
}
|
|
|
|
nsDOMSettableTokenList* ItemRef()
|
|
|
|
{
|
|
|
|
return GetTokenList(nsGkAtoms::itemref);
|
|
|
|
}
|
|
|
|
nsDOMSettableTokenList* ItemProp()
|
|
|
|
{
|
|
|
|
return GetTokenList(nsGkAtoms::itemprop);
|
|
|
|
}
|
|
|
|
mozilla::dom::HTMLPropertiesCollection* Properties();
|
2014-06-11 13:26:52 -07:00
|
|
|
void GetItemValue(JSContext* aCx, JSObject* aScope,
|
|
|
|
JS::MutableHandle<JS::Value> aRetval,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void GetItemValue(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
|
|
|
|
mozilla::ErrorResult& aError)
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
2014-06-11 13:26:52 -07:00
|
|
|
GetItemValue(aCx, GetWrapperPreserveColor(), aRetval, aError);
|
2012-11-10 15:30:15 -08:00
|
|
|
}
|
|
|
|
void SetItemValue(JSContext* aCx, JS::Value aValue,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
bool Hidden() const
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::hidden);
|
|
|
|
}
|
|
|
|
void SetHidden(bool aHidden, mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::hidden, aHidden, aError);
|
|
|
|
}
|
2012-10-06 00:19:52 -07:00
|
|
|
virtual void Click();
|
2012-10-06 00:19:51 -07:00
|
|
|
virtual int32_t TabIndexDefault()
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
int32_t TabIndex()
|
|
|
|
{
|
|
|
|
return GetIntAttr(nsGkAtoms::tabindex, TabIndexDefault());
|
|
|
|
}
|
|
|
|
void SetTabIndex(int32_t aTabIndex, mozilla::ErrorResult& aError)
|
|
|
|
{
|
2012-11-10 15:30:15 -08:00
|
|
|
SetHTMLIntAttr(nsGkAtoms::tabindex, aTabIndex, aError);
|
2012-10-06 00:19:51 -07:00
|
|
|
}
|
2012-10-06 00:19:52 -07:00
|
|
|
virtual void Focus(mozilla::ErrorResult& aError);
|
2011-06-21 07:13:12 -07:00
|
|
|
virtual void Blur(mozilla::ErrorResult& aError);
|
2013-08-07 13:23:08 -07:00
|
|
|
void GetAccessKey(nsString& aAccessKey)
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::accesskey, aAccessKey);
|
|
|
|
}
|
|
|
|
void SetAccessKey(const nsAString& aAccessKey, mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::accesskey, aAccessKey, aError);
|
|
|
|
}
|
2013-08-07 13:23:08 -07:00
|
|
|
void GetAccessKeyLabel(nsString& aAccessKeyLabel);
|
2012-10-06 00:19:52 -07:00
|
|
|
virtual bool Draggable() const
|
|
|
|
{
|
|
|
|
return AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
|
|
|
|
nsGkAtoms::_true, eIgnoreCase);
|
|
|
|
}
|
|
|
|
void SetDraggable(bool aDraggable, mozilla::ErrorResult& aError)
|
|
|
|
{
|
2012-11-10 15:30:15 -08:00
|
|
|
SetHTMLAttr(nsGkAtoms::draggable,
|
|
|
|
aDraggable ? NS_LITERAL_STRING("true")
|
|
|
|
: NS_LITERAL_STRING("false"),
|
|
|
|
aError);
|
2012-11-10 15:30:15 -08:00
|
|
|
}
|
2013-08-07 13:23:08 -07:00
|
|
|
void GetContentEditable(nsString& aContentEditable)
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
2012-11-10 15:30:15 -08:00
|
|
|
ContentEditableTristate value = GetContentEditableValue();
|
|
|
|
if (value == eTrue) {
|
|
|
|
aContentEditable.AssignLiteral("true");
|
|
|
|
} else if (value == eFalse) {
|
|
|
|
aContentEditable.AssignLiteral("false");
|
|
|
|
} else {
|
|
|
|
aContentEditable.AssignLiteral("inherit");
|
|
|
|
}
|
2012-10-06 00:19:52 -07:00
|
|
|
}
|
2012-11-10 15:30:15 -08:00
|
|
|
void SetContentEditable(const nsAString& aContentEditable,
|
|
|
|
mozilla::ErrorResult& aError)
|
2012-10-06 00:19:52 -07:00
|
|
|
{
|
2013-01-12 12:47:45 -08:00
|
|
|
if (aContentEditable.LowerCaseEqualsLiteral("inherit")) {
|
2012-11-10 15:30:15 -08:00
|
|
|
UnsetHTMLAttr(nsGkAtoms::contenteditable, aError);
|
2013-01-12 12:47:45 -08:00
|
|
|
} else if (aContentEditable.LowerCaseEqualsLiteral("true")) {
|
2012-11-10 15:30:15 -08:00
|
|
|
SetHTMLAttr(nsGkAtoms::contenteditable, NS_LITERAL_STRING("true"), aError);
|
2013-01-12 12:47:45 -08:00
|
|
|
} else if (aContentEditable.LowerCaseEqualsLiteral("false")) {
|
2012-11-10 15:30:15 -08:00
|
|
|
SetHTMLAttr(nsGkAtoms::contenteditable, NS_LITERAL_STRING("false"), aError);
|
|
|
|
} else {
|
|
|
|
aError.Throw(NS_ERROR_DOM_SYNTAX_ERR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bool IsContentEditable()
|
|
|
|
{
|
|
|
|
for (nsIContent* node = this; node; node = node->GetParent()) {
|
|
|
|
nsGenericHTMLElement* element = FromContent(node);
|
|
|
|
if (element) {
|
|
|
|
ContentEditableTristate value = element->GetContentEditableValue();
|
|
|
|
if (value != eInherit) {
|
|
|
|
return value == eTrue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2012-10-06 00:19:52 -07:00
|
|
|
}
|
2013-02-18 03:59:08 -08:00
|
|
|
mozilla::dom::HTMLMenuElement* GetContextMenu() const;
|
2012-11-10 15:30:15 -08:00
|
|
|
bool Spellcheck();
|
|
|
|
void SetSpellcheck(bool aSpellcheck, mozilla::ErrorResult& aError)
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
2012-11-10 15:30:15 -08:00
|
|
|
SetHTMLAttr(nsGkAtoms::spellcheck,
|
|
|
|
aSpellcheck ? NS_LITERAL_STRING("true")
|
|
|
|
: NS_LITERAL_STRING("false"),
|
|
|
|
aError);
|
2012-11-10 15:30:15 -08:00
|
|
|
}
|
2013-11-20 12:23:43 -08:00
|
|
|
bool Scrollgrab() const
|
|
|
|
{
|
|
|
|
return mScrollgrab;
|
|
|
|
}
|
|
|
|
void SetScrollgrab(bool aValue)
|
|
|
|
{
|
|
|
|
mScrollgrab = aValue;
|
|
|
|
}
|
2013-01-02 12:24:07 -08:00
|
|
|
|
2013-01-07 19:22:41 -08:00
|
|
|
/**
|
|
|
|
* Determine whether an attribute is an event (onclick, etc.)
|
|
|
|
* @param aName the attribute
|
|
|
|
* @return whether the name is an event handler name
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsEventAttributeName(nsIAtom* aName) override;
|
2013-01-02 12:24:07 -08:00
|
|
|
|
2012-11-26 06:19:02 -08:00
|
|
|
#define EVENT(name_, id_, type_, struct_) /* nothing; handled by nsINode */
|
|
|
|
// The using nsINode::Get/SetOn* are to avoid warnings about shadowing the XPCOM
|
|
|
|
// getter and setter on nsINode.
|
|
|
|
#define FORWARDED_EVENT(name_, id_, type_, struct_) \
|
|
|
|
using nsINode::GetOn##name_; \
|
|
|
|
using nsINode::SetOn##name_; \
|
|
|
|
mozilla::dom::EventHandlerNonNull* GetOn##name_(); \
|
2013-09-17 04:01:28 -07:00
|
|
|
void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler);
|
2012-11-26 06:19:02 -08:00
|
|
|
#define ERROR_EVENT(name_, id_, type_, struct_) \
|
|
|
|
using nsINode::GetOn##name_; \
|
|
|
|
using nsINode::SetOn##name_; \
|
|
|
|
already_AddRefed<mozilla::dom::EventHandlerNonNull> GetOn##name_(); \
|
2013-09-17 04:01:28 -07:00
|
|
|
void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler);
|
2014-04-01 04:42:12 -07:00
|
|
|
#include "mozilla/EventNameList.h" // IWYU pragma: keep
|
2012-11-26 06:19:02 -08:00
|
|
|
#undef ERROR_EVENT
|
|
|
|
#undef FORWARDED_EVENT
|
|
|
|
#undef EVENT
|
2012-11-14 14:10:08 -08:00
|
|
|
mozilla::dom::Element* GetOffsetParent()
|
2012-11-10 15:30:15 -08:00
|
|
|
{
|
2013-06-12 00:00:08 -07:00
|
|
|
mozilla::CSSIntRect rcFrame;
|
2012-11-10 15:30:15 -08:00
|
|
|
return GetOffsetRect(rcFrame);
|
2012-10-06 00:19:52 -07:00
|
|
|
}
|
2012-11-10 15:30:15 -08:00
|
|
|
int32_t OffsetTop()
|
2012-10-06 00:19:52 -07:00
|
|
|
{
|
2013-06-12 00:00:08 -07:00
|
|
|
mozilla::CSSIntRect rcFrame;
|
2012-11-10 15:30:15 -08:00
|
|
|
GetOffsetRect(rcFrame);
|
|
|
|
|
|
|
|
return rcFrame.y;
|
2012-11-10 15:30:15 -08:00
|
|
|
}
|
2012-11-10 15:30:15 -08:00
|
|
|
int32_t OffsetLeft()
|
|
|
|
{
|
2013-06-12 00:00:08 -07:00
|
|
|
mozilla::CSSIntRect rcFrame;
|
2012-11-10 15:30:15 -08:00
|
|
|
GetOffsetRect(rcFrame);
|
2012-11-10 15:30:15 -08:00
|
|
|
|
2012-11-10 15:30:15 -08:00
|
|
|
return rcFrame.x;
|
|
|
|
}
|
|
|
|
int32_t OffsetWidth()
|
2012-11-14 08:45:28 -08:00
|
|
|
{
|
2013-06-12 00:00:08 -07:00
|
|
|
mozilla::CSSIntRect rcFrame;
|
2012-11-10 15:30:15 -08:00
|
|
|
GetOffsetRect(rcFrame);
|
|
|
|
|
|
|
|
return rcFrame.width;
|
2012-11-14 08:45:28 -08:00
|
|
|
}
|
2012-11-10 15:30:15 -08:00
|
|
|
int32_t OffsetHeight()
|
2012-11-14 08:45:28 -08:00
|
|
|
{
|
2013-06-12 00:00:08 -07:00
|
|
|
mozilla::CSSIntRect rcFrame;
|
2012-11-10 15:30:15 -08:00
|
|
|
GetOffsetRect(rcFrame);
|
|
|
|
|
|
|
|
return rcFrame.height;
|
|
|
|
}
|
|
|
|
|
2015-03-03 03:09:01 -08:00
|
|
|
// These methods are already implemented in nsIContent but we want something
|
|
|
|
// faster for HTMLElements ignoring the namespace checking.
|
|
|
|
// This is safe because we already know that we are in the HTML namespace.
|
|
|
|
inline bool IsHTMLElement() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool IsHTMLElement(nsIAtom* aTag) const
|
|
|
|
{
|
|
|
|
return mNodeInfo->Equals(aTag);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename First, typename... Args>
|
|
|
|
inline bool IsAnyOfHTMLElements(First aFirst, Args... aArgs) const
|
|
|
|
{
|
|
|
|
return IsNodeInternal(aFirst, aArgs...);
|
|
|
|
}
|
|
|
|
|
2012-06-04 16:49:57 -07:00
|
|
|
protected:
|
2014-07-08 14:23:16 -07:00
|
|
|
virtual ~nsGenericHTMLElement() {}
|
|
|
|
|
2012-06-04 16:49:57 -07:00
|
|
|
// These methods are used to implement element-specific behavior of Get/SetItemValue
|
|
|
|
// when an element has @itemprop but no @itemscope.
|
2015-02-12 17:27:39 -08:00
|
|
|
virtual void GetItemValueText(mozilla::dom::DOMString& text);
|
2012-06-04 16:49:57 -07:00
|
|
|
virtual void SetItemValueText(const nsAString& text);
|
|
|
|
public:
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual already_AddRefed<mozilla::dom::UndoManager> GetUndoManager() override;
|
|
|
|
virtual bool UndoScope() override;
|
|
|
|
virtual void SetUndoScope(bool aUndoScope, mozilla::ErrorResult& aError) override;
|
2011-05-20 10:23:49 -07:00
|
|
|
// Callback for destructor of of dataset to ensure to null out weak pointer.
|
|
|
|
nsresult ClearDataset();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-26 22:17:31 -07:00
|
|
|
/**
|
|
|
|
* Get width and height, using given image request if attributes are unset.
|
2014-03-26 11:43:27 -07:00
|
|
|
* Pass a reference to the image request, since the method may change the
|
|
|
|
* value and we want to use the updated value.
|
2012-06-26 22:17:31 -07:00
|
|
|
*/
|
2014-03-26 11:43:27 -07:00
|
|
|
nsSize GetWidthHeightForImage(nsRefPtr<imgRequestProxy>& aImageRequest);
|
2012-06-26 22:17:31 -07:00
|
|
|
|
2013-08-07 13:23:08 -07:00
|
|
|
// XPIDL methods
|
|
|
|
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
|
|
|
|
|
|
|
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetTitle(nsAString& aTitle) final override {
|
2015-02-12 17:27:39 -08:00
|
|
|
mozilla::dom::DOMString title;
|
2013-08-07 13:23:08 -07:00
|
|
|
GetTitle(title);
|
2015-02-12 17:27:39 -08:00
|
|
|
title.ToString(aTitle);
|
2013-08-07 13:23:08 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetLang(nsAString& aLang) final override {
|
2015-02-12 17:27:39 -08:00
|
|
|
mozilla::dom::DOMString lang;
|
2013-08-07 13:23:08 -07:00
|
|
|
GetLang(lang);
|
2015-02-12 17:27:39 -08:00
|
|
|
lang.ToString(aLang);
|
2013-08-07 13:23:08 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetDir(nsAString& aDir) final override {
|
2015-02-12 17:27:39 -08:00
|
|
|
mozilla::dom::DOMString dir;
|
2013-08-07 13:23:08 -07:00
|
|
|
GetDir(dir);
|
2015-02-12 17:27:39 -08:00
|
|
|
dir.ToString(aDir);
|
2013-08-07 13:23:08 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetDir(const nsAString& aDir) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
SetDir(aDir, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetDOMClassName(nsAString& aClassName) final {
|
2013-08-07 13:23:08 -07:00
|
|
|
GetHTMLAttr(nsGkAtoms::_class, aClassName);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetDOMClassName(const nsAString& aClassName) final {
|
2013-08-07 13:23:08 -07:00
|
|
|
SetClassName(aClassName);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetDataset(nsISupports** aDataset) final override;
|
|
|
|
NS_IMETHOD GetHidden(bool* aHidden) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
*aHidden = Hidden();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetHidden(bool aHidden) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
SetHidden(aHidden, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD DOMBlur() final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
Blur(rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetItemScope(bool* aItemScope) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
*aItemScope = ItemScope();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetItemScope(bool aItemScope) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
SetItemScope(aItemScope, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetItemType(nsIVariant** aType) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
GetTokenList(nsGkAtoms::itemtype, aType);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetItemType(nsIVariant* aType) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
return SetTokenList(nsGkAtoms::itemtype, aType);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetItemId(nsAString& aId) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
nsString id;
|
|
|
|
GetItemId(id);
|
|
|
|
aId.Assign(aId);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetItemId(const nsAString& aId) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
SetItemId(aId, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetProperties(nsISupports** aReturn) final override;
|
|
|
|
NS_IMETHOD GetItemValue(nsIVariant** aValue) final override;
|
|
|
|
NS_IMETHOD SetItemValue(nsIVariant* aValue) final override;
|
|
|
|
NS_IMETHOD GetItemRef(nsIVariant** aRef) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
GetTokenList(nsGkAtoms::itemref, aRef);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetItemRef(nsIVariant* aRef) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
return SetTokenList(nsGkAtoms::itemref, aRef);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetItemProp(nsIVariant** aProp) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
GetTokenList(nsGkAtoms::itemprop, aProp);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetItemProp(nsIVariant* aProp) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
return SetTokenList(nsGkAtoms::itemprop, aProp);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetAccessKey(nsAString& aAccessKey) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
nsString accessKey;
|
|
|
|
GetAccessKey(accessKey);
|
|
|
|
aAccessKey.Assign(accessKey);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetAccessKey(const nsAString& aAccessKey) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
SetAccessKey(aAccessKey, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-01-15 13:13:53 -08:00
|
|
|
NS_IMETHOD GetAccessKeyLabel(nsAString& aAccessKeyLabel)
|
2015-03-21 09:28:04 -07:00
|
|
|
final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
nsString accessKeyLabel;
|
|
|
|
GetAccessKeyLabel(accessKeyLabel);
|
|
|
|
aAccessKeyLabel.Assign(accessKeyLabel);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetDraggable(bool aDraggable) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
SetDraggable(aDraggable, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-01-15 13:13:53 -08:00
|
|
|
NS_IMETHOD GetContentEditable(nsAString& aContentEditable)
|
2015-03-21 09:28:04 -07:00
|
|
|
final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
nsString contentEditable;
|
|
|
|
GetContentEditable(contentEditable);
|
|
|
|
aContentEditable.Assign(contentEditable);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-01-15 13:13:53 -08:00
|
|
|
NS_IMETHOD SetContentEditable(const nsAString& aContentEditable)
|
2015-03-21 09:28:04 -07:00
|
|
|
final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
SetContentEditable(aContentEditable, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-01-15 13:13:53 -08:00
|
|
|
NS_IMETHOD GetIsContentEditable(bool* aIsContentEditable)
|
2015-03-21 09:28:04 -07:00
|
|
|
final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
*aIsContentEditable = IsContentEditable();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-01-15 13:13:53 -08:00
|
|
|
NS_IMETHOD GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu)
|
2015-03-21 09:28:04 -07:00
|
|
|
final override;
|
|
|
|
NS_IMETHOD GetSpellcheck(bool* aSpellcheck) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
*aSpellcheck = Spellcheck();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetSpellcheck(bool aSpellcheck) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
SetSpellcheck(aSpellcheck, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) final override {
|
2013-10-08 12:25:01 -07:00
|
|
|
mozilla::dom::Element::GetOuterHTML(aOuterHTML);
|
|
|
|
return NS_OK;
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
mozilla::dom::Element::SetOuterHTML(aOuterHTML, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
|
|
|
}
|
2013-08-07 13:23:08 -07:00
|
|
|
NS_IMETHOD InsertAdjacentHTML(const nsAString& position,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsAString& text) final override;
|
|
|
|
NS_IMETHOD ScrollIntoView(bool top, uint8_t _argc) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
if (!_argc) {
|
|
|
|
top = true;
|
|
|
|
}
|
Bug 1045754 - Part 1 - Implement updated CSSOM-View smooth-scrolling specification. r=bz
- Added new WebIDL dictionary, ScrollToOptions. This dictionary extends
ScrollOptions by adding "left" and "top", specifying the scroll offset.
This will be later extended with more members to allow scroll offsets to be
specified with logical axes.
- Implemented Window.Scroll, Window.ScrollTo, Window.ScrollBy, Element.Scroll,
Element.ScrollTo, and Element.ScrollBy functions that accept ScrollToOptions
as a single parameter.
- Removed ScrollOptions dictionary parameter from existing Window.Scroll,
Window.ScrollTo, and Window.ScrollBy functions as these have been replaced
with functions accepting a single parameter, ScrollToOptions.
- Added new WebIDL dictionary, ScrollIntoViewOptions. This dictionary
extends ScrollOptions by adding "block", specifying whether the element
start or end will be scrolled into view.
- Replaced Element.ScrollIntoView(bool,ScrollOptions) with
Element.ScrollIntoView(ScrollIntoViewOptions) to match updated
CSSOM-View scroll-behavior specification.
2014-10-01 10:47:56 -07:00
|
|
|
mozilla::dom::Element::ScrollIntoView(top);
|
2013-08-07 13:23:08 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-01-15 13:13:53 -08:00
|
|
|
NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent)
|
2015-03-21 09:28:04 -07:00
|
|
|
final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::dom::Element* offsetParent = GetOffsetParent();
|
|
|
|
if (!offsetParent) {
|
|
|
|
*aOffsetParent = nullptr;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return CallQueryInterface(offsetParent, aOffsetParent);
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetOffsetTop(int32_t* aOffsetTop) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
*aOffsetTop = OffsetTop();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetOffsetLeft(int32_t* aOffsetLeft) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
*aOffsetLeft = OffsetLeft();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetOffsetWidth(int32_t* aOffsetWidth) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
*aOffsetWidth = OffsetWidth();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetOffsetHeight(int32_t* aOffsetHeight) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
*aOffsetHeight = OffsetHeight();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD DOMClick() final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
Click();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetTabIndex(int32_t* aTabIndex) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
*aTabIndex = TabIndex();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetTabIndex(int32_t aTabIndex) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
SetTabIndex(aTabIndex, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD Focus() final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
Focus(rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetDraggable(bool* aDraggable) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
*aDraggable = Draggable();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) override {
|
2013-10-08 12:25:01 -07:00
|
|
|
return mozilla::dom::Element::GetInnerHTML(aInnerHTML);
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
|
|
|
using mozilla::dom::Element::SetInnerHTML;
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) final override {
|
2013-08-07 13:23:08 -07:00
|
|
|
mozilla::ErrorResult rv;
|
|
|
|
SetInnerHTML(aInnerHTML, rv);
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult();
|
2013-08-07 13:23:08 -07:00
|
|
|
}
|
|
|
|
|
2013-08-07 14:40:21 -07:00
|
|
|
using nsGenericHTMLElementBase::GetOwnerDocument;
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsIDOMNode* AsDOMNode() override { return this; }
|
2013-08-07 13:23:08 -07:00
|
|
|
|
2011-11-10 04:02:22 -08:00
|
|
|
public:
|
2007-03-22 10:30:00 -07:00
|
|
|
// Implementation for nsIContent
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aCompileEventHandlers) override;
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aNullParent = true) override;
|
2014-09-14 17:56:59 -07:00
|
|
|
|
|
|
|
MOZ_ALWAYS_INLINE // Avoid a crashy hook from Avast 10 Beta
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2011-09-28 23:19:26 -07:00
|
|
|
const nsAString& aValue, bool aNotify)
|
2007-06-27 19:48:16 -07:00
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
2007-06-27 19:48:16 -07:00
|
|
|
}
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2007-06-27 19:48:16 -07:00
|
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aNotify) override;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aNotify) override;
|
|
|
|
virtual bool IsFocusableInternal(int32_t *aTabIndex, bool aWithMouse) override
|
2008-04-15 11:40:38 -07:00
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isFocusable = false;
|
2010-06-21 05:37:34 -07:00
|
|
|
IsHTMLFocusable(aWithMouse, &isFocusable, aTabIndex);
|
2008-04-15 11:40:38 -07:00
|
|
|
return isFocusable;
|
|
|
|
}
|
|
|
|
/**
|
2011-10-17 07:59:28 -07:00
|
|
|
* Returns true if a subclass is not allowed to override the value returned
|
2008-04-15 11:40:38 -07:00
|
|
|
* in aIsFocusable.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsHTMLFocusable(bool aWithMouse,
|
2013-02-11 20:56:03 -08:00
|
|
|
bool *aIsFocusable,
|
|
|
|
int32_t *aTabIndex);
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void PerformAccesskey(bool aKeyCausesActivation,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aIsTrustedEvent) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-04-23 00:31:21 -07:00
|
|
|
/**
|
|
|
|
* Check if an event for an anchor can be handled
|
2011-10-17 07:59:28 -07:00
|
|
|
* @return true if the event can be handled, false otherwise
|
2007-04-23 00:31:21 -07:00
|
|
|
*/
|
2014-03-17 21:48:18 -07:00
|
|
|
bool CheckHandleEventForAnchorsPreconditions(
|
|
|
|
mozilla::EventChainVisitor& aVisitor);
|
2014-03-17 21:48:19 -07:00
|
|
|
nsresult PreHandleEventForAnchors(mozilla::EventChainPreVisitor& aVisitor);
|
2014-03-17 21:48:20 -07:00
|
|
|
nsresult PostHandleEventForAnchors(mozilla::EventChainPostVisitor& aVisitor);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsHTMLLink(nsIURI** aURI) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// HTML element methods
|
2008-02-02 15:41:24 -08:00
|
|
|
void Compact() { mAttrsAndChildren.Compact(); }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void UpdateEditableState(bool aNotify) override;
|
2011-05-31 18:46:57 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual mozilla::EventStates IntrinsicState() const override;
|
2012-04-16 21:03:10 -07:00
|
|
|
|
2011-05-31 18:46:57 -07:00
|
|
|
// Helper for setting our editable flag and notifying
|
2011-09-28 23:19:26 -07:00
|
|
|
void DoSetEditableFlag(bool aEditable, bool aNotify) {
|
2011-05-31 18:46:57 -07:00
|
|
|
SetEditableFlag(aEditable);
|
|
|
|
UpdateState(aNotify);
|
|
|
|
}
|
2007-06-27 19:48:16 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2012-08-24 10:50:49 -07:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsAttrValue& aResult) override;
|
2012-08-24 10:50:49 -07:00
|
|
|
|
|
|
|
bool ParseBackgroundAttribute(int32_t aNamespaceID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult);
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
|
|
|
|
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the base target for any links within this piece
|
|
|
|
* of content. Generally, this is the document's base target,
|
|
|
|
* but certain content carries a local base for backward
|
|
|
|
* compatibility.
|
|
|
|
*
|
|
|
|
* @param aBaseTarget the base target [OUT]
|
|
|
|
*/
|
|
|
|
void GetBaseTarget(nsAString& aBaseTarget) const;
|
|
|
|
|
|
|
|
/**
|
2009-12-24 13:20:05 -08:00
|
|
|
* Get the primary form control frame for this element. Same as
|
|
|
|
* GetPrimaryFrame(), except it QI's to nsIFormControlFrame.
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
2009-12-24 13:20:05 -08:00
|
|
|
* @param aFlush whether to flush out frames so that they're up to date.
|
|
|
|
* @return the primary frame as nsIFormControlFrame
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
nsIFormControlFrame* GetFormControlFrame(bool aFlushFrames);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse an alignment attribute (top/middle/bottom/baseline)
|
|
|
|
*
|
|
|
|
* @param aString the string to parse
|
|
|
|
* @param aResult the resulting HTMLValue
|
|
|
|
* @return whether the value was parsed
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool ParseAlignValue(const nsAString& aString,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAttrValue& aResult);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse a div align string to value (left/right/center/middle/justify)
|
|
|
|
*
|
|
|
|
* @param aString the string to parse
|
|
|
|
* @param aResult the resulting HTMLValue
|
|
|
|
* @return whether the value was parsed
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool ParseDivAlignValue(const nsAString& aString,
|
2010-07-05 21:25:52 -07:00
|
|
|
nsAttrValue& aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a table halign string to value (left/right/center/char/justify)
|
|
|
|
*
|
|
|
|
* @param aString the string to parse
|
|
|
|
* @param aResult the resulting HTMLValue
|
|
|
|
* @return whether the value was parsed
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool ParseTableHAlignValue(const nsAString& aString,
|
2010-06-11 11:47:56 -07:00
|
|
|
nsAttrValue& aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a table cell halign string to value
|
|
|
|
*
|
|
|
|
* @param aString the string to parse
|
|
|
|
* @param aResult the resulting HTMLValue
|
|
|
|
* @return whether the value was parsed
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool ParseTableCellHAlignValue(const nsAString& aString,
|
2010-07-30 16:48:57 -07:00
|
|
|
nsAttrValue& aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a table valign string to value (left/right/center/char/justify/
|
|
|
|
* abscenter/absmiddle/middle)
|
|
|
|
*
|
|
|
|
* @param aString the string to parse
|
|
|
|
* @param aResult the resulting HTMLValue
|
|
|
|
* @return whether the value was parsed
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool ParseTableVAlignValue(const nsAString& aString,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAttrValue& aResult);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert an image attribute to value (width, height, hspace, vspace, border)
|
|
|
|
*
|
|
|
|
* @param aAttribute the attribute to parse
|
|
|
|
* @param aString the string to parse
|
|
|
|
* @param aResult the resulting HTMLValue
|
|
|
|
* @return whether the value was parsed
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool ParseImageAttribute(nsIAtom* aAttribute,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsAString& aString,
|
|
|
|
nsAttrValue& aResult);
|
|
|
|
/**
|
|
|
|
* Convert a frameborder string to value (yes/no/1/0)
|
|
|
|
*
|
|
|
|
* @param aString the string to parse
|
|
|
|
* @param aResult the resulting HTMLValue
|
|
|
|
* @return whether the value was parsed
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool ParseFrameborderValue(const nsAString& aString,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAttrValue& aResult);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a scrolling string to value (yes/no/on/off/scroll/noscroll/auto)
|
|
|
|
*
|
|
|
|
* @param aString the string to parse
|
|
|
|
* @param aResult the resulting HTMLValue
|
|
|
|
* @return whether the value was parsed
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool ParseScrollingValue(const nsAString& aString,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAttrValue& aResult);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attribute Mapping Helpers
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A style attribute mapping function for the most common attributes, to be
|
|
|
|
* called by subclasses' attribute mapping functions. Currently handles
|
2013-07-11 07:39:18 -07:00
|
|
|
* dir, lang and hidden, could handle others.
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapCommonAttributesInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aRuleData);
|
2013-07-11 07:39:18 -07:00
|
|
|
/**
|
|
|
|
* Same as MapCommonAttributesInto except that it does not handle hidden.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapCommonAttributesIntoExceptHidden(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aRuleData);
|
2010-12-03 06:22:11 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
static const MappedAttributeEntry sCommonAttributeMap[];
|
|
|
|
static const MappedAttributeEntry sImageMarginSizeAttributeMap[];
|
|
|
|
static const MappedAttributeEntry sImageBorderAttributeMap[];
|
|
|
|
static const MappedAttributeEntry sImageAlignAttributeMap[];
|
|
|
|
static const MappedAttributeEntry sDivAlignAttributeMap[];
|
|
|
|
static const MappedAttributeEntry sBackgroundAttributeMap[];
|
|
|
|
static const MappedAttributeEntry sBackgroundColorAttributeMap[];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper to map the align attribute into a style struct.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapImageAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper to map the align attribute into a style struct for things
|
|
|
|
* like <div>, <h1>, etc.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapDivAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper to map the image border attribute into a style struct.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapImageBorderAttributeInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
|
|
|
/**
|
|
|
|
* Helper to map the image margin attribute into a style struct.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapImageMarginAttributeInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
|
|
|
/**
|
|
|
|
* Helper to map the image position attribute into a style struct.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapImageSizeAttributesInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
|
|
|
/**
|
|
|
|
* Helper to map the background attribute
|
|
|
|
* into a style struct.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapBackgroundInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
|
|
|
/**
|
|
|
|
* Helper to map the bgcolor attribute
|
|
|
|
* into a style struct.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapBGColorInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
|
|
|
/**
|
|
|
|
* Helper to map the background attributes (currently background and bgcolor)
|
|
|
|
* into a style struct.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapBackgroundAttributesInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
|
|
|
/**
|
|
|
|
* Helper to map the scrolling attribute on FRAME and IFRAME
|
|
|
|
* into a style struct.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapScrollingAttributeInto(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
|
|
|
/**
|
|
|
|
* Get the presentation context for this content node.
|
|
|
|
* @return the presentation context
|
|
|
|
*/
|
2014-08-22 13:11:27 -07:00
|
|
|
enum PresContextFor
|
|
|
|
{
|
|
|
|
eForComposedDoc,
|
|
|
|
eForUncomposedDoc
|
|
|
|
};
|
|
|
|
nsPresContext* GetPresContext(PresContextFor aFor);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Form Helper Routines
|
|
|
|
/**
|
|
|
|
* Find an ancestor of this content node which is a form (could be null)
|
|
|
|
* @param aCurrentForm the current form for this node. If this is
|
|
|
|
* non-null, and no ancestor form is found, and the current form is in
|
|
|
|
* a connected subtree with the node, the current form will be
|
|
|
|
* returned. This is needed to handle cases when HTML elements have a
|
|
|
|
* current form that they're not descendants of.
|
2010-08-23 18:11:04 -07:00
|
|
|
* @note This method should not be called if the element has a form attribute.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2013-06-19 07:24:37 -07:00
|
|
|
mozilla::dom::HTMLFormElement*
|
|
|
|
FindAncestorForm(mozilla::dom::HTMLFormElement* aCurrentForm = nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void RecompileScriptEventListeners() override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* See if the document being tested has nav-quirks mode enabled.
|
|
|
|
* @param doc the document
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool InNavQuirksMode(nsIDocument* aDoc);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-02-10 12:56:51 -08:00
|
|
|
/**
|
|
|
|
* Locate an nsIEditor rooted at this content node, if there is one.
|
|
|
|
*/
|
2014-06-02 05:08:21 -07:00
|
|
|
nsresult GetEditor(nsIEditor** aEditor);
|
2009-02-10 12:56:51 -08:00
|
|
|
|
2010-08-19 16:23:59 -07:00
|
|
|
/**
|
|
|
|
* Helper method for NS_IMPL_URI_ATTR macro.
|
|
|
|
* Gets the absolute URI value of an attribute, by resolving any relative
|
|
|
|
* URIs in the attribute against the baseuri of the element. If the attribute
|
|
|
|
* isn't a relative URI the value of the attribute is returned as is. Only
|
|
|
|
* works for attributes in null namespace.
|
|
|
|
*
|
|
|
|
* @param aAttr name of attribute.
|
|
|
|
* @param aBaseAttr name of base attribute.
|
|
|
|
* @param aResult result value [out]
|
|
|
|
*/
|
2014-06-02 05:08:21 -07:00
|
|
|
void GetURIAttr(nsIAtom* aAttr, nsIAtom* aBaseAttr, nsAString& aResult) const;
|
2010-08-19 16:23:59 -07:00
|
|
|
|
2012-04-10 23:16:00 -07:00
|
|
|
/**
|
|
|
|
* Gets the absolute URI values of an attribute, by resolving any relative
|
|
|
|
* URIs in the attribute against the baseuri of the element. If a substring
|
|
|
|
* isn't a relative URI, the substring is returned as is. Only works for
|
|
|
|
* attributes in null namespace.
|
|
|
|
*/
|
|
|
|
bool GetURIAttr(nsIAtom* aAttr, nsIAtom* aBaseAttr, nsIURI** aURI) const;
|
|
|
|
|
2010-09-18 14:33:16 -07:00
|
|
|
/**
|
|
|
|
* Returns the current disabled state of the element.
|
|
|
|
*/
|
|
|
|
virtual bool IsDisabled() const {
|
2012-03-10 02:57:19 -08:00
|
|
|
return false;
|
2010-09-18 14:33:16 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsHidden() const
|
2011-08-08 10:31:32 -07:00
|
|
|
{
|
|
|
|
return HasAttr(kNameSpaceID_None, nsGkAtoms::hidden);
|
|
|
|
}
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsLabelable() const override;
|
|
|
|
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override;
|
2012-06-10 16:44:50 -07:00
|
|
|
|
2013-02-19 08:54:41 -08:00
|
|
|
static bool TouchEventsEnabled(JSContext* /* unused */, JSObject* /* unused */);
|
2012-11-19 02:59:13 -08:00
|
|
|
|
2013-03-27 10:15:37 -07:00
|
|
|
static inline bool
|
2013-04-20 09:04:09 -07:00
|
|
|
CanHaveName(nsIAtom* aTag)
|
|
|
|
{
|
|
|
|
return aTag == nsGkAtoms::img ||
|
|
|
|
aTag == nsGkAtoms::form ||
|
|
|
|
aTag == nsGkAtoms::applet ||
|
|
|
|
aTag == nsGkAtoms::embed ||
|
|
|
|
aTag == nsGkAtoms::object;
|
|
|
|
}
|
|
|
|
static inline bool
|
|
|
|
ShouldExposeNameAsHTMLDocumentProperty(Element* aElement)
|
|
|
|
{
|
2015-03-03 03:09:00 -08:00
|
|
|
return aElement->IsHTMLElement() &&
|
|
|
|
CanHaveName(aElement->NodeInfo()->NameAtom());
|
2013-04-20 09:04:09 -07:00
|
|
|
}
|
|
|
|
static inline bool
|
2013-03-27 10:15:37 -07:00
|
|
|
ShouldExposeIdAsHTMLDocumentProperty(Element* aElement)
|
|
|
|
{
|
2015-03-03 03:09:00 -08:00
|
|
|
return aElement->IsAnyOfHTMLElements(nsGkAtoms::img,
|
|
|
|
nsGkAtoms::applet,
|
|
|
|
nsGkAtoms::embed,
|
|
|
|
nsGkAtoms::object);
|
2013-03-27 10:15:37 -07:00
|
|
|
}
|
|
|
|
|
2013-11-20 12:23:43 -08:00
|
|
|
static bool
|
|
|
|
IsScrollGrabAllowed(JSContext*, JSObject*);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2010-06-03 18:09:20 -07:00
|
|
|
/**
|
|
|
|
* Add/remove this element to the documents name cache
|
|
|
|
*/
|
|
|
|
void AddToNameTable(nsIAtom* aName) {
|
2011-04-07 19:29:50 -07:00
|
|
|
NS_ASSERTION(HasName(), "Node doesn't have name?");
|
2010-06-03 18:09:20 -07:00
|
|
|
nsIDocument* doc = GetCurrentDoc();
|
|
|
|
if (doc && !IsInAnonymousSubtree()) {
|
|
|
|
doc->AddToNameTable(this, aName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void RemoveFromNameTable() {
|
2011-04-07 19:29:50 -07:00
|
|
|
if (HasName()) {
|
2010-06-03 18:09:20 -07:00
|
|
|
nsIDocument* doc = GetCurrentDoc();
|
|
|
|
if (doc) {
|
|
|
|
doc->RemoveFromNameTable(this, GetParsedAttr(nsGkAtoms::name)->
|
|
|
|
GetAtomValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Register or unregister an access key to this element based on the
|
|
|
|
* accesskey attribute.
|
|
|
|
*/
|
2010-06-03 18:08:57 -07:00
|
|
|
void RegAccessKey()
|
|
|
|
{
|
|
|
|
if (HasFlag(NODE_HAS_ACCESSKEY)) {
|
2011-10-17 07:59:28 -07:00
|
|
|
RegUnRegAccessKey(true);
|
2010-06-03 18:08:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnregAccessKey()
|
|
|
|
{
|
|
|
|
if (HasFlag(NODE_HAS_ACCESSKEY)) {
|
2011-10-17 07:59:28 -07:00
|
|
|
RegUnRegAccessKey(false);
|
2010-06-03 18:08:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2011-09-28 23:19:26 -07:00
|
|
|
void RegUnRegAccessKey(bool aDoReg);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-06-03 18:08:57 -07:00
|
|
|
protected:
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsAttrValue* aValue, bool aNotify) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-03-16 23:56:53 -07:00
|
|
|
virtual mozilla::EventListenerManager*
|
|
|
|
GetEventListenerManagerForAttr(nsIAtom* aAttrName,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool* aDefer) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-21 09:14:00 -07:00
|
|
|
/**
|
|
|
|
* Create a URI for the given aURISpec string.
|
|
|
|
* Returns INVALID_STATE_ERR and nulls *aURI if aURISpec is empty
|
|
|
|
* and the document's URI matches the element's base URI.
|
|
|
|
*/
|
2015-05-21 22:12:13 -07:00
|
|
|
nsresult NewURIFromString(const nsAString& aURISpec, nsIURI** aURI);
|
2013-05-21 09:14:00 -07:00
|
|
|
|
2012-11-10 15:30:15 -08:00
|
|
|
void GetHTMLAttr(nsIAtom* aName, nsAString& aResult) const
|
|
|
|
{
|
|
|
|
GetAttr(kNameSpaceID_None, aName, aResult);
|
|
|
|
}
|
2013-02-08 04:20:11 -08:00
|
|
|
void GetHTMLAttr(nsIAtom* aName, mozilla::dom::DOMString& aResult) const
|
|
|
|
{
|
|
|
|
GetAttr(kNameSpaceID_None, aName, aResult);
|
|
|
|
}
|
2012-11-10 15:30:15 -08:00
|
|
|
void GetHTMLEnumAttr(nsIAtom* aName, nsAString& aResult) const
|
|
|
|
{
|
|
|
|
GetEnumAttr(aName, nullptr, aResult);
|
|
|
|
}
|
|
|
|
void GetHTMLURIAttr(nsIAtom* aName, nsAString& aResult) const
|
|
|
|
{
|
|
|
|
GetURIAttr(aName, nullptr, aResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetHTMLAttr(nsIAtom* aName, const nsAString& aValue)
|
|
|
|
{
|
|
|
|
SetAttr(kNameSpaceID_None, aName, aValue, true);
|
|
|
|
}
|
|
|
|
void SetHTMLAttr(nsIAtom* aName, const nsAString& aValue, mozilla::ErrorResult& aError)
|
|
|
|
{
|
2014-09-05 19:42:33 -07:00
|
|
|
mozilla::dom::Element::SetAttr(aName, aValue, aError);
|
2012-11-10 15:30:15 -08:00
|
|
|
}
|
|
|
|
void UnsetHTMLAttr(nsIAtom* aName, mozilla::ErrorResult& aError)
|
|
|
|
{
|
2014-09-05 19:42:33 -07:00
|
|
|
mozilla::dom::Element::UnsetAttr(aName, aError);
|
2012-11-10 15:30:15 -08:00
|
|
|
}
|
|
|
|
void SetHTMLBoolAttr(nsIAtom* aName, bool aValue, mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
if (aValue) {
|
|
|
|
SetHTMLAttr(aName, EmptyString(), aError);
|
|
|
|
} else {
|
|
|
|
UnsetHTMLAttr(aName, aError);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void SetHTMLIntAttr(nsIAtom* aName, int32_t aValue, mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
nsAutoString value;
|
|
|
|
value.AppendInt(aValue);
|
|
|
|
|
|
|
|
SetHTMLAttr(aName, value, aError);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Helper method for NS_IMPL_STRING_ATTR macro.
|
|
|
|
* Sets the value of an attribute, returns specified default value if the
|
|
|
|
* attribute isn't set. Only works for attributes in null namespace.
|
|
|
|
*
|
|
|
|
* @param aAttr name of attribute.
|
|
|
|
* @param aDefault default-value to return if attribute isn't set.
|
|
|
|
* @param aResult result value [out]
|
|
|
|
*/
|
2014-06-02 05:08:21 -07:00
|
|
|
nsresult SetAttrHelper(nsIAtom* aAttr, const nsAString& aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper method for NS_IMPL_INT_ATTR macro.
|
|
|
|
* Gets the integer-value of an attribute, returns specified default value
|
|
|
|
* if the attribute isn't set or isn't set to an integer. Only works for
|
|
|
|
* attributes in null namespace.
|
|
|
|
*
|
|
|
|
* @param aAttr name of attribute.
|
|
|
|
* @param aDefault default-value to return if attribute isn't set.
|
|
|
|
*/
|
2014-06-02 05:08:21 -07:00
|
|
|
int32_t GetIntAttr(nsIAtom* aAttr, int32_t aDefault) const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper method for NS_IMPL_INT_ATTR macro.
|
|
|
|
* Sets value of attribute to specified integer. Only works for attributes
|
|
|
|
* in null namespace.
|
|
|
|
*
|
|
|
|
* @param aAttr name of attribute.
|
|
|
|
* @param aValue Integer value of attribute.
|
|
|
|
*/
|
2014-06-02 05:08:21 -07:00
|
|
|
nsresult SetIntAttr(nsIAtom* aAttr, int32_t aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-11-06 02:30:27 -07:00
|
|
|
/**
|
|
|
|
* Helper method for NS_IMPL_UINT_ATTR macro.
|
|
|
|
* Gets the unsigned integer-value of an attribute, returns specified default
|
|
|
|
* value if the attribute isn't set or isn't set to an integer. Only works for
|
|
|
|
* attributes in null namespace.
|
|
|
|
*
|
|
|
|
* @param aAttr name of attribute.
|
|
|
|
* @param aDefault default-value to return if attribute isn't set.
|
|
|
|
*/
|
2013-04-04 00:03:50 -07:00
|
|
|
uint32_t GetUnsignedIntAttr(nsIAtom* aAttr, uint32_t aDefault) const;
|
2010-11-06 02:30:27 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper method for NS_IMPL_UINT_ATTR macro.
|
|
|
|
* Sets value of attribute to specified unsigned integer. Only works for
|
|
|
|
* attributes in null namespace.
|
|
|
|
*
|
|
|
|
* @param aAttr name of attribute.
|
|
|
|
* @param aValue Integer value of attribute.
|
|
|
|
*/
|
2013-04-04 00:03:50 -07:00
|
|
|
void SetUnsignedIntAttr(nsIAtom* aName, uint32_t aValue,
|
|
|
|
mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
nsAutoString value;
|
|
|
|
value.AppendInt(aValue);
|
|
|
|
|
|
|
|
SetHTMLAttr(aName, value, aError);
|
|
|
|
}
|
2010-11-06 02:30:27 -07:00
|
|
|
|
2008-07-09 01:22:20 -07:00
|
|
|
/**
|
2011-03-25 07:43:53 -07:00
|
|
|
* Sets value of attribute to specified double. Only works for attributes
|
2008-07-09 01:22:20 -07:00
|
|
|
* in null namespace.
|
|
|
|
*
|
|
|
|
* @param aAttr name of attribute.
|
2011-03-25 07:43:53 -07:00
|
|
|
* @param aValue Double value of attribute.
|
2008-07-09 01:22:20 -07:00
|
|
|
*/
|
2013-08-21 23:34:39 -07:00
|
|
|
void SetDoubleAttr(nsIAtom* aAttr, double aValue, mozilla::ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
nsAutoString value;
|
|
|
|
value.AppendFloat(aValue);
|
|
|
|
|
|
|
|
SetHTMLAttr(aAttr, value, aRv);
|
|
|
|
}
|
2008-07-09 01:22:20 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* This method works like GetURIAttr, except that it supports multiple
|
|
|
|
* URIs separated by whitespace (one or more U+0020 SPACE characters).
|
|
|
|
*
|
|
|
|
* Gets the absolute URI values of an attribute, by resolving any relative
|
|
|
|
* URIs in the attribute against the baseuri of the element. If a substring
|
|
|
|
* isn't a relative URI, the substring is returned as is. Only works for
|
|
|
|
* attributes in null namespace.
|
|
|
|
*
|
|
|
|
* @param aAttr name of attribute.
|
|
|
|
* @param aResult result value [out]
|
|
|
|
*/
|
2014-06-02 05:08:21 -07:00
|
|
|
nsresult GetURIListAttr(nsIAtom* aAttr, nsAString& aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Locates the nsIEditor associated with this node. In general this is
|
|
|
|
* equivalent to GetEditorInternal(), but for designmode or contenteditable,
|
|
|
|
* this may need to get an editor that's not actually on this element's
|
|
|
|
* associated TextControlFrame. This is used by the spellchecking routines
|
|
|
|
* to get the editor affected by changing the spellcheck attribute on this
|
|
|
|
* node.
|
|
|
|
*/
|
|
|
|
virtual already_AddRefed<nsIEditor> GetAssociatedEditor();
|
|
|
|
|
2008-08-15 15:26:37 -07:00
|
|
|
/**
|
|
|
|
* Get the frame's offset information for offsetTop/Left/Width/Height.
|
2012-11-10 15:30:15 -08:00
|
|
|
* Returns the parent the offset is relative to.
|
2008-08-15 15:26:37 -07:00
|
|
|
* @note This method flushes pending notifications (Flush_Layout).
|
|
|
|
* @param aRect the offset information [OUT]
|
|
|
|
*/
|
2013-06-12 00:00:08 -07:00
|
|
|
mozilla::dom::Element* GetOffsetRect(mozilla::CSSIntRect& aRect);
|
2008-08-15 15:26:37 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Returns true if this is the current document's body element
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsCurrentBodyElement();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Ensures all editors associated with a subtree are synced, for purposes of
|
|
|
|
* spellchecking.
|
|
|
|
*/
|
|
|
|
static void SyncEditorsOnSubtree(nsIContent* content);
|
2007-06-27 19:48:16 -07:00
|
|
|
|
|
|
|
enum ContentEditableTristate {
|
|
|
|
eInherit = -1,
|
|
|
|
eFalse = 0,
|
|
|
|
eTrue = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns eTrue if the element has a contentEditable attribute and its value
|
|
|
|
* is "true" or an empty string. Returns eFalse if the element has a
|
|
|
|
* contentEditable attribute and its value is "false". Otherwise returns
|
|
|
|
* eInherit.
|
|
|
|
*/
|
2014-06-02 05:08:21 -07:00
|
|
|
ContentEditableTristate GetContentEditableValue() const
|
2007-06-27 19:48:16 -07:00
|
|
|
{
|
|
|
|
static const nsIContent::AttrValuesArray values[] =
|
2012-07-30 07:20:58 -07:00
|
|
|
{ &nsGkAtoms::_false, &nsGkAtoms::_true, &nsGkAtoms::_empty, nullptr };
|
2007-06-27 19:48:16 -07:00
|
|
|
|
2011-04-07 19:29:50 -07:00
|
|
|
if (!MayHaveContentEditableAttr())
|
2009-06-23 05:57:56 -07:00
|
|
|
return eInherit;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t value = FindAttrValueIn(kNameSpaceID_None,
|
2007-06-27 19:48:16 -07:00
|
|
|
nsGkAtoms::contenteditable, values,
|
|
|
|
eIgnoreCase);
|
|
|
|
|
|
|
|
return value > 0 ? eTrue : (value == 0 ? eFalse : eInherit);
|
|
|
|
}
|
|
|
|
|
2010-02-24 08:37:03 -08:00
|
|
|
// Used by A, AREA, LINK, and STYLE.
|
|
|
|
already_AddRefed<nsIURI> GetHrefURIForAnchors() const;
|
|
|
|
|
2007-06-27 19:48:16 -07:00
|
|
|
/**
|
2007-07-13 07:17:35 -07:00
|
|
|
* Returns whether this element is an editable root. There are two types of
|
|
|
|
* editable roots:
|
|
|
|
* 1) the documentElement if the whole document is editable (for example for
|
|
|
|
* desginMode=on)
|
|
|
|
* 2) an element that is marked editable with contentEditable=true and that
|
|
|
|
* doesn't have a parent or whose parent is not editable.
|
|
|
|
* Note that this doesn't return input and textarea elements that haven't been
|
|
|
|
* made editable through contentEditable or designMode.
|
2007-06-27 19:48:16 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsEditableRoot() const;
|
2007-06-27 19:48:16 -07:00
|
|
|
|
2013-01-03 22:54:26 -08:00
|
|
|
nsresult SetUndoScopeInternal(bool aUndoScope);
|
|
|
|
|
2010-10-08 03:20:20 -07:00
|
|
|
private:
|
2012-08-22 08:56:38 -07:00
|
|
|
void ChangeEditableState(int32_t aChange);
|
2013-11-20 12:23:43 -08:00
|
|
|
|
|
|
|
bool mScrollgrab;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2013-02-08 08:34:47 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class HTMLFieldSetElement;
|
|
|
|
}
|
|
|
|
}
|
2011-09-18 02:22:18 -07:00
|
|
|
|
2012-10-01 17:52:06 -07:00
|
|
|
#define FORM_ELEMENT_FLAG_BIT(n_) NODE_FLAG_BIT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + (n_))
|
|
|
|
|
|
|
|
// Form element specific bits
|
|
|
|
enum {
|
2013-06-18 05:53:23 -07:00
|
|
|
// If this flag is set on an nsGenericHTMLFormElement or an HTMLImageElement,
|
|
|
|
// that means that we have added ourselves to our mForm. It's possible to
|
|
|
|
// have a non-null mForm, but not have this flag set. That happens when the
|
|
|
|
// form is set via the content sink.
|
2012-10-01 17:52:06 -07:00
|
|
|
ADDED_TO_FORM = FORM_ELEMENT_FLAG_BIT(0),
|
|
|
|
|
2013-06-18 05:53:23 -07:00
|
|
|
// If this flag is set on an nsGenericHTMLFormElement or an HTMLImageElement,
|
|
|
|
// that means that its form is in the process of being unbound from the tree,
|
|
|
|
// and this form element hasn't re-found its form in
|
|
|
|
// nsGenericHTMLFormElement::UnbindFromTree yet.
|
2012-10-01 17:52:06 -07:00
|
|
|
MAYBE_ORPHAN_FORM_ELEMENT = FORM_ELEMENT_FLAG_BIT(1)
|
|
|
|
};
|
|
|
|
|
|
|
|
// NOTE: I don't think it's possible to have the above two flags set at the
|
|
|
|
// same time, so if it becomes an issue we can probably merge them into the
|
|
|
|
// same bit. --bz
|
|
|
|
|
2013-06-08 01:54:59 -07:00
|
|
|
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2);
|
2012-10-01 17:52:06 -07:00
|
|
|
|
|
|
|
#undef FORM_ELEMENT_FLAG_BIT
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* A helper class for form elements that can contain children
|
|
|
|
*/
|
|
|
|
class nsGenericHTMLFormElement : public nsGenericHTMLElement,
|
|
|
|
public nsIFormControl
|
|
|
|
{
|
|
|
|
public:
|
2014-08-05 06:19:51 -07:00
|
|
|
explicit nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-07 13:23:08 -07:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
nsINode* GetScopeChainParent() const override;
|
2014-10-30 14:38:48 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
|
|
|
virtual void SaveSubtreeState() override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIFormControl
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual mozilla::dom::HTMLFieldSetElement* GetFieldSet() override;
|
|
|
|
virtual mozilla::dom::Element* GetFormElement() override;
|
2013-06-19 07:24:37 -07:00
|
|
|
mozilla::dom::HTMLFormElement* GetForm() const
|
2012-12-21 06:07:28 -08:00
|
|
|
{
|
|
|
|
return mForm;
|
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void SetForm(nsIDOMHTMLFormElement* aForm) override;
|
|
|
|
virtual void ClearForm(bool aRemoveFromForm) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-05-09 11:32:57 -07:00
|
|
|
nsresult GetForm(nsIDOMHTMLFormElement** aForm);
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD SaveState() override
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-01-18 13:10:06 -08:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool RestoreState(nsPresState* aState) override
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool AllowDrop() override
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2011-10-17 07:59:28 -07:00
|
|
|
return true;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2010-08-21 11:51:38 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIContent
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aCompileEventHandlers) override;
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aNullParent = true) override;
|
|
|
|
virtual IMEState GetDesiredIMEState() override;
|
|
|
|
virtual mozilla::EventStates IntrinsicState() const override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-03-17 21:48:19 -07:00
|
|
|
virtual nsresult PreHandleEvent(
|
2015-03-21 09:28:04 -07:00
|
|
|
mozilla::EventChainPreVisitor& aVisitor) override;
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 11:00:39 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsDisabled() const override;
|
2010-09-18 14:33:16 -07:00
|
|
|
|
|
|
|
/**
|
2011-05-31 18:46:57 -07:00
|
|
|
* This callback is called by a fieldest on all its elements whenever its
|
|
|
|
* disabled attribute is changed so the element knows its disabled state
|
2010-09-18 14:33:16 -07:00
|
|
|
* might have changed.
|
|
|
|
*
|
2011-05-31 18:46:57 -07:00
|
|
|
* @note Classes redefining this method should not do any content
|
|
|
|
* state updates themselves but should just make sure to call into
|
|
|
|
* nsGenericHTMLFormElement::FieldSetDisabledChanged.
|
2010-09-18 14:33:16 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void FieldSetDisabledChanged(bool aNotify);
|
2010-09-18 18:47:15 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void FieldSetFirstLegendChanged(bool aNotify) {
|
2011-05-31 18:46:57 -07:00
|
|
|
UpdateFieldSet(aNotify);
|
2010-09-18 18:47:15 -07:00
|
|
|
}
|
2010-09-18 14:33:16 -07:00
|
|
|
|
2010-11-05 10:15:05 -07:00
|
|
|
/**
|
|
|
|
* This callback is called by a fieldset on all it's elements when it's being
|
|
|
|
* destroyed. When called, the elements should check that aFieldset is there
|
|
|
|
* first parent fieldset and null mFieldset in that case only.
|
|
|
|
*
|
|
|
|
* @param aFieldSet The fieldset being removed.
|
|
|
|
*/
|
2011-09-18 02:22:18 -07:00
|
|
|
void ForgetFieldSet(nsIContent* aFieldset);
|
2010-11-05 10:15:05 -07:00
|
|
|
|
2010-08-18 11:28:08 -07:00
|
|
|
/**
|
|
|
|
* Returns if the control can be disabled.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool CanBeDisabled() const;
|
2010-08-18 11:28:08 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
2015-03-21 09:28:04 -07:00
|
|
|
int32_t* aTabIndex) override;
|
2011-01-05 05:23:37 -08:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsLabelable() const override;
|
2012-06-10 16:44:50 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
2014-07-08 14:23:16 -07:00
|
|
|
virtual ~nsGenericHTMLFormElement();
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2012-02-13 18:00:56 -08:00
|
|
|
const nsAttrValueOrString* aValue,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aNotify) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsAttrValue* aValue, bool aNotify) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-08-23 18:11:04 -07:00
|
|
|
/**
|
|
|
|
* This method will update the form owner, using @form or looking to a parent.
|
|
|
|
*
|
|
|
|
* @param aBindToTree Whether the element is being attached to the tree.
|
|
|
|
* @param aFormIdElement The element associated with the id in @form. If
|
|
|
|
* aBindToTree is false, aFormIdElement *must* contain the element associated
|
|
|
|
* with the id in @form. Otherwise, it *must* be null.
|
2010-08-25 13:45:43 -07:00
|
|
|
*
|
|
|
|
* @note Callers of UpdateFormOwner have to be sure the element is in a
|
2012-07-30 07:20:58 -07:00
|
|
|
* document (GetCurrentDoc() != nullptr).
|
2010-08-23 18:11:04 -07:00
|
|
|
*/
|
|
|
|
void UpdateFormOwner(bool aBindToTree, Element* aFormIdElement);
|
|
|
|
|
2010-09-18 14:33:16 -07:00
|
|
|
/**
|
|
|
|
* This method will update mFieldset and set it to the first fieldset parent.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
void UpdateFieldSet(bool aNotify);
|
2010-09-18 14:33:16 -07:00
|
|
|
|
2010-08-23 18:11:04 -07:00
|
|
|
/**
|
|
|
|
* Add a form id observer which will observe when the element with the id in
|
|
|
|
* @form will change.
|
|
|
|
*
|
|
|
|
* @return The element associated with the current id in @form (may be null).
|
|
|
|
*/
|
|
|
|
Element* AddFormIdObserver();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove the form id observer.
|
|
|
|
*/
|
|
|
|
void RemoveFormIdObserver();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method is a a callback for IDTargetObserver (from nsIDocument).
|
|
|
|
* It will be called each time the element associated with the id in @form
|
|
|
|
* changes.
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool FormIdUpdated(Element* aOldElement, Element* aNewElement,
|
2010-08-23 18:11:04 -07:00
|
|
|
void* aData);
|
|
|
|
|
2011-07-18 16:16:44 -07:00
|
|
|
// Returns true if the event should not be handled from PreHandleEvent
|
2013-01-03 07:17:36 -08:00
|
|
|
bool IsElementDisabledForEvents(uint32_t aMessage, nsIFrame* aFrame);
|
2011-07-18 16:16:44 -07:00
|
|
|
|
2008-10-07 11:53:23 -07:00
|
|
|
// The focusability state of this form control. eUnfocusable means that it
|
|
|
|
// shouldn't be focused at all, eInactiveWindow means it's in an inactive
|
|
|
|
// window, eActiveWindow means it's in an active window.
|
|
|
|
enum FocusTristate {
|
|
|
|
eUnfocusable,
|
|
|
|
eInactiveWindow,
|
|
|
|
eActiveWindow
|
|
|
|
};
|
|
|
|
|
|
|
|
// Get our focus state. If this returns eInactiveWindow, it will set this
|
|
|
|
// element as the focused element for that window.
|
|
|
|
FocusTristate FocusState();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** The form that contains this control */
|
2013-06-19 07:24:37 -07:00
|
|
|
mozilla::dom::HTMLFormElement* mForm;
|
2010-09-18 14:33:16 -07:00
|
|
|
|
|
|
|
/* This is a pointer to our closest fieldset parent if any */
|
2013-02-08 08:34:47 -08:00
|
|
|
mozilla::dom::HTMLFieldSetElement* mFieldSet;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2013-08-01 18:21:31 -07:00
|
|
|
class nsGenericHTMLFormElementWithState : public nsGenericHTMLFormElement
|
|
|
|
{
|
|
|
|
public:
|
2014-08-05 06:19:51 -07:00
|
|
|
explicit nsGenericHTMLFormElementWithState(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2013-08-01 18:21:31 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the presentation state for a piece of content, or create it if it does
|
|
|
|
* not exist. Generally used by SaveState().
|
|
|
|
*/
|
|
|
|
nsPresState* GetPrimaryPresState();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the layout history object for a particular piece of content.
|
|
|
|
*
|
|
|
|
* @param aRead if true, won't return a layout history state if the
|
|
|
|
* layout history state is empty.
|
|
|
|
* @return the history state object
|
|
|
|
*/
|
|
|
|
already_AddRefed<nsILayoutHistoryState>
|
|
|
|
GetLayoutHistory(bool aRead);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Restore the state for a form control. Ends up calling
|
|
|
|
* nsIFormControl::RestoreState().
|
|
|
|
*
|
|
|
|
* @return false if RestoreState() was not called, the return
|
|
|
|
* value of RestoreState() otherwise.
|
|
|
|
*/
|
|
|
|
bool RestoreFormControlState();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when we have been cloned and adopted, and the information of the
|
|
|
|
* node has been changed.
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void NodeInfoChanged(mozilla::dom::NodeInfo* aOldNodeInfo) override;
|
2013-08-01 18:21:31 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/* Generates the state key for saving the form state in the session if not
|
|
|
|
computed already. The result is stored in mStateKey on success */
|
|
|
|
nsresult GenerateStateKey();
|
|
|
|
|
|
|
|
/* Used to store the key to that element in the session. Is void until
|
|
|
|
GenerateStateKey has been used */
|
|
|
|
nsCString mStateKey;
|
|
|
|
};
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2011-08-10 23:07:26 -07:00
|
|
|
/**
|
|
|
|
* This macro is similar to NS_IMPL_STRING_ATTR except that the getter method
|
|
|
|
* falls back to an alternative method if the content attribute isn't set.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_STRING_ATTR_WITH_FALLBACK(_class, _method, _atom, _fallback) \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Get##_method(nsAString& aValue) \
|
|
|
|
{ \
|
|
|
|
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::_atom, aValue)) { \
|
|
|
|
_fallback(aValue); \
|
|
|
|
} \
|
|
|
|
return NS_OK; \
|
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Set##_method(const nsAString& aValue) \
|
|
|
|
{ \
|
|
|
|
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* A macro to implement the getter and setter for a given integer
|
|
|
|
* valued content property. The method uses the generic GetAttr and
|
|
|
|
* SetAttr methods.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_INT_ATTR(_class, _method, _atom) \
|
2010-10-18 22:53:15 -07:00
|
|
|
NS_IMPL_INT_ATTR_DEFAULT_VALUE(_class, _method, _atom, 0)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#define NS_IMPL_INT_ATTR_DEFAULT_VALUE(_class, _method, _atom, _default) \
|
|
|
|
NS_IMETHODIMP \
|
2012-08-22 08:56:38 -07:00
|
|
|
_class::Get##_method(int32_t* aValue) \
|
2007-03-22 10:30:00 -07:00
|
|
|
{ \
|
2012-10-02 01:24:12 -07:00
|
|
|
*aValue = GetIntAttr(nsGkAtoms::_atom, _default); \
|
|
|
|
return NS_OK; \
|
2007-03-22 10:30:00 -07:00
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
2012-08-22 08:56:38 -07:00
|
|
|
_class::Set##_method(int32_t aValue) \
|
2007-03-22 10:30:00 -07:00
|
|
|
{ \
|
2012-10-02 01:24:12 -07:00
|
|
|
return SetIntAttr(nsGkAtoms::_atom, aValue); \
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2010-11-06 02:30:27 -07:00
|
|
|
/**
|
|
|
|
* A macro to implement the getter and setter for a given unsigned integer
|
|
|
|
* valued content property. The method uses GetUnsignedIntAttr and
|
|
|
|
* SetUnsignedIntAttr methods.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_UINT_ATTR(_class, _method, _atom) \
|
|
|
|
NS_IMPL_UINT_ATTR_DEFAULT_VALUE(_class, _method, _atom, 0)
|
|
|
|
|
|
|
|
#define NS_IMPL_UINT_ATTR_DEFAULT_VALUE(_class, _method, _atom, _default) \
|
|
|
|
NS_IMETHODIMP \
|
2012-08-22 08:56:38 -07:00
|
|
|
_class::Get##_method(uint32_t* aValue) \
|
2010-11-06 02:30:27 -07:00
|
|
|
{ \
|
2013-04-04 00:03:50 -07:00
|
|
|
*aValue = GetUnsignedIntAttr(nsGkAtoms::_atom, _default); \
|
|
|
|
return NS_OK; \
|
2010-11-06 02:30:27 -07:00
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
2012-08-22 08:56:38 -07:00
|
|
|
_class::Set##_method(uint32_t aValue) \
|
2010-11-06 02:30:27 -07:00
|
|
|
{ \
|
2013-04-04 00:03:50 -07:00
|
|
|
mozilla::ErrorResult rv; \
|
|
|
|
SetUnsignedIntAttr(nsGkAtoms::_atom, aValue, rv); \
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult(); \
|
2010-11-06 02:30:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A macro to implement the getter and setter for a given unsigned integer
|
|
|
|
* valued content property. The method uses GetUnsignedIntAttr and
|
|
|
|
* SetUnsignedIntAttr methods. This macro is similar to NS_IMPL_UINT_ATTR except
|
|
|
|
* that it throws an exception if the set value is null.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_UINT_ATTR_NON_ZERO(_class, _method, _atom) \
|
|
|
|
NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(_class, _method, _atom, 1)
|
|
|
|
|
|
|
|
#define NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(_class, _method, _atom, _default) \
|
|
|
|
NS_IMETHODIMP \
|
2012-08-22 08:56:38 -07:00
|
|
|
_class::Get##_method(uint32_t* aValue) \
|
2010-11-06 02:30:27 -07:00
|
|
|
{ \
|
2013-04-04 00:03:50 -07:00
|
|
|
*aValue = GetUnsignedIntAttr(nsGkAtoms::_atom, _default); \
|
|
|
|
return NS_OK; \
|
2010-11-06 02:30:27 -07:00
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
2012-08-22 08:56:38 -07:00
|
|
|
_class::Set##_method(uint32_t aValue) \
|
2010-11-06 02:30:27 -07:00
|
|
|
{ \
|
|
|
|
if (aValue == 0) { \
|
|
|
|
return NS_ERROR_DOM_INDEX_SIZE_ERR; \
|
|
|
|
} \
|
2013-04-04 00:03:50 -07:00
|
|
|
mozilla::ErrorResult rv; \
|
|
|
|
SetUnsignedIntAttr(nsGkAtoms::_atom, aValue, rv); \
|
2015-04-27 06:18:51 -07:00
|
|
|
return rv.StealNSResult(); \
|
2010-11-06 02:30:27 -07:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* A macro to implement the getter and setter for a given content
|
|
|
|
* property that needs to return a URI in string form. The method
|
|
|
|
* uses the generic GetAttr and SetAttr methods. This macro is much
|
|
|
|
* like the NS_IMPL_STRING_ATTR macro, except we make sure the URI is
|
|
|
|
* absolute.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_URI_ATTR(_class, _method, _atom) \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Get##_method(nsAString& aValue) \
|
|
|
|
{ \
|
2012-11-10 15:30:15 -08:00
|
|
|
GetURIAttr(nsGkAtoms::_atom, nullptr, aValue); \
|
|
|
|
return NS_OK; \
|
2007-03-22 10:30:00 -07:00
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Set##_method(const nsAString& aValue) \
|
|
|
|
{ \
|
|
|
|
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_IMPL_URI_ATTR_WITH_BASE(_class, _method, _atom, _base_atom) \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Get##_method(nsAString& aValue) \
|
|
|
|
{ \
|
2012-11-10 15:30:15 -08:00
|
|
|
GetURIAttr(nsGkAtoms::_atom, nsGkAtoms::_base_atom, aValue); \
|
|
|
|
return NS_OK; \
|
2007-03-22 10:30:00 -07:00
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Set##_method(const nsAString& aValue) \
|
|
|
|
{ \
|
|
|
|
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
|
|
|
|
}
|
|
|
|
|
2010-10-29 12:49:42 -07:00
|
|
|
/**
|
|
|
|
* A macro to implement getter and setter for action and form action content
|
2010-10-29 12:52:42 -07:00
|
|
|
* attributes. It's very similar to NS_IMPL_URI_ATTR excepted that if the
|
2010-10-29 12:49:42 -07:00
|
|
|
* content attribute is the empty string, the empty string is returned.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_ACTION_ATTR(_class, _method, _atom) \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Get##_method(nsAString& aValue) \
|
|
|
|
{ \
|
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::_atom, aValue); \
|
2012-11-10 15:30:15 -08:00
|
|
|
if (!aValue.IsEmpty()) { \
|
|
|
|
GetURIAttr(nsGkAtoms::_atom, nullptr, aValue); \
|
2010-10-29 12:49:42 -07:00
|
|
|
} \
|
2012-11-10 15:30:15 -08:00
|
|
|
return NS_OK; \
|
2010-10-29 12:49:42 -07:00
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Set##_method(const nsAString& aValue) \
|
|
|
|
{ \
|
|
|
|
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
|
|
|
|
}
|
|
|
|
|
2010-03-05 11:42:46 -08:00
|
|
|
/**
|
|
|
|
* A macro to implement the getter and setter for a given content
|
|
|
|
* property that needs to set a non-negative integer. The method
|
|
|
|
* uses the generic GetAttr and SetAttr methods. This macro is much
|
|
|
|
* like the NS_IMPL_INT_ATTR macro except we throw an exception if
|
|
|
|
* the set value is negative.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_NON_NEGATIVE_INT_ATTR(_class, _method, _atom) \
|
|
|
|
NS_IMPL_NON_NEGATIVE_INT_ATTR_DEFAULT_VALUE(_class, _method, _atom, -1)
|
|
|
|
|
|
|
|
#define NS_IMPL_NON_NEGATIVE_INT_ATTR_DEFAULT_VALUE(_class, _method, _atom, _default) \
|
|
|
|
NS_IMETHODIMP \
|
2012-08-22 08:56:38 -07:00
|
|
|
_class::Get##_method(int32_t* aValue) \
|
2010-03-05 11:42:46 -08:00
|
|
|
{ \
|
2012-10-02 01:24:12 -07:00
|
|
|
*aValue = GetIntAttr(nsGkAtoms::_atom, _default); \
|
|
|
|
return NS_OK; \
|
2010-03-05 11:42:46 -08:00
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
2012-08-22 08:56:38 -07:00
|
|
|
_class::Set##_method(int32_t aValue) \
|
2010-03-05 11:42:46 -08:00
|
|
|
{ \
|
|
|
|
if (aValue < 0) { \
|
|
|
|
return NS_ERROR_DOM_INDEX_SIZE_ERR; \
|
|
|
|
} \
|
|
|
|
return SetIntAttr(nsGkAtoms::_atom, aValue); \
|
|
|
|
}
|
|
|
|
|
2010-04-15 04:03:00 -07:00
|
|
|
/**
|
|
|
|
* A macro to implement the getter and setter for a given content
|
|
|
|
* property that needs to set an enumerated string. The method
|
|
|
|
* uses a specific GetEnumAttr and the generic SetAttrHelper methods.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(_class, _method, _atom, _default) \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Get##_method(nsAString& aValue) \
|
|
|
|
{ \
|
2012-11-10 15:30:15 -08:00
|
|
|
GetEnumAttr(nsGkAtoms::_atom, _default, aValue); \
|
|
|
|
return NS_OK; \
|
2010-04-15 04:03:00 -07:00
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Set##_method(const nsAString& aValue) \
|
|
|
|
{ \
|
|
|
|
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
|
|
|
|
}
|
|
|
|
|
2013-01-22 17:35:57 -08:00
|
|
|
/**
|
|
|
|
* A macro to implement the getter and setter for a given content
|
|
|
|
* property that needs to set an enumerated string that has different
|
|
|
|
* default values for missing and invalid values. The method uses a
|
|
|
|
* specific GetEnumAttr and the generic SetAttrHelper methods.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_ENUM_ATTR_DEFAULT_MISSING_INVALID_VALUES(_class, _method, _atom, _defaultMissing, _defaultInvalid) \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Get##_method(nsAString& aValue) \
|
|
|
|
{ \
|
|
|
|
GetEnumAttr(nsGkAtoms::_atom, _defaultMissing, _defaultInvalid, aValue); \
|
|
|
|
return NS_OK; \
|
|
|
|
} \
|
|
|
|
NS_IMETHODIMP \
|
|
|
|
_class::Set##_method(const nsAString& aValue) \
|
|
|
|
{ \
|
|
|
|
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#define NS_INTERFACE_MAP_ENTRY_IF_TAG(_interface, _tag) \
|
|
|
|
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(_interface, \
|
|
|
|
mNodeInfo->Equals(nsGkAtoms::_tag))
|
|
|
|
|
|
|
|
|
2010-10-25 05:17:38 -07:00
|
|
|
/**
|
|
|
|
* A macro to declare the NS_NewHTMLXXXElement() functions.
|
|
|
|
*/
|
2010-07-23 02:49:57 -07:00
|
|
|
#define NS_DECLARE_NS_NEW_HTML_ELEMENT(_elementName) \
|
2012-12-21 06:06:49 -08:00
|
|
|
namespace mozilla { \
|
|
|
|
namespace dom { \
|
|
|
|
class HTML##_elementName##Element; \
|
|
|
|
} \
|
|
|
|
} \
|
2010-07-23 02:49:57 -07:00
|
|
|
nsGenericHTMLElement* \
|
2014-06-19 19:01:40 -07:00
|
|
|
NS_NewHTML##_elementName##Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
2010-10-25 05:17:38 -07:00
|
|
|
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-23 02:49:57 -07:00
|
|
|
#define NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(_elementName) \
|
|
|
|
inline nsGenericHTMLElement* \
|
2014-06-19 19:01:40 -07:00
|
|
|
NS_NewHTML##_elementName##Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
2010-10-25 05:17:38 -07:00
|
|
|
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER) \
|
2010-07-23 02:49:57 -07:00
|
|
|
{ \
|
2014-03-15 12:00:17 -07:00
|
|
|
return NS_NewHTMLSharedElement(mozilla::Move(aNodeInfo), aFromParser); \
|
2010-04-19 12:06:00 -07:00
|
|
|
}
|
|
|
|
|
2010-10-25 05:17:38 -07:00
|
|
|
/**
|
|
|
|
* A macro to implement the NS_NewHTMLXXXElement() functions.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_NS_NEW_HTML_ELEMENT(_elementName) \
|
|
|
|
nsGenericHTMLElement* \
|
2014-06-19 19:01:40 -07:00
|
|
|
NS_NewHTML##_elementName##Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
2010-10-25 05:17:38 -07:00
|
|
|
mozilla::dom::FromParser aFromParser) \
|
|
|
|
{ \
|
2013-06-26 07:59:46 -07:00
|
|
|
return new mozilla::dom::HTML##_elementName##Element(aNodeInfo); \
|
2010-10-25 05:17:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(_elementName) \
|
|
|
|
nsGenericHTMLElement* \
|
2014-06-19 19:01:40 -07:00
|
|
|
NS_NewHTML##_elementName##Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
2010-10-25 05:17:38 -07:00
|
|
|
mozilla::dom::FromParser aFromParser) \
|
|
|
|
{ \
|
2013-06-26 07:59:46 -07:00
|
|
|
return new mozilla::dom::HTML##_elementName##Element(aNodeInfo, \
|
|
|
|
aFromParser); \
|
2010-10-25 05:17:38 -07:00
|
|
|
}
|
|
|
|
|
2010-07-14 09:27:31 -07:00
|
|
|
// Here, we expand 'NS_DECLARE_NS_NEW_HTML_ELEMENT()' by hand.
|
|
|
|
// (Calling the macro directly (with no args) produces compiler warnings.)
|
|
|
|
nsGenericHTMLElement*
|
2014-06-19 19:01:40 -07:00
|
|
|
NS_NewHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
2010-10-25 05:17:38 -07:00
|
|
|
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
|
2010-06-26 14:58:01 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
|
2013-02-08 04:20:11 -08:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject)
|
|
|
|
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Anchor)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Area)
|
2008-07-09 01:22:20 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Audio)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(BR)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Body)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Button)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Canvas)
|
2013-12-02 02:26:12 -08:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Content)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Mod)
|
2013-02-26 12:19:05 -08:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Data)
|
2010-09-09 22:16:56 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(DataList)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Div)
|
2015-06-30 11:27:57 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(ExtApp)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(FieldSet)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Font)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Form)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Frame)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(FrameSet)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(HR)
|
2010-04-19 12:06:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(Head)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Heading)
|
2010-04-19 12:06:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(Html)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(IFrame)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Image)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Input)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(LI)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Label)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Legend)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Link)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Map)
|
2011-08-08 10:31:32 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Menu)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(MenuItem)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Meta)
|
2012-05-16 04:18:33 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Meter)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Object)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(OptGroup)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Option)
|
2010-04-26 00:42:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Output)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Paragraph)
|
2014-03-06 15:46:38 -08:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Picture)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre)
|
2011-04-09 10:22:02 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Progress)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Select)
|
2013-12-20 22:43:58 -08:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shadow)
|
2008-07-09 01:22:20 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Source)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Span)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Style)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableCaption)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableCell)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableCol)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Table)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableRow)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableSection)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Tbody)
|
2013-03-26 00:15:23 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Template)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(TextArea)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Tfoot)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Thead)
|
2013-02-22 07:07:42 -08:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Time)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Title)
|
2013-05-21 09:14:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Track)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Unknown)
|
2008-07-09 01:22:20 -07:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Video)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-11-09 07:59:33 -08:00
|
|
|
inline nsISupports*
|
|
|
|
ToSupports(nsGenericHTMLElement* aHTMLElement)
|
|
|
|
{
|
2013-08-07 13:23:08 -07:00
|
|
|
return static_cast<nsIContent*>(aHTMLElement);
|
2012-11-09 07:59:33 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
inline nsISupports*
|
|
|
|
ToCanonicalSupports(nsGenericHTMLElement* aHTMLElement)
|
|
|
|
{
|
2013-08-07 13:23:08 -07:00
|
|
|
return static_cast<nsIContent*>(aHTMLElement);
|
2012-11-09 07:59:33 -08:00
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif /* nsGenericHTMLElement_h___ */
|