/work/obj-fuzz/dist/include/mozilla/dom/GeneratedImageContent.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 dom_base_GeneratedImageContent_h |
8 | | #define dom_base_GeneratedImageContent_h |
9 | | |
10 | | /* A content node that keeps track of an index in the parent's `content` |
11 | | * property value, used for url() values in the content of a ::before or ::after |
12 | | * pseudo-element. */ |
13 | | |
14 | | #include "mozilla/dom/HTMLElementBinding.h" |
15 | | #include "mozilla/dom/NameSpaceConstants.h" |
16 | | #include "mozilla/dom/NodeInfo.h" |
17 | | #include "nsGenericHTMLElement.h" |
18 | | |
19 | | namespace mozilla { |
20 | | namespace dom { |
21 | | |
22 | | class GeneratedImageContent final |
23 | | : public nsGenericHTMLElement |
24 | | { |
25 | | public: |
26 | | static already_AddRefed<GeneratedImageContent> |
27 | | Create(nsIDocument&, uint32_t aContentIndex); |
28 | | |
29 | | explicit GeneratedImageContent(already_AddRefed<dom::NodeInfo>&& aNodeInfo) |
30 | | : nsGenericHTMLElement(std::move(aNodeInfo)) |
31 | 0 | { |
32 | 0 | MOZ_ASSERT(IsInNamespace(kNameSpaceID_XHTML), "Someone messed up our nodeinfo"); |
33 | 0 | } |
34 | | |
35 | | nsresult Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const final; |
36 | | |
37 | | nsresult CopyInnerTo(GeneratedImageContent* aDest) |
38 | 0 | { |
39 | 0 | nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest); |
40 | 0 | NS_ENSURE_SUCCESS(rv, rv); |
41 | 0 | aDest->mIndex = mIndex; |
42 | 0 | return NS_OK; |
43 | 0 | } |
44 | | |
45 | | uint32_t Index() const |
46 | 0 | { |
47 | 0 | return mIndex; |
48 | 0 | } |
49 | | |
50 | | protected: |
51 | | JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final; |
52 | | |
53 | | private: |
54 | | virtual ~GeneratedImageContent() = default; |
55 | | uint32_t mIndex = 0; |
56 | | }; |
57 | | |
58 | | } // namespace dom |
59 | | } // namespace mozilla |
60 | | |
61 | | #endif // dom_base_GeneratedImageContent_h |