2021-10-04 20:51:25 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_HTMLElement_h
|
|
|
|
#define mozilla_dom_HTMLElement_h
|
|
|
|
|
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
|
|
|
|
namespace mozilla::dom {
|
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
class HTMLElement final : public nsGenericHTMLFormElement {
|
2021-10-04 20:51:25 +00:00
|
|
|
public:
|
2023-06-28 04:31:22 +00:00
|
|
|
explicit HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
|
|
|
FromParser aFromParser = NOT_FROM_PARSER);
|
2021-10-04 20:51:25 +00:00
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLElement,
|
|
|
|
nsGenericHTMLFormElement)
|
|
|
|
|
2023-01-04 13:08:39 +00:00
|
|
|
// EventTarget
|
|
|
|
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
|
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
// nsINode
|
2021-10-04 20:51:25 +00:00
|
|
|
nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
2023-01-06 18:17:05 +00:00
|
|
|
nsINode* GetScopeChainParent() const override;
|
2021-10-04 20:51:25 +00:00
|
|
|
|
2021-11-04 09:49:32 +00:00
|
|
|
// nsIContent
|
|
|
|
nsresult BindToTree(BindContext&, nsINode& aParent) override;
|
|
|
|
void UnbindFromTree(bool aNullParent = true) override;
|
2023-06-28 04:31:22 +00:00
|
|
|
void DoneCreatingElement() override;
|
2021-11-04 09:49:32 +00:00
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
// Element
|
|
|
|
void SetCustomElementDefinition(
|
|
|
|
CustomElementDefinition* aDefinition) override;
|
2021-10-06 21:40:51 +00:00
|
|
|
bool IsLabelable() const override { return IsFormAssociatedElement(); }
|
2021-10-04 20:51:28 +00:00
|
|
|
|
|
|
|
// nsGenericHTMLElement
|
|
|
|
// https://html.spec.whatwg.org/multipage/custom-elements.html#dom-attachinternals
|
|
|
|
already_AddRefed<mozilla::dom::ElementInternals> AttachInternals(
|
|
|
|
ErrorResult& aRv) override;
|
2023-01-04 13:08:39 +00:00
|
|
|
bool IsDisabledForEvents(WidgetEvent* aEvent) override;
|
2021-10-04 20:51:28 +00:00
|
|
|
|
2021-10-06 20:24:52 +00:00
|
|
|
// nsGenericHTMLFormElement
|
|
|
|
bool IsFormAssociatedElement() const override;
|
2021-10-28 10:29:38 +00:00
|
|
|
void AfterClearForm(bool aUnbindOrDelete) override;
|
2021-11-04 09:49:32 +00:00
|
|
|
void FieldSetDisabledChanged(bool aNotify) override;
|
2023-06-28 04:31:22 +00:00
|
|
|
void SaveState() override;
|
2023-08-30 09:18:32 +00:00
|
|
|
void UpdateValidityElementStates(bool aNotify) final;
|
2021-10-06 20:24:52 +00:00
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
void UpdateFormOwner();
|
|
|
|
|
2023-06-28 04:31:22 +00:00
|
|
|
void MaybeRestoreFormAssociatedCustomElementState();
|
|
|
|
|
|
|
|
void InhibitRestoration(bool aShouldInhibit);
|
|
|
|
|
2021-10-04 20:51:25 +00:00
|
|
|
protected:
|
2021-10-04 20:51:28 +00:00
|
|
|
virtual ~HTMLElement() = default;
|
|
|
|
|
2021-10-04 20:51:25 +00:00
|
|
|
JSObject* WrapNode(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
2021-10-04 20:51:28 +00:00
|
|
|
|
2021-10-25 20:43:10 +00:00
|
|
|
// Element
|
2023-04-21 08:56:27 +00:00
|
|
|
void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|
|
|
const nsAttrValue* aValue, const nsAttrValue* aOldValue,
|
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
|
|
|
bool aNotify) override;
|
2021-10-25 20:43:10 +00:00
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
// nsGenericHTMLFormElement
|
|
|
|
void SetFormInternal(HTMLFormElement* aForm, bool aBindToTree) override;
|
|
|
|
HTMLFormElement* GetFormInternal() const override;
|
|
|
|
void SetFieldSetInternal(HTMLFieldSetElement* aFieldset) override;
|
|
|
|
HTMLFieldSetElement* GetFieldSetInternal() const override;
|
|
|
|
bool CanBeDisabled() const override;
|
|
|
|
bool DoesReadOnlyApply() const override;
|
2021-10-25 20:43:11 +00:00
|
|
|
void UpdateDisabledState(bool aNotify) override;
|
2021-10-28 10:29:38 +00:00
|
|
|
void UpdateFormOwner(bool aBindToTree, Element* aFormIdElement) override;
|
2021-10-04 20:51:28 +00:00
|
|
|
|
2021-11-04 09:49:32 +00:00
|
|
|
void UpdateBarredFromConstraintValidation();
|
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
ElementInternals* GetElementInternals() const;
|
2023-06-28 04:31:22 +00:00
|
|
|
|
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
|
|
|
void RestoreFormAssociatedCustomElementState();
|
2021-10-04 20:51:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla::dom
|
|
|
|
|
|
|
|
#endif // mozilla_dom_HTMLElement_h
|