/work/obj-fuzz/dist/include/mozilla/dom/HTMLSlotElement.h
Line | Count | Source (jump to first uncovered line) |
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/. */ |
6 | | |
7 | | #ifndef mozilla_dom_HTMLSlotElement_h |
8 | | #define mozilla_dom_HTMLSlotElement_h |
9 | | |
10 | | #include "nsGenericHTMLElement.h" |
11 | | #include "nsTArray.h" |
12 | | |
13 | | namespace mozilla { |
14 | | namespace dom { |
15 | | |
16 | | struct AssignedNodesOptions; |
17 | | |
18 | | class HTMLSlotElement final : public nsGenericHTMLElement |
19 | | { |
20 | | public: |
21 | | explicit HTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); |
22 | | NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLSlotElement, slot) |
23 | | |
24 | | NS_DECL_ISUPPORTS_INHERITED |
25 | | NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLSlotElement, nsGenericHTMLElement) |
26 | | virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; |
27 | | |
28 | | // nsIContent |
29 | | virtual nsresult BindToTree(nsIDocument* aDocument, |
30 | | nsIContent* aParent, |
31 | | nsIContent* aBindingParent) override; |
32 | | virtual void UnbindFromTree(bool aDeep, bool aNullParent) override; |
33 | | |
34 | | virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName, |
35 | | const nsAttrValueOrString* aValue, |
36 | | bool aNotify) override; |
37 | | virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName, |
38 | | const nsAttrValue* aValue, |
39 | | const nsAttrValue* aOldValue, |
40 | | nsIPrincipal* aSubjectPrincipal, |
41 | | bool aNotify) override; |
42 | | |
43 | | // WebIDL |
44 | | void SetName(const nsAString& aName, ErrorResult& aRv) |
45 | 0 | { |
46 | 0 | SetHTMLAttr(nsGkAtoms::name, aName, aRv); |
47 | 0 | } |
48 | | |
49 | | void GetName(nsAString& aName) |
50 | 0 | { |
51 | 0 | GetHTMLAttr(nsGkAtoms::name, aName); |
52 | 0 | } |
53 | | |
54 | | void AssignedNodes(const AssignedNodesOptions& aOptions, |
55 | | nsTArray<RefPtr<nsINode>>& aNodes); |
56 | | |
57 | | // Helper methods |
58 | | const nsTArray<RefPtr<nsINode>>& AssignedNodes() const; |
59 | | void InsertAssignedNode(uint32_t aIndex, nsINode* aNode); |
60 | | void AppendAssignedNode(nsINode* aNode); |
61 | | void RemoveAssignedNode(nsINode* aNode); |
62 | | void ClearAssignedNodes(); |
63 | | |
64 | | void EnqueueSlotChangeEvent(); |
65 | | void RemovedFromSignalSlotList() |
66 | 0 | { |
67 | 0 | MOZ_ASSERT(mInSignalSlotList); |
68 | 0 | mInSignalSlotList = false; |
69 | 0 | } |
70 | | |
71 | | void FireSlotChangeEvent(); |
72 | | |
73 | | protected: |
74 | | virtual ~HTMLSlotElement(); |
75 | | JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final; |
76 | | |
77 | | nsTArray<RefPtr<nsINode>> mAssignedNodes; |
78 | | |
79 | | // Whether we're in the signal slot list of our unit of related similar-origin |
80 | | // browsing contexts. |
81 | | // |
82 | | // https://dom.spec.whatwg.org/#signal-slot-list |
83 | | bool mInSignalSlotList = false; |
84 | | }; |
85 | | |
86 | | } // namespace dom |
87 | | } // namespace mozilla |
88 | | |
89 | | #endif // mozilla_dom_HTMLSlotElement_h |