Bug 1845715 - Check for failure when getting RegExp match result template r=iain
[gecko.git] / parser / html / nsHtml5HtmlAttributes.h
blobf840f0cc3e00c6ed696053e2115f9d29c20860b1
1 /*
2 * Copyright (c) 2007 Henri Sivonen
3 * Copyright (c) 2008-2017 Mozilla Foundation
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 #ifndef nsHtml5HtmlAttributes_h
25 #define nsHtml5HtmlAttributes_h
27 #include "nsAtom.h"
28 #include "nsHtml5AtomTable.h"
29 #include "nsHtml5String.h"
30 #include "nsNameSpaceManager.h"
31 #include "nsIContent.h"
32 #include "nsTraceRefcnt.h"
33 #include "jArray.h"
34 #include "nsHtml5ArrayCopy.h"
35 #include "nsAHtml5TreeBuilderState.h"
36 #include "nsHtml5ByteReadable.h"
37 #include "nsHtml5Macros.h"
38 #include "nsIContentHandle.h"
39 #include "nsTArray.h"
40 #include "nsHtml5AttributeEntry.h"
42 class nsHtml5StreamParser;
44 class nsHtml5Tokenizer;
45 class nsHtml5TreeBuilder;
46 class nsHtml5AttributeName;
47 class nsHtml5ElementName;
48 class nsHtml5UTF16Buffer;
49 class nsHtml5StateSnapshot;
50 class nsHtml5Portability;
52 class nsHtml5HtmlAttributes {
53 public:
54 static nsHtml5HtmlAttributes* EMPTY_ATTRIBUTES;
56 private:
57 AutoTArray<nsHtml5AttributeEntry, 5> mStorage;
58 int32_t mMode;
59 void AddEntry(nsHtml5AttributeEntry&& aEntry);
61 public:
62 explicit nsHtml5HtmlAttributes(int32_t aMode);
63 ~nsHtml5HtmlAttributes();
65 // Remove getIndex when removing isindex support
66 int32_t getIndex(nsHtml5AttributeName* aName);
68 nsHtml5String getValue(nsHtml5AttributeName* aName);
69 int32_t getLength();
70 nsAtom* getLocalNameNoBoundsCheck(int32_t aIndex);
71 int32_t getURINoBoundsCheck(int32_t aIndex);
72 nsAtom* getPrefixNoBoundsCheck(int32_t aIndex);
73 nsHtml5String getValueNoBoundsCheck(int32_t aIndex);
74 nsHtml5AttributeName* getAttributeNameNoBoundsCheck(int32_t aIndex);
75 int32_t getLineNoBoundsCheck(int32_t aIndex);
76 void addAttribute(nsHtml5AttributeName* aName, nsHtml5String aValue,
77 int32_t aLine);
78 void AddAttributeWithLocal(nsAtom* aName, nsHtml5String aValue,
79 int32_t aLine);
80 void clear(int32_t aMode);
81 void releaseValue(int32_t aIndex);
82 void clearWithoutReleasingContents();
83 bool contains(nsHtml5AttributeName* aName);
84 void adjustForMath();
85 void adjustForSvg();
86 nsHtml5HtmlAttributes* cloneAttributes();
87 bool equalsAnother(nsHtml5HtmlAttributes* aOther);
88 static void initializeStatics();
89 static void releaseStatics();
92 #endif