Bug 1867190 - Initialise the PHC allocate delay later r=glandium
[gecko.git] / dom / html / HTMLLegendElement.h
blobcccab9239b73fef3be1b0ac0eb68c6d188c488fb
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_HTMLLegendElement_h
8 #define mozilla_dom_HTMLLegendElement_h
10 #include "mozilla/Attributes.h"
11 #include "nsGenericHTMLElement.h"
12 #include "mozilla/dom/HTMLFormElement.h"
14 namespace mozilla::dom {
16 class HTMLLegendElement final : public nsGenericHTMLElement {
17 public:
18 explicit HTMLLegendElement(
19 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
20 : nsGenericHTMLElement(std::move(aNodeInfo)) {}
22 NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLLegendElement, legend)
24 using nsGenericHTMLElement::Focus;
25 virtual void Focus(const FocusOptions& aOptions,
26 const mozilla::dom::CallerType aCallerType,
27 ErrorResult& aError) override;
29 virtual Result<bool, nsresult> PerformAccesskey(
30 bool aKeyCausesActivation, bool aIsTrustedEvent) override;
32 // nsIContent
33 virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
34 virtual void UnbindFromTree(bool aNullParent = true) override;
35 virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
36 const nsAString& aValue,
37 nsIPrincipal* aMaybeScriptedPrincipal,
38 nsAttrValue& aResult) override;
39 virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
40 int32_t aModType) const override;
42 virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
44 enum class LegendAlignValue : uint8_t {
45 Left,
46 Right,
47 Center,
48 Bottom,
49 Top,
50 InlineStart,
51 InlineEnd,
54 /**
55 * Return the align value to use for the given fieldset writing-mode.
56 * (This method resolves Left/Right to the appropriate InlineStart/InlineEnd).
57 * @param aCBWM the fieldset writing-mode
58 * @note we only parse left/right/center, so this method returns Center,
59 * InlineStart or InlineEnd.
61 LegendAlignValue LogicalAlign(mozilla::WritingMode aCBWM) const;
63 /**
64 * WebIDL Interface
67 HTMLFormElement* GetForm() const;
69 void GetAlign(DOMString& aAlign) { GetHTMLAttr(nsGkAtoms::align, aAlign); }
71 void SetAlign(const nsAString& aAlign, ErrorResult& aError) {
72 SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
75 nsINode* GetScopeChainParent() const override {
76 Element* form = GetForm();
77 return form ? form : nsGenericHTMLElement::GetScopeChainParent();
80 protected:
81 virtual ~HTMLLegendElement();
83 virtual JSObject* WrapNode(JSContext* aCx,
84 JS::Handle<JSObject*> aGivenProto) override;
86 /**
87 * Get the fieldset content element that contains this legend.
88 * Returns null if there is no fieldset containing this legend.
90 nsIContent* GetFieldSet() const;
93 } // namespace mozilla::dom
95 #endif /* mozilla_dom_HTMLLegendElement_h */