2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-09-04 02:21:32 +04:00
|
|
|
#ifndef nsGenericHTMLElement_h___
|
|
|
|
#define nsGenericHTMLElement_h___
|
1998-08-29 03:27:19 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2015-08-26 15:56:59 +03:00
|
|
|
#include "mozilla/EventForwards.h"
|
2008-01-09 12:38:28 +03:00
|
|
|
#include "nsMappedAttributeElement.h"
|
2018-01-30 08:25:36 +03:00
|
|
|
#include "nsIDOMElement.h"
|
2014-02-28 03:04:46 +04:00
|
|
|
#include "nsNameSpaceManager.h" // for kNameSpaceID_None
|
2000-12-23 13:56:31 +03:00
|
|
|
#include "nsIFormControl.h"
|
2007-06-28 06:48:16 +04:00
|
|
|
#include "nsGkAtoms.h"
|
2010-08-17 18:13:55 +04:00
|
|
|
#include "nsContentCreatorFunctions.h"
|
2012-10-06 11:19:51 +04:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2016-11-15 08:18:33 +03:00
|
|
|
#include "mozilla/dom/BindingDeclarations.h"
|
2013-09-20 14:21:03 +04:00
|
|
|
#include "mozilla/dom/DOMRect.h"
|
2013-01-16 22:01:01 +04:00
|
|
|
#include "mozilla/dom/ValidityState.h"
|
2016-12-13 10:11:04 +03:00
|
|
|
#include "mozilla/dom/Element.h"
|
1998-08-29 03:27:19 +04:00
|
|
|
|
2016-02-12 01:50:42 +03:00
|
|
|
class nsDOMTokenList;
|
2014-03-19 17:05:17 +04:00
|
|
|
class nsIFormControlFrame;
|
1998-08-29 03:27:19 +04:00
|
|
|
class nsIFrame;
|
2014-03-19 17:05:17 +04:00
|
|
|
class nsILayoutHistoryState;
|
1999-06-23 07:29:44 +04:00
|
|
|
class nsIURI;
|
2005-01-28 01:52:53 +03:00
|
|
|
class nsPresState;
|
2003-01-22 09:25:24 +03:00
|
|
|
struct nsSize;
|
2012-12-09 02:06:42 +04:00
|
|
|
|
2012-11-11 03:30:15 +04:00
|
|
|
namespace mozilla {
|
2014-03-18 08:48:20 +04:00
|
|
|
class EventChainPostVisitor;
|
2014-03-18 08:48:19 +04:00
|
|
|
class EventChainPreVisitor;
|
2014-03-18 08:48:18 +04:00
|
|
|
class EventChainVisitor;
|
2014-03-17 10:56:53 +04:00
|
|
|
class EventListenerManager;
|
2014-04-03 08:18:36 +04:00
|
|
|
class EventStates;
|
2017-06-22 09:21:31 +03:00
|
|
|
class TextEditor;
|
2013-09-20 14:21:03 +04:00
|
|
|
namespace dom {
|
2013-06-19 18:24:37 +04:00
|
|
|
class HTMLFormElement;
|
2013-02-18 15:59:08 +04:00
|
|
|
class HTMLMenuElement;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2005-01-12 22:45:38 +03:00
|
|
|
|
2008-01-09 12:38:28 +03:00
|
|
|
typedef nsMappedAttributeElement nsGenericHTMLElementBase;
|
1998-09-25 04:51:45 +04:00
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* A common superclass for HTML elements
|
|
|
|
*/
|
2013-08-08 00:23:08 +04:00
|
|
|
class nsGenericHTMLElement : public nsGenericHTMLElementBase,
|
2018-01-30 08:25:36 +03:00
|
|
|
public nsIDOMElement
|
2001-10-30 13:14:06 +03:00
|
|
|
{
|
1998-09-05 03:03:16 +04:00
|
|
|
public:
|
2016-05-24 07:22:17 +03:00
|
|
|
using Element::SetTabIndex;
|
|
|
|
using Element::Focus;
|
2014-08-05 17:19:51 +04:00
|
|
|
explicit nsGenericHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2016-06-07 00:45:46 +03:00
|
|
|
: nsGenericHTMLElementBase(aNodeInfo)
|
2004-05-19 00:58:12 +04:00
|
|
|
{
|
2010-07-23 13:49:57 +04:00
|
|
|
NS_ASSERTION(mNodeInfo->NamespaceID() == kNameSpaceID_XHTML,
|
2009-10-02 00:17:26 +04:00
|
|
|
"Unexpected namespace");
|
2012-08-10 07:37:58 +04:00
|
|
|
AddStatesSilently(NS_EVENT_STATE_LTR);
|
2012-04-17 08:03:10 +04:00
|
|
|
SetFlags(NODE_HAS_DIRECTION_LTR);
|
2004-05-19 00:58:12 +04:00
|
|
|
}
|
2001-10-30 13:14:06 +03:00
|
|
|
|
2013-08-08 00:23:08 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2005-01-12 22:45:38 +03:00
|
|
|
|
2013-08-08 00:23:08 +04:00
|
|
|
NS_IMPL_FROMCONTENT(nsGenericHTMLElement, kNameSpaceID_XHTML)
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2012-11-15 02:10:08 +04:00
|
|
|
// From Element
|
2017-04-20 22:57:48 +03:00
|
|
|
nsresult CopyInnerTo(mozilla::dom::Element* aDest, bool aPreallocateChildren);
|
1999-01-15 02:14:02 +03:00
|
|
|
|
2015-02-13 04:27:39 +03:00
|
|
|
void GetTitle(mozilla::dom::DOMString& aTitle)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::title, aTitle);
|
|
|
|
}
|
2017-07-14 06:45:49 +03:00
|
|
|
void SetTitle(const nsAString& aTitle)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::title, aTitle);
|
|
|
|
}
|
2015-02-13 04:27:39 +03:00
|
|
|
void GetLang(mozilla::dom::DOMString& aLang)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::lang, aLang);
|
|
|
|
}
|
2017-07-14 06:45:49 +03:00
|
|
|
void SetLang(const nsAString& aLang)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::lang, aLang);
|
|
|
|
}
|
2017-07-14 06:45:49 +03:00
|
|
|
void GetDir(nsAString& aDir)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
GetHTMLEnumAttr(nsGkAtoms::dir, aDir);
|
|
|
|
}
|
|
|
|
void SetDir(const nsAString& aDir, mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::dir, aDir, aError);
|
|
|
|
}
|
|
|
|
bool Hidden() const
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::hidden);
|
|
|
|
}
|
|
|
|
void SetHidden(bool aHidden, mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::hidden, aHidden, aError);
|
|
|
|
}
|
2016-11-15 08:18:33 +03:00
|
|
|
void Click(mozilla::dom::CallerType aCallerType);
|
2013-08-08 00:23:08 +04:00
|
|
|
void GetAccessKey(nsString& aAccessKey)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
GetHTMLAttr(nsGkAtoms::accesskey, aAccessKey);
|
|
|
|
}
|
|
|
|
void SetAccessKey(const nsAString& aAccessKey, mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::accesskey, aAccessKey, aError);
|
|
|
|
}
|
2013-08-08 00:23:08 +04:00
|
|
|
void GetAccessKeyLabel(nsString& aAccessKeyLabel);
|
2012-10-06 11:19:52 +04:00
|
|
|
virtual bool Draggable() const
|
|
|
|
{
|
|
|
|
return AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
|
|
|
|
nsGkAtoms::_true, eIgnoreCase);
|
|
|
|
}
|
|
|
|
void SetDraggable(bool aDraggable, mozilla::ErrorResult& aError)
|
|
|
|
{
|
2012-11-11 03:30:15 +04:00
|
|
|
SetHTMLAttr(nsGkAtoms::draggable,
|
|
|
|
aDraggable ? NS_LITERAL_STRING("true")
|
|
|
|
: NS_LITERAL_STRING("false"),
|
|
|
|
aError);
|
2012-11-11 03:30:15 +04:00
|
|
|
}
|
2013-08-08 00:23:08 +04:00
|
|
|
void GetContentEditable(nsString& aContentEditable)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
2012-11-11 03:30:15 +04:00
|
|
|
ContentEditableTristate value = GetContentEditableValue();
|
|
|
|
if (value == eTrue) {
|
|
|
|
aContentEditable.AssignLiteral("true");
|
|
|
|
} else if (value == eFalse) {
|
|
|
|
aContentEditable.AssignLiteral("false");
|
|
|
|
} else {
|
|
|
|
aContentEditable.AssignLiteral("inherit");
|
|
|
|
}
|
2012-10-06 11:19:52 +04:00
|
|
|
}
|
2012-11-11 03:30:15 +04:00
|
|
|
void SetContentEditable(const nsAString& aContentEditable,
|
|
|
|
mozilla::ErrorResult& aError)
|
2012-10-06 11:19:52 +04:00
|
|
|
{
|
2013-01-13 00:47:45 +04:00
|
|
|
if (aContentEditable.LowerCaseEqualsLiteral("inherit")) {
|
2012-11-11 03:30:15 +04:00
|
|
|
UnsetHTMLAttr(nsGkAtoms::contenteditable, aError);
|
2013-01-13 00:47:45 +04:00
|
|
|
} else if (aContentEditable.LowerCaseEqualsLiteral("true")) {
|
2012-11-11 03:30:15 +04:00
|
|
|
SetHTMLAttr(nsGkAtoms::contenteditable, NS_LITERAL_STRING("true"), aError);
|
2013-01-13 00:47:45 +04:00
|
|
|
} else if (aContentEditable.LowerCaseEqualsLiteral("false")) {
|
2012-11-11 03:30:15 +04: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 11:19:52 +04:00
|
|
|
}
|
2015-08-14 20:52:38 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the count of descendants (inclusive of this node) in
|
|
|
|
* the uncomposed document that are explicitly set as editable.
|
|
|
|
*/
|
|
|
|
uint32_t EditableInclusiveDescendantCount();
|
|
|
|
|
2013-02-18 15:59:08 +04:00
|
|
|
mozilla::dom::HTMLMenuElement* GetContextMenu() const;
|
2012-11-11 03:30:15 +04:00
|
|
|
bool Spellcheck();
|
|
|
|
void SetSpellcheck(bool aSpellcheck, mozilla::ErrorResult& aError)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
2012-11-11 03:30:15 +04:00
|
|
|
SetHTMLAttr(nsGkAtoms::spellcheck,
|
|
|
|
aSpellcheck ? NS_LITERAL_STRING("true")
|
|
|
|
: NS_LITERAL_STRING("false"),
|
|
|
|
aError);
|
2012-11-11 03:30:15 +04:00
|
|
|
}
|
2013-01-03 00:24:07 +04:00
|
|
|
|
2017-12-05 19:18:16 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2015-10-30 08:37:03 +03:00
|
|
|
void GetInnerText(mozilla::dom::DOMString& aValue, mozilla::ErrorResult& aError);
|
|
|
|
void SetInnerText(const nsAString& aValue);
|
|
|
|
|
2013-01-08 07:22:41 +04:00
|
|
|
/**
|
|
|
|
* Determine whether an attribute is an event (onclick, etc.)
|
|
|
|
* @param aName the attribute
|
|
|
|
* @return whether the name is an event handler name
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;
|
2013-01-03 00:24:07 +04:00
|
|
|
|
2012-11-26 18:19:02 +04: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 15:01:28 +04:00
|
|
|
void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler);
|
2012-11-26 18:19:02 +04: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 15:01:28 +04:00
|
|
|
void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler);
|
2014-04-01 15:42:12 +04:00
|
|
|
#include "mozilla/EventNameList.h" // IWYU pragma: keep
|
2012-11-26 18:19:02 +04:00
|
|
|
#undef ERROR_EVENT
|
|
|
|
#undef FORWARDED_EVENT
|
|
|
|
#undef EVENT
|
2012-11-15 02:10:08 +04:00
|
|
|
mozilla::dom::Element* GetOffsetParent()
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
2013-06-12 11:00:08 +04:00
|
|
|
mozilla::CSSIntRect rcFrame;
|
2012-11-11 03:30:15 +04:00
|
|
|
return GetOffsetRect(rcFrame);
|
2012-10-06 11:19:52 +04:00
|
|
|
}
|
2012-11-11 03:30:15 +04:00
|
|
|
int32_t OffsetTop()
|
2012-10-06 11:19:52 +04:00
|
|
|
{
|
2013-06-12 11:00:08 +04:00
|
|
|
mozilla::CSSIntRect rcFrame;
|
2012-11-11 03:30:15 +04:00
|
|
|
GetOffsetRect(rcFrame);
|
|
|
|
|
2018-02-19 23:15:23 +03:00
|
|
|
return rcFrame.y;
|
2012-11-11 03:30:15 +04:00
|
|
|
}
|
2012-11-11 03:30:15 +04:00
|
|
|
int32_t OffsetLeft()
|
|
|
|
{
|
2013-06-12 11:00:08 +04:00
|
|
|
mozilla::CSSIntRect rcFrame;
|
2012-11-11 03:30:15 +04:00
|
|
|
GetOffsetRect(rcFrame);
|
2012-11-11 03:30:15 +04:00
|
|
|
|
2018-02-19 23:15:23 +03:00
|
|
|
return rcFrame.x;
|
2012-11-11 03:30:15 +04:00
|
|
|
}
|
|
|
|
int32_t OffsetWidth()
|
2012-11-14 20:45:28 +04:00
|
|
|
{
|
2013-06-12 11:00:08 +04:00
|
|
|
mozilla::CSSIntRect rcFrame;
|
2012-11-11 03:30:15 +04:00
|
|
|
GetOffsetRect(rcFrame);
|
|
|
|
|
2017-08-14 15:30:10 +03:00
|
|
|
return rcFrame.Width();
|
2012-11-14 20:45:28 +04:00
|
|
|
}
|
2012-11-11 03:30:15 +04:00
|
|
|
int32_t OffsetHeight()
|
2012-11-14 20:45:28 +04:00
|
|
|
{
|
2013-06-12 11:00:08 +04:00
|
|
|
mozilla::CSSIntRect rcFrame;
|
2012-11-11 03:30:15 +04:00
|
|
|
GetOffsetRect(rcFrame);
|
|
|
|
|
2017-08-14 15:30:10 +03:00
|
|
|
return rcFrame.Height();
|
2012-11-11 03:30:15 +04:00
|
|
|
}
|
|
|
|
|
2015-03-03 14:09:01 +03: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;
|
|
|
|
}
|
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
inline bool IsHTMLElement(nsAtom* aTag) const
|
2015-03-03 14:09:01 +03:00
|
|
|
{
|
|
|
|
return mNodeInfo->Equals(aTag);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename First, typename... Args>
|
|
|
|
inline bool IsAnyOfHTMLElements(First aFirst, Args... aArgs) const
|
|
|
|
{
|
|
|
|
return IsNodeInternal(aFirst, aArgs...);
|
|
|
|
}
|
|
|
|
|
2012-06-05 03:49:57 +04:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~nsGenericHTMLElement() {}
|
|
|
|
|
2012-06-05 03:49:57 +04:00
|
|
|
public:
|
2012-06-27 09:17:31 +04:00
|
|
|
/**
|
|
|
|
* Get width and height, using given image request if attributes are unset.
|
2014-03-26 22:43:27 +04: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-27 09:17:31 +04:00
|
|
|
*/
|
2017-12-05 19:18:16 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2015-10-18 08:24:48 +03:00
|
|
|
nsSize GetWidthHeightForImage(RefPtr<imgRequestProxy>& aImageRequest);
|
2012-06-27 09:17:31 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIDOMNode* AsDOMNode() override { return this; }
|
2013-08-08 00:23:08 +04:00
|
|
|
|
2011-11-10 16:02:22 +04:00
|
|
|
public:
|
1998-08-29 03:27:19 +04:00
|
|
|
// Implementation for nsIContent
|
2005-04-06 03:54:35 +04:00
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aCompileEventHandlers) override;
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNullParent = true) override;
|
2014-09-15 04:56:59 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFocusableInternal(int32_t *aTabIndex, bool aWithMouse) override
|
2008-04-15 22:40:38 +04:00
|
|
|
{
|
2011-09-29 10:19:26 +04:00
|
|
|
bool isFocusable = false;
|
2010-06-21 16:37:34 +04:00
|
|
|
IsHTMLFocusable(aWithMouse, &isFocusable, aTabIndex);
|
2008-04-15 22:40:38 +04:00
|
|
|
return isFocusable;
|
|
|
|
}
|
|
|
|
/**
|
2011-10-17 18:59:28 +04:00
|
|
|
* Returns true if a subclass is not allowed to override the value returned
|
2008-04-15 22:40:38 +04:00
|
|
|
* in aIsFocusable.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsHTMLFocusable(bool aWithMouse,
|
2013-02-12 08:56:03 +04:00
|
|
|
bool *aIsFocusable,
|
|
|
|
int32_t *aTabIndex);
|
2015-09-18 15:18:42 +03:00
|
|
|
virtual bool PerformAccesskey(bool aKeyCausesActivation,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aIsTrustedEvent) override;
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2007-04-23 11:31:21 +04:00
|
|
|
/**
|
|
|
|
* Check if an event for an anchor can be handled
|
2011-10-17 18:59:28 +04:00
|
|
|
* @return true if the event can be handled, false otherwise
|
2007-04-23 11:31:21 +04:00
|
|
|
*/
|
2014-03-18 08:48:18 +04:00
|
|
|
bool CheckHandleEventForAnchorsPreconditions(
|
|
|
|
mozilla::EventChainVisitor& aVisitor);
|
2016-10-21 05:11:07 +03:00
|
|
|
nsresult GetEventTargetParentForAnchors(
|
|
|
|
mozilla::EventChainPreVisitor& aVisitor);
|
2014-03-18 08:48:20 +04:00
|
|
|
nsresult PostHandleEventForAnchors(mozilla::EventChainPostVisitor& aVisitor);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsHTMLLink(nsIURI** aURI) const;
|
1998-08-29 03:27:19 +04:00
|
|
|
|
2005-01-12 22:45:38 +03:00
|
|
|
// HTML element methods
|
2008-02-03 02:41:24 +03:00
|
|
|
void Compact() { mAttrsAndChildren.Compact(); }
|
2005-01-12 22:45:38 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void UpdateEditableState(bool aNotify) override;
|
2011-06-01 05:46:57 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::EventStates IntrinsicState() const override;
|
2012-04-17 08:03:10 +04:00
|
|
|
|
2011-06-01 05:46:57 +04:00
|
|
|
// Helper for setting our editable flag and notifying
|
2011-09-29 10:19:26 +04:00
|
|
|
void DoSetEditableFlag(bool aEditable, bool aNotify) {
|
2011-06-01 05:46:57 +04:00
|
|
|
SetEditableFlag(aEditable);
|
|
|
|
UpdateState(aNotify);
|
|
|
|
}
|
2007-06-28 06:48:16 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAttribute,
|
2012-08-24 21:50:49 +04:00
|
|
|
const nsAString& aValue,
|
2017-11-02 06:35:52 +03:00
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsAttrValue& aResult) override;
|
2012-08-24 21:50:49 +04:00
|
|
|
|
|
|
|
bool ParseBackgroundAttribute(int32_t aNamespaceID,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAttribute,
|
2004-03-04 05:06:28 +03:00
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult);
|
2004-01-26 22:22:05 +03:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
|
1998-08-29 03:27:19 +04:00
|
|
|
|
2004-02-20 22:00:43 +03: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;
|
|
|
|
|
2002-05-16 22:26:05 +04:00
|
|
|
/**
|
2009-12-25 00:20:05 +03:00
|
|
|
* Get the primary form control frame for this element. Same as
|
|
|
|
* GetPrimaryFrame(), except it QI's to nsIFormControlFrame.
|
2002-05-16 22:26:05 +04:00
|
|
|
*
|
2009-12-25 00:20:05 +03:00
|
|
|
* @param aFlush whether to flush out frames so that they're up to date.
|
|
|
|
* @return the primary frame as nsIFormControlFrame
|
2002-05-16 22:26:05 +04:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
nsIFormControlFrame* GetFormControlFrame(bool aFlushFrames);
|
1998-08-29 07:16:46 +04:00
|
|
|
|
1998-08-29 03:27:19 +04:00
|
|
|
//----------------------------------------
|
|
|
|
|
2002-07-28 05:47:59 +04: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-29 10:19:26 +04:00
|
|
|
static bool ParseAlignValue(const nsAString& aString,
|
2004-03-04 05:06:28 +03:00
|
|
|
nsAttrValue& aResult);
|
1998-09-01 05:36:11 +04:00
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* 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-29 10:19:26 +04:00
|
|
|
static bool ParseDivAlignValue(const nsAString& aString,
|
2010-07-06 08:25:52 +04:00
|
|
|
nsAttrValue& aResult);
|
1998-09-04 02:21:32 +04:00
|
|
|
|
2002-07-28 05:47:59 +04: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-29 10:19:26 +04:00
|
|
|
static bool ParseTableHAlignValue(const nsAString& aString,
|
2010-06-11 22:47:56 +04:00
|
|
|
nsAttrValue& aResult);
|
1999-09-21 04:12:09 +04:00
|
|
|
|
2002-07-28 05:47:59 +04: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-29 10:19:26 +04:00
|
|
|
static bool ParseTableCellHAlignValue(const nsAString& aString,
|
2010-07-31 03:48:57 +04:00
|
|
|
nsAttrValue& aResult);
|
1998-09-15 21:58:24 +04:00
|
|
|
|
2002-07-28 05:47:59 +04: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-29 10:19:26 +04:00
|
|
|
static bool ParseTableVAlignValue(const nsAString& aString,
|
2004-03-04 05:06:28 +03:00
|
|
|
nsAttrValue& aResult);
|
2002-01-18 23:09:04 +03:00
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
static bool ParseImageAttribute(nsAtom* aAttribute,
|
2002-03-24 02:13:20 +03:00
|
|
|
const nsAString& aString,
|
2004-03-04 05:06:28 +03:00
|
|
|
nsAttrValue& aResult);
|
2015-06-06 01:25:24 +03:00
|
|
|
|
|
|
|
static bool ParseReferrerAttribute(const nsAString& aString,
|
|
|
|
nsAttrValue& aResult);
|
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* 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-29 10:19:26 +04:00
|
|
|
static bool ParseFrameborderValue(const nsAString& aString,
|
2004-03-04 05:06:28 +03:00
|
|
|
nsAttrValue& aResult);
|
1999-07-07 05:24:40 +04:00
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* 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-29 10:19:26 +04:00
|
|
|
static bool ParseScrollingValue(const nsAString& aString,
|
2004-03-04 05:06:28 +03:00
|
|
|
nsAttrValue& aResult);
|
1999-07-07 05:24:40 +04:00
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/*
|
|
|
|
* Attribute Mapping Helpers
|
1999-07-07 05:24:40 +04:00
|
|
|
*/
|
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* A style attribute mapping function for the most common attributes, to be
|
|
|
|
* called by subclasses' attribute mapping functions. Currently handles
|
2013-07-11 18:39:18 +04:00
|
|
|
* dir, lang and hidden, could handle others.
|
2002-07-28 05:47:59 +04:00
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
2017-07-06 15:00:35 +03:00
|
|
|
static void MapCommonAttributesInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2013-07-11 18:39:18 +04: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,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2010-12-03 17:22:11 +03:00
|
|
|
|
2004-02-26 00:04:50 +03: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[];
|
2005-10-27 00:23:56 +04:00
|
|
|
static const MappedAttributeEntry sBackgroundColorAttributeMap[];
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2004-01-26 22:22:05 +03:00
|
|
|
static void MapImageAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2002-09-26 12:18:42 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2004-01-26 22:22:05 +03:00
|
|
|
static void MapDivAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2017-01-27 03:51:01 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper to map the valign attribute into a style struct for things
|
|
|
|
* like <col>, <tr>, <section>, etc.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapVAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2002-09-26 12:18:42 +04:00
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2004-01-26 22:22:05 +03:00
|
|
|
static void MapImageBorderAttributeInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2004-01-26 22:22:05 +03:00
|
|
|
static void MapImageMarginAttributeInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2004-01-26 22:22:05 +03:00
|
|
|
static void MapImageSizeAttributesInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2017-01-27 03:51:01 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper to map `width` attribute into a style struct.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapWidthAttributeInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2017-01-27 03:51:01 +03:00
|
|
|
/**
|
|
|
|
* Helper to map `height` attribute into a style struct.
|
|
|
|
*
|
|
|
|
* @param aAttributes the list of attributes to map
|
|
|
|
* @param aData the returned rule data [INOUT]
|
|
|
|
* @see GetAttributeMappingFunction
|
|
|
|
*/
|
|
|
|
static void MapHeightAttributeInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2005-10-27 00:23:56 +04:00
|
|
|
/**
|
|
|
|
* 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,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2005-10-27 00:23:56 +04:00
|
|
|
/**
|
|
|
|
* 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,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2004-01-26 22:22:05 +03:00
|
|
|
static void MapBackgroundAttributesInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2003-09-25 07:55:04 +04:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2004-01-26 22:22:05 +03:00
|
|
|
static void MapScrollingAttributeInto(const nsMappedAttributes* aAttributes,
|
2017-01-27 03:51:01 +03:00
|
|
|
mozilla::GenericSpecifiedValues* aGenericData);
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
2004-08-21 00:34:37 +04:00
|
|
|
* Get the presentation context for this content node.
|
|
|
|
* @return the presentation context
|
2002-07-28 05:47:59 +04:00
|
|
|
*/
|
2014-08-23 00:11:27 +04:00
|
|
|
enum PresContextFor
|
|
|
|
{
|
|
|
|
eForComposedDoc,
|
|
|
|
eForUncomposedDoc
|
|
|
|
};
|
|
|
|
nsPresContext* GetPresContext(PresContextFor aFor);
|
1999-02-01 21:44:59 +03:00
|
|
|
|
2001-03-02 18:45:35 +03:00
|
|
|
// Form Helper Routines
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* Find an ancestor of this content node which is a form (could be null)
|
2005-05-02 08:41:06 +04:00
|
|
|
* @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-24 05:11:04 +04:00
|
|
|
* @note This method should not be called if the element has a form attribute.
|
2002-07-28 05:47:59 +04:00
|
|
|
*/
|
2013-06-19 18:24:37 +04:00
|
|
|
mozilla::dom::HTMLFormElement*
|
|
|
|
FindAncestorForm(mozilla::dom::HTMLFormElement* aCurrentForm = nullptr);
|
2001-03-02 18:45:35 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void RecompileScriptEventListeners() override;
|
2006-10-07 14:27:45 +04:00
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* See if the document being tested has nav-quirks mode enabled.
|
|
|
|
* @param doc the document
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool InNavQuirksMode(nsIDocument* aDoc);
|
1999-08-28 01:42:08 +04:00
|
|
|
|
2010-08-20 03:23:59 +04:00
|
|
|
/**
|
|
|
|
* 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]
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
void GetURIAttr(nsAtom* aAttr, nsAtom* aBaseAttr, nsAString& aResult) const;
|
2010-08-20 03:23:59 +04:00
|
|
|
|
2012-04-11 10:16:00 +04: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.
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
bool GetURIAttr(nsAtom* aAttr, nsAtom* aBaseAttr, nsIURI** aURI) const;
|
2012-04-11 10:16:00 +04:00
|
|
|
|
2010-09-19 01:33:16 +04:00
|
|
|
/**
|
|
|
|
* Returns the current disabled state of the element.
|
2018-02-10 22:01:36 +03:00
|
|
|
*
|
|
|
|
* TODO(emilio): Consider moving to Element?
|
2010-09-19 01:33:16 +04:00
|
|
|
*/
|
2018-02-10 22:01:36 +03:00
|
|
|
bool IsDisabled() const {
|
|
|
|
return State().HasState(NS_EVENT_STATE_DISABLED);
|
2010-09-19 01:33:16 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsHidden() const
|
2011-08-08 21:31:32 +04:00
|
|
|
{
|
|
|
|
return HasAttr(kNameSpaceID_None, nsGkAtoms::hidden);
|
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsLabelable() const override;
|
2017-06-16 03:04:00 +03:00
|
|
|
|
|
|
|
static bool MatchLabelsElement(Element* aElement, int32_t aNamespaceID,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAtom, void* aData);
|
2017-06-16 03:04:00 +03:00
|
|
|
|
|
|
|
already_AddRefed<nsINodeList> Labels();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override;
|
2012-06-11 03:44:50 +04:00
|
|
|
|
2013-02-19 20:54:41 +04:00
|
|
|
static bool TouchEventsEnabled(JSContext* /* unused */, JSObject* /* unused */);
|
2012-11-19 14:59:13 +04:00
|
|
|
|
2013-03-27 21:15:37 +04:00
|
|
|
static inline bool
|
2017-10-03 01:05:19 +03:00
|
|
|
CanHaveName(nsAtom* aTag)
|
2013-04-20 20:04:09 +04:00
|
|
|
{
|
|
|
|
return aTag == nsGkAtoms::img ||
|
|
|
|
aTag == nsGkAtoms::form ||
|
|
|
|
aTag == nsGkAtoms::embed ||
|
|
|
|
aTag == nsGkAtoms::object;
|
|
|
|
}
|
|
|
|
static inline bool
|
|
|
|
ShouldExposeNameAsHTMLDocumentProperty(Element* aElement)
|
|
|
|
{
|
2015-03-03 14:09:00 +03:00
|
|
|
return aElement->IsHTMLElement() &&
|
|
|
|
CanHaveName(aElement->NodeInfo()->NameAtom());
|
2013-04-20 20:04:09 +04:00
|
|
|
}
|
|
|
|
static inline bool
|
2013-03-27 21:15:37 +04:00
|
|
|
ShouldExposeIdAsHTMLDocumentProperty(Element* aElement)
|
|
|
|
{
|
2017-08-10 22:06:46 +03:00
|
|
|
if (aElement->IsHTMLElement(nsGkAtoms::object)) {
|
2015-11-21 00:54:49 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Per spec, <img> is exposed by id only if it also has a nonempty
|
|
|
|
// name (which doesn't have to match the id or anything).
|
|
|
|
// HasName() is true precisely when name is nonempty.
|
|
|
|
return aElement->IsHTMLElement(nsGkAtoms::img) && aElement->HasName();
|
2013-03-27 21:15:37 +04:00
|
|
|
}
|
|
|
|
|
2001-02-02 14:31:08 +03:00
|
|
|
protected:
|
2010-06-04 05:09:20 +04:00
|
|
|
/**
|
|
|
|
* Add/remove this element to the documents name cache
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
void AddToNameTable(nsAtom* aName) {
|
2011-04-08 06:29:50 +04:00
|
|
|
NS_ASSERTION(HasName(), "Node doesn't have name?");
|
2016-03-31 14:46:32 +03:00
|
|
|
nsIDocument* doc = GetUncomposedDoc();
|
2010-06-04 05:09:20 +04:00
|
|
|
if (doc && !IsInAnonymousSubtree()) {
|
|
|
|
doc->AddToNameTable(this, aName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void RemoveFromNameTable() {
|
2017-07-29 18:56:53 +03:00
|
|
|
if (HasName() && CanHaveName(NodeInfo()->NameAtom())) {
|
2016-03-31 14:46:32 +03:00
|
|
|
nsIDocument* doc = GetUncomposedDoc();
|
2010-06-04 05:09:20 +04:00
|
|
|
if (doc) {
|
|
|
|
doc->RemoveFromNameTable(this, GetParsedAttr(nsGkAtoms::name)->
|
|
|
|
GetAtomValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* Register or unregister an access key to this element based on the
|
|
|
|
* accesskey attribute.
|
|
|
|
*/
|
2010-06-04 05:08:57 +04:00
|
|
|
void RegAccessKey()
|
|
|
|
{
|
|
|
|
if (HasFlag(NODE_HAS_ACCESSKEY)) {
|
2011-10-17 18:59:28 +04:00
|
|
|
RegUnRegAccessKey(true);
|
2010-06-04 05:08:57 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnregAccessKey()
|
|
|
|
{
|
|
|
|
if (HasFlag(NODE_HAS_ACCESSKEY)) {
|
2011-10-17 18:59:28 +04:00
|
|
|
RegUnRegAccessKey(false);
|
2010-06-04 05:08:57 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2011-09-29 10:19:26 +04:00
|
|
|
void RegUnRegAccessKey(bool aDoReg);
|
2001-04-16 10:36:45 +04:00
|
|
|
|
2010-06-04 05:08:57 +04:00
|
|
|
protected:
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
2017-05-31 21:01:47 +03:00
|
|
|
const nsAttrValueOrString* aValue,
|
|
|
|
bool aNotify) override;
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
2017-05-19 00:09:01 +03:00
|
|
|
const nsAttrValue* aValue,
|
|
|
|
const nsAttrValue* aOldValue,
|
2017-10-10 00:33:38 +03:00
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
2017-05-19 00:09:01 +03:00
|
|
|
bool aNotify) override;
|
2005-10-28 06:59:38 +04:00
|
|
|
|
2014-03-17 10:56:53 +04:00
|
|
|
virtual mozilla::EventListenerManager*
|
2017-10-03 01:05:19 +03:00
|
|
|
GetEventListenerManagerForAttr(nsAtom* aAttrName,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool* aDefer) override;
|
2005-10-28 06:59:38 +04:00
|
|
|
|
2013-05-21 20:14:00 +04:00
|
|
|
/**
|
2016-03-19 15:37:09 +03:00
|
|
|
* Dispatch a simulated mouse click by keyboard to the given element.
|
|
|
|
*/
|
|
|
|
nsresult DispatchSimulatedClick(nsGenericHTMLElement* aElement,
|
|
|
|
bool aIsTrusted,
|
|
|
|
nsPresContext* aPresContext);
|
|
|
|
|
|
|
|
/**
|
2013-05-21 20:14:00 +04: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-22 08:12:13 +03:00
|
|
|
nsresult NewURIFromString(const nsAString& aURISpec, nsIURI** aURI);
|
2013-05-21 20:14:00 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
void GetHTMLAttr(nsAtom* aName, nsAString& aResult) const
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
GetAttr(kNameSpaceID_None, aName, aResult);
|
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
void GetHTMLAttr(nsAtom* aName, mozilla::dom::DOMString& aResult) const
|
2013-02-08 16:20:11 +04:00
|
|
|
{
|
|
|
|
GetAttr(kNameSpaceID_None, aName, aResult);
|
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
void GetHTMLEnumAttr(nsAtom* aName, nsAString& aResult) const
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
GetEnumAttr(aName, nullptr, aResult);
|
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
void GetHTMLURIAttr(nsAtom* aName, nsAString& aResult) const
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
GetURIAttr(aName, nullptr, aResult);
|
|
|
|
}
|
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
void SetHTMLAttr(nsAtom* aName, const nsAString& aValue)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
SetAttr(kNameSpaceID_None, aName, aValue, true);
|
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
void SetHTMLAttr(nsAtom* aName, const nsAString& aValue, mozilla::ErrorResult& aError)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
2014-09-06 06:42:33 +04:00
|
|
|
mozilla::dom::Element::SetAttr(aName, aValue, aError);
|
2012-11-11 03:30:15 +04:00
|
|
|
}
|
2017-12-21 01:43:18 +03:00
|
|
|
void SetHTMLAttr(nsAtom* aName, const nsAString& aValue, nsIPrincipal* aTriggeringPrincipal, mozilla::ErrorResult& aError)
|
2017-10-10 00:33:38 +03:00
|
|
|
{
|
|
|
|
mozilla::dom::Element::SetAttr(aName, aValue, aTriggeringPrincipal, aError);
|
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
void UnsetHTMLAttr(nsAtom* aName, mozilla::ErrorResult& aError)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
2014-09-06 06:42:33 +04:00
|
|
|
mozilla::dom::Element::UnsetAttr(aName, aError);
|
2012-11-11 03:30:15 +04:00
|
|
|
}
|
2017-10-03 01:05:19 +03:00
|
|
|
void SetHTMLBoolAttr(nsAtom* aName, bool aValue, mozilla::ErrorResult& aError)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
if (aValue) {
|
|
|
|
SetHTMLAttr(aName, EmptyString(), aError);
|
|
|
|
} else {
|
|
|
|
UnsetHTMLAttr(aName, aError);
|
|
|
|
}
|
|
|
|
}
|
2016-11-02 20:37:26 +03:00
|
|
|
template<typename T>
|
2017-10-03 01:05:19 +03:00
|
|
|
void SetHTMLIntAttr(nsAtom* aName, T aValue, mozilla::ErrorResult& aError)
|
2012-11-11 03:30:15 +04:00
|
|
|
{
|
|
|
|
nsAutoString value;
|
|
|
|
value.AppendInt(aValue);
|
|
|
|
|
|
|
|
SetHTMLAttr(aName, value, aError);
|
|
|
|
}
|
|
|
|
|
2004-06-01 02:26:41 +04:00
|
|
|
/**
|
2004-02-25 02:55:18 +03:00
|
|
|
* 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.
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
int32_t GetIntAttr(nsAtom* aAttr, int32_t aDefault) const;
|
2004-02-25 02:55:18 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
nsresult SetIntAttr(nsAtom* aAttr, int32_t aValue);
|
2004-02-25 02:55:18 +03:00
|
|
|
|
2010-11-06 12:30:27 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
uint32_t GetUnsignedIntAttr(nsAtom* aAttr, uint32_t aDefault) const;
|
2010-11-06 12:30:27 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
2016-05-05 21:29:54 +03:00
|
|
|
* @param aDefault Default value (in case value is out of range). If the spec
|
|
|
|
* doesn't provide one, should be 1 if the value is limited to
|
|
|
|
* nonzero values, and 0 otherwise.
|
2010-11-06 12:30:27 +03:00
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
void SetUnsignedIntAttr(nsAtom* aName, uint32_t aValue, uint32_t aDefault,
|
2013-04-04 11:03:50 +04:00
|
|
|
mozilla::ErrorResult& aError)
|
|
|
|
{
|
|
|
|
nsAutoString value;
|
2016-05-05 21:29:54 +03:00
|
|
|
if (aValue > INT32_MAX) {
|
|
|
|
value.AppendInt(aDefault);
|
|
|
|
} else {
|
|
|
|
value.AppendInt(aValue);
|
|
|
|
}
|
2013-04-04 11:03:50 +04:00
|
|
|
|
|
|
|
SetHTMLAttr(aName, value, aError);
|
|
|
|
}
|
2010-11-06 12:30:27 +03:00
|
|
|
|
2008-07-09 12:22:20 +04:00
|
|
|
/**
|
2011-03-25 17:43:53 +03:00
|
|
|
* Sets value of attribute to specified double. Only works for attributes
|
2008-07-09 12:22:20 +04:00
|
|
|
* in null namespace.
|
|
|
|
*
|
|
|
|
* @param aAttr name of attribute.
|
2011-03-25 17:43:53 +03:00
|
|
|
* @param aValue Double value of attribute.
|
2008-07-09 12:22:20 +04:00
|
|
|
*/
|
2017-10-03 01:05:19 +03:00
|
|
|
void SetDoubleAttr(nsAtom* aAttr, double aValue, mozilla::ErrorResult& aRv)
|
2013-08-22 10:34:39 +04:00
|
|
|
{
|
|
|
|
nsAutoString value;
|
|
|
|
value.AppendFloat(aValue);
|
|
|
|
|
|
|
|
SetHTMLAttr(aAttr, value, aRv);
|
|
|
|
}
|
2008-07-09 12:22:20 +04:00
|
|
|
|
2006-07-29 04:04:40 +04:00
|
|
|
/**
|
2017-08-07 10:53:59 +03:00
|
|
|
* Locates the TextEditor associated with this node. In general this is
|
2006-07-29 04:04:40 +04:00
|
|
|
* 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.
|
|
|
|
*/
|
2017-08-07 10:53:59 +03:00
|
|
|
virtual already_AddRefed<mozilla::TextEditor> GetAssociatedEditor();
|
2006-07-29 04:04:40 +04:00
|
|
|
|
2008-08-16 02:26:37 +04:00
|
|
|
/**
|
|
|
|
* Get the frame's offset information for offsetTop/Left/Width/Height.
|
2012-11-11 03:30:15 +04:00
|
|
|
* Returns the parent the offset is relative to.
|
2017-01-05 10:31:56 +03:00
|
|
|
* @note This method flushes pending notifications (FlushType::Layout).
|
2008-08-16 02:26:37 +04:00
|
|
|
* @param aRect the offset information [OUT]
|
|
|
|
*/
|
2013-06-12 11:00:08 +04:00
|
|
|
mozilla::dom::Element* GetOffsetRect(mozilla::CSSIntRect& aRect);
|
2008-08-16 02:26:37 +04:00
|
|
|
|
2006-08-25 04:15:14 +04:00
|
|
|
/**
|
|
|
|
* Ensures all editors associated with a subtree are synced, for purposes of
|
|
|
|
* spellchecking.
|
|
|
|
*/
|
|
|
|
static void SyncEditorsOnSubtree(nsIContent* content);
|
2007-06-28 06:48:16 +04: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 16:08:21 +04:00
|
|
|
ContentEditableTristate GetContentEditableValue() const
|
2007-06-28 06:48:16 +04:00
|
|
|
{
|
2017-12-07 21:13:50 +03:00
|
|
|
static const Element::AttrValuesArray values[] =
|
2012-07-30 18:20:58 +04:00
|
|
|
{ &nsGkAtoms::_false, &nsGkAtoms::_true, &nsGkAtoms::_empty, nullptr };
|
2007-06-28 06:48:16 +04:00
|
|
|
|
2011-04-08 06:29:50 +04:00
|
|
|
if (!MayHaveContentEditableAttr())
|
2009-06-23 16:57:56 +04:00
|
|
|
return eInherit;
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t value = FindAttrValueIn(kNameSpaceID_None,
|
2007-06-28 06:48:16 +04:00
|
|
|
nsGkAtoms::contenteditable, values,
|
|
|
|
eIgnoreCase);
|
|
|
|
|
|
|
|
return value > 0 ? eTrue : (value == 0 ? eFalse : eInherit);
|
|
|
|
}
|
|
|
|
|
2010-02-24 19:37:03 +03:00
|
|
|
// Used by A, AREA, LINK, and STYLE.
|
|
|
|
already_AddRefed<nsIURI> GetHrefURIForAnchors() const;
|
|
|
|
|
2007-06-28 06:48:16 +04:00
|
|
|
/**
|
2007-07-13 18:17:35 +04: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-28 06:48:16 +04:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsEditableRoot() const;
|
2007-06-28 06:48:16 +04:00
|
|
|
|
2010-10-08 14:20:20 +04:00
|
|
|
private:
|
2012-08-22 19:56:38 +04:00
|
|
|
void ChangeEditableState(int32_t aChange);
|
1998-08-29 03:27:19 +04:00
|
|
|
};
|
|
|
|
|
2013-02-08 20:34:47 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class HTMLFieldSetElement;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2011-09-18 13:22:18 +04:00
|
|
|
|
2012-10-02 04:52:06 +04:00
|
|
|
#define FORM_ELEMENT_FLAG_BIT(n_) NODE_FLAG_BIT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + (n_))
|
|
|
|
|
|
|
|
// Form element specific bits
|
|
|
|
enum {
|
2013-06-18 16:53:23 +04: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-02 04:52:06 +04:00
|
|
|
ADDED_TO_FORM = FORM_ELEMENT_FLAG_BIT(0),
|
|
|
|
|
2013-06-18 16:53:23 +04: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.
|
2016-11-21 20:34:02 +03:00
|
|
|
MAYBE_ORPHAN_FORM_ELEMENT = FORM_ELEMENT_FLAG_BIT(1),
|
|
|
|
|
|
|
|
// If this flag is set on an nsGenericHTMLElement or an HTMLImageElement, then
|
|
|
|
// the element might be in the past names map of its form.
|
|
|
|
MAY_BE_IN_PAST_NAMES_MAP = FORM_ELEMENT_FLAG_BIT(2)
|
2012-10-02 04:52:06 +04:00
|
|
|
};
|
|
|
|
|
2016-11-21 20:34:02 +03:00
|
|
|
// NOTE: I don't think it's possible to have both ADDED_TO_FORM and
|
|
|
|
// MAYBE_ORPHAN_FORM_ELEMENT set at the same time, so if it becomes an issue we
|
|
|
|
// can probably merge them into the same bit. --bz
|
2012-10-02 04:52:06 +04:00
|
|
|
|
2016-11-21 20:34:02 +03:00
|
|
|
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 3);
|
2012-10-02 04:52:06 +04:00
|
|
|
|
|
|
|
#undef FORM_ELEMENT_FLAG_BIT
|
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/**
|
|
|
|
* A helper class for form elements that can contain children
|
|
|
|
*/
|
2004-02-10 22:36:43 +03:00
|
|
|
class nsGenericHTMLFormElement : public nsGenericHTMLElement,
|
|
|
|
public nsIFormControl
|
2000-12-23 13:56:31 +03:00
|
|
|
{
|
2000-04-19 11:49:07 +04:00
|
|
|
public:
|
2017-04-01 05:49:00 +03:00
|
|
|
nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
|
|
|
uint8_t aType);
|
2000-04-19 11:49:07 +04:00
|
|
|
|
2013-08-08 00:23:08 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
nsINode* GetScopeChainParent() const override;
|
2014-10-31 00:38:48 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const override;
|
|
|
|
virtual void SaveSubtreeState() override;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2000-12-23 13:56:31 +03:00
|
|
|
// nsIFormControl
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::dom::HTMLFieldSetElement* GetFieldSet() override;
|
|
|
|
virtual mozilla::dom::Element* GetFormElement() override;
|
2013-06-19 18:24:37 +04:00
|
|
|
mozilla::dom::HTMLFormElement* GetForm() const
|
2012-12-21 18:07:28 +04:00
|
|
|
{
|
|
|
|
return mForm;
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetForm(nsIDOMHTMLFormElement* aForm) override;
|
2017-05-02 00:10:00 +03:00
|
|
|
virtual void ClearForm(bool aRemoveFromForm, bool aUnbindOrDelete) override;
|
2006-08-16 07:20:19 +04:00
|
|
|
|
2010-05-09 22:32:57 +04:00
|
|
|
nsresult GetForm(nsIDOMHTMLFormElement** aForm);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SaveState() override
|
2004-02-12 00:31:53 +03:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-01-19 01:10:06 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool RestoreState(nsPresState* aState) override
|
2004-02-12 00:31:53 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2004-02-12 00:31:53 +03:00
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool AllowDrop() override
|
2004-02-12 00:31:53 +03:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2004-02-12 00:31:53 +03:00
|
|
|
}
|
2010-08-21 22:51:38 +04:00
|
|
|
|
2001-08-17 12:14:14 +04:00
|
|
|
// nsIContent
|
2005-04-06 03:54:35 +04:00
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aCompileEventHandlers) override;
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNullParent = true) override;
|
|
|
|
virtual IMEState GetDesiredIMEState() override;
|
|
|
|
virtual mozilla::EventStates IntrinsicState() const override;
|
2005-08-30 07:31:47 +04:00
|
|
|
|
2016-10-21 05:11:07 +03:00
|
|
|
virtual nsresult GetEventTargetParent(
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::EventChainPreVisitor& aVisitor) override;
|
2016-10-21 11:56:58 +03:00
|
|
|
virtual nsresult PreHandleEvent(
|
|
|
|
mozilla::EventChainVisitor& aVisitor) override;
|
2010-09-19 01:33:16 +04:00
|
|
|
|
|
|
|
/**
|
2011-06-01 05:46:57 +04: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-19 01:33:16 +04:00
|
|
|
* might have changed.
|
|
|
|
*
|
2011-06-01 05:46:57 +04: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-19 01:33:16 +04:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual void FieldSetDisabledChanged(bool aNotify);
|
2010-09-19 05:47:15 +04:00
|
|
|
|
Bug 1375599 - Change IsDisabled() to look at NS_EVENT_STATE_DISABLED instead of the "disabled" attribute. r=bz
In order to speed up IsDisabled(), instead of querying for the @disabled
attribute, we're now using the NS_EVENT_STATE_DISABLED flag to know whether an
element is disabled.
It is safe to use the NS_EVENT_STATE_DISABLED flag for the following reasons:
- For form elements, nsGenericHTMLFormElement::IsDisabled() is only called on
form elements that can be disabled; form elements that can't be disabled
overrides IsDisabled() to return false directly.
And, before this patch, NS_EVENT_STATE_DISABLED flag is set by
nsGenericHTMLFormElement::IntrinsicState() if and only if IsDisabled() in all
cases when CanBeDisabled() is true, and when CanBeDisabled() is false then
IsDisabled() is always false and the flag is not set.
- For non form elements, optgroup and option have the flag matching
IsDisabled(). Note that option's IsDisabled() should also refer to optgroup's
(if it exists) disabled state, which was not done before this patch.
For this to work correctly, we need to set NS_EVENT_STATE_DISABLED earlier,
that is, in AfterSetAttr(), before any consumer of IsDisabled().
We also need to update the flag whenever the element's parent (e.g. fieldset or
optgroup) disabled state changes and when moving into/out of a parent
container.
Note that NS_EVENT_STATE_DISABLED/ENABLED is now part of the
EXTERNALLY_MANAGED_STATES.
MozReview-Commit-ID: KSceikeqvvU
2017-07-20 09:15:00 +03:00
|
|
|
/**
|
|
|
|
* Check our disabled content attribute and fieldset's (if it exists) disabled
|
|
|
|
* state to decide whether our disabled flag should be toggled.
|
|
|
|
*/
|
|
|
|
void UpdateDisabledState(bool aNotify);
|
|
|
|
|
2017-08-03 08:27:00 +03:00
|
|
|
/**
|
|
|
|
* Update our required/optional flags to match the given aIsRequired boolean.
|
|
|
|
*/
|
|
|
|
void UpdateRequiredState(bool aIsRequired, bool aNotify);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void FieldSetFirstLegendChanged(bool aNotify) {
|
2011-06-01 05:46:57 +04:00
|
|
|
UpdateFieldSet(aNotify);
|
2010-09-19 05:47:15 +04:00
|
|
|
}
|
2010-09-19 01:33:16 +04:00
|
|
|
|
2010-11-05 20:15:05 +03: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 13:22:18 +04:00
|
|
|
void ForgetFieldSet(nsIContent* aFieldset);
|
2010-11-05 20:15:05 +03:00
|
|
|
|
2010-08-18 22:28:08 +04:00
|
|
|
/**
|
|
|
|
* Returns if the control can be disabled.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool CanBeDisabled() const;
|
2010-08-18 22:28:08 +04:00
|
|
|
|
2018-02-22 10:07:55 +03:00
|
|
|
/**
|
|
|
|
* Returns if the readonly attribute applies.
|
|
|
|
*/
|
|
|
|
bool DoesReadOnlyApply() const;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t* aTabIndex) override;
|
2011-01-05 16:23:37 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsLabelable() const override;
|
2012-06-11 03:44:50 +04:00
|
|
|
|
2017-07-17 09:17:19 +03:00
|
|
|
void GetFormAction(nsString& aValue);
|
|
|
|
|
2000-12-23 13:56:31 +03:00
|
|
|
protected:
|
2014-07-09 01:23:16 +04:00
|
|
|
virtual ~nsGenericHTMLFormElement();
|
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
2017-03-16 21:50:41 +03:00
|
|
|
const nsAttrValueOrString* aValue,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aNotify) override;
|
2005-10-28 06:59:38 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
2017-05-19 00:09:01 +03:00
|
|
|
const nsAttrValue* aValue,
|
|
|
|
const nsAttrValue* aOldValue,
|
2017-10-10 00:33:38 +03:00
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
2017-05-19 00:09:01 +03:00
|
|
|
bool aNotify) override;
|
2005-08-30 07:31:47 +04:00
|
|
|
|
2017-05-02 00:10:00 +03:00
|
|
|
virtual void BeforeSetForm(bool aBindToTree) {}
|
|
|
|
|
|
|
|
virtual void AfterClearForm(bool aUnbindOrDelete) {}
|
|
|
|
|
|
|
|
void SetForm(mozilla::dom::HTMLFormElement* aForm, bool aBindToTree);
|
|
|
|
|
2010-08-24 05:11:04 +04: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-26 00:45:43 +04:00
|
|
|
*
|
|
|
|
* @note Callers of UpdateFormOwner have to be sure the element is in a
|
2016-03-31 14:46:32 +03:00
|
|
|
* document (GetUncomposedDoc() != nullptr).
|
2010-08-24 05:11:04 +04:00
|
|
|
*/
|
|
|
|
void UpdateFormOwner(bool aBindToTree, Element* aFormIdElement);
|
|
|
|
|
2010-09-19 01:33:16 +04:00
|
|
|
/**
|
|
|
|
* This method will update mFieldset and set it to the first fieldset parent.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
void UpdateFieldSet(bool aNotify);
|
2010-09-19 01:33:16 +04:00
|
|
|
|
2010-08-24 05:11:04 +04: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-29 10:19:26 +04:00
|
|
|
static bool FormIdUpdated(Element* aOldElement, Element* aNewElement,
|
2010-08-24 05:11:04 +04:00
|
|
|
void* aData);
|
|
|
|
|
2016-10-21 05:11:07 +03:00
|
|
|
// Returns true if the event should not be handled from GetEventTargetParent
|
2015-08-26 15:56:59 +03:00
|
|
|
bool IsElementDisabledForEvents(mozilla::EventMessage aMessage,
|
|
|
|
nsIFrame* aFrame);
|
2011-07-19 03:16:44 +04:00
|
|
|
|
2008-10-07 22:53:23 +04: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();
|
|
|
|
|
2002-07-28 05:47:59 +04:00
|
|
|
/** The form that contains this control */
|
2013-06-19 18:24:37 +04:00
|
|
|
mozilla::dom::HTMLFormElement* mForm;
|
2010-09-19 01:33:16 +04:00
|
|
|
|
|
|
|
/* This is a pointer to our closest fieldset parent if any */
|
2013-02-08 20:34:47 +04:00
|
|
|
mozilla::dom::HTMLFieldSetElement* mFieldSet;
|
2000-04-19 11:49:07 +04:00
|
|
|
};
|
|
|
|
|
2013-08-02 05:21:31 +04:00
|
|
|
class nsGenericHTMLFormElementWithState : public nsGenericHTMLFormElement
|
|
|
|
{
|
|
|
|
public:
|
2017-04-01 05:49:00 +03:00
|
|
|
nsGenericHTMLFormElementWithState(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
|
|
|
uint8_t aType);
|
2013-08-02 05:21:31 +04: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.
|
|
|
|
*/
|
2017-02-23 04:19:04 +03:00
|
|
|
virtual void NodeInfoChanged(nsIDocument* aOldDoc) override;
|
2013-08-02 05:21:31 +04: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;
|
|
|
|
};
|
|
|
|
|
2001-10-30 13:14:06 +03:00
|
|
|
#define NS_INTERFACE_MAP_ENTRY_IF_TAG(_interface, _tag) \
|
2004-04-13 02:25:17 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(_interface, \
|
2006-12-26 20:47:52 +03:00
|
|
|
mNodeInfo->Equals(nsGkAtoms::_tag))
|
2001-10-30 13:14:06 +03:00
|
|
|
|
2017-07-04 11:00:03 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
typedef nsGenericHTMLElement* (*HTMLContentCreatorFunction)(
|
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&&,
|
|
|
|
mozilla::dom::FromParser aFromParser);
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2001-10-30 13:14:06 +03:00
|
|
|
|
2010-10-25 16:17:38 +04:00
|
|
|
/**
|
|
|
|
* A macro to declare the NS_NewHTMLXXXElement() functions.
|
|
|
|
*/
|
2010-07-23 13:49:57 +04:00
|
|
|
#define NS_DECLARE_NS_NEW_HTML_ELEMENT(_elementName) \
|
2012-12-21 18:06:49 +04:00
|
|
|
namespace mozilla { \
|
|
|
|
namespace dom { \
|
|
|
|
class HTML##_elementName##Element; \
|
|
|
|
} \
|
|
|
|
} \
|
2010-07-23 13:49:57 +04:00
|
|
|
nsGenericHTMLElement* \
|
2014-06-20 06:01:40 +04:00
|
|
|
NS_NewHTML##_elementName##Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
2010-10-25 16:17:38 +04:00
|
|
|
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
|
2004-06-06 06:38:32 +04:00
|
|
|
|
2010-07-23 13:49:57 +04:00
|
|
|
#define NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(_elementName) \
|
|
|
|
inline nsGenericHTMLElement* \
|
2014-06-20 06:01:40 +04:00
|
|
|
NS_NewHTML##_elementName##Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
2010-10-25 16:17:38 +04:00
|
|
|
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER) \
|
2010-07-23 13:49:57 +04:00
|
|
|
{ \
|
2014-03-15 23:00:17 +04:00
|
|
|
return NS_NewHTMLSharedElement(mozilla::Move(aNodeInfo), aFromParser); \
|
2010-04-19 23:06:00 +04:00
|
|
|
}
|
|
|
|
|
2010-10-25 16:17:38 +04:00
|
|
|
/**
|
|
|
|
* A macro to implement the NS_NewHTMLXXXElement() functions.
|
|
|
|
*/
|
|
|
|
#define NS_IMPL_NS_NEW_HTML_ELEMENT(_elementName) \
|
|
|
|
nsGenericHTMLElement* \
|
2014-06-20 06:01:40 +04:00
|
|
|
NS_NewHTML##_elementName##Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
2010-10-25 16:17:38 +04:00
|
|
|
mozilla::dom::FromParser aFromParser) \
|
|
|
|
{ \
|
2013-06-26 18:59:46 +04:00
|
|
|
return new mozilla::dom::HTML##_elementName##Element(aNodeInfo); \
|
2010-10-25 16:17:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(_elementName) \
|
|
|
|
nsGenericHTMLElement* \
|
2014-06-20 06:01:40 +04:00
|
|
|
NS_NewHTML##_elementName##Element(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
2010-10-25 16:17:38 +04:00
|
|
|
mozilla::dom::FromParser aFromParser) \
|
|
|
|
{ \
|
2013-06-26 18:59:46 +04:00
|
|
|
return new mozilla::dom::HTML##_elementName##Element(aNodeInfo, \
|
|
|
|
aFromParser); \
|
2010-10-25 16:17:38 +04:00
|
|
|
}
|
|
|
|
|
2010-07-14 20:27:31 +04: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-20 06:01:40 +04:00
|
|
|
NS_NewHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
2010-10-25 16:17:38 +04:00
|
|
|
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
|
2010-06-27 01:58:01 +04:00
|
|
|
|
2017-07-04 11:00:03 +03:00
|
|
|
// Distinct from the above in order to have function pointer that compared unequal
|
|
|
|
// to a function pointer to the above.
|
|
|
|
nsGenericHTMLElement*
|
|
|
|
NS_NewCustomElement(
|
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
|
|
|
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
|
|
|
|
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
|
2013-02-08 16:20:11 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)
|
2006-05-22 01:00:09 +04:00
|
|
|
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Anchor)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Area)
|
2008-07-09 12:22:20 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Audio)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(BR)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Body)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Button)
|
2005-04-18 10:33:23 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Canvas)
|
2013-12-02 14:26:12 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Content)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Mod)
|
2013-02-27 00:19:05 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Data)
|
2010-09-10 09:16:56 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(DataList)
|
2016-01-20 18:20:40 +03:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Details)
|
2016-12-23 18:01:50 +03:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Dialog)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Div)
|
2017-07-29 07:35:43 +03:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Embed)
|
2004-06-06 06:38:32 +04: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 23:06:00 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(Head)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Heading)
|
2010-04-19 23:06:00 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(Html)
|
2004-06-06 06:38:32 +04: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 21:31:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Menu)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(MenuItem)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Meta)
|
2012-05-16 15:18:33 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Meter)
|
2004-06-06 06:38:32 +04: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 11:42:00 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Output)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Paragraph)
|
2014-03-07 03:46:38 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Picture)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre)
|
2011-04-09 21:22:02 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Progress)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Select)
|
2017-10-02 13:22:12 +03:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Slot)
|
2008-07-09 12:22:20 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Source)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Span)
|
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Style)
|
2016-01-20 18:20:40 +03:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Summary)
|
2004-06-06 06:38:32 +04:00
|
|
|
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 11:15:23 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Template)
|
2004-06-06 06:38:32 +04: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 19:07:42 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Time)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Title)
|
2013-05-21 20:14:00 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Track)
|
2004-06-06 06:38:32 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Unknown)
|
2008-07-09 12:22:20 +04:00
|
|
|
NS_DECLARE_NS_NEW_HTML_ELEMENT(Video)
|
2001-10-30 13:14:06 +03:00
|
|
|
|
2012-11-09 19:59:33 +04:00
|
|
|
inline nsISupports*
|
|
|
|
ToSupports(nsGenericHTMLElement* aHTMLElement)
|
|
|
|
{
|
2013-08-08 00:23:08 +04:00
|
|
|
return static_cast<nsIContent*>(aHTMLElement);
|
2012-11-09 19:59:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline nsISupports*
|
|
|
|
ToCanonicalSupports(nsGenericHTMLElement* aHTMLElement)
|
|
|
|
{
|
2013-08-08 00:23:08 +04:00
|
|
|
return static_cast<nsIContent*>(aHTMLElement);
|
2012-11-09 19:59:33 +04:00
|
|
|
}
|
|
|
|
|
1998-09-04 02:21:32 +04:00
|
|
|
#endif /* nsGenericHTMLElement_h___ */
|