Backed out changeset bcbab342eed8 (bug 1889658) for causing wpt reftest failures...
[gecko.git] / parser / html / nsHtml5HtmlAttributes.h
blobcf04fa34c671e883ed9b21c20fd85ee1d9e79e2b
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 bool mDuplicateAttributeError = false;
60 void AddEntry(nsHtml5AttributeEntry&& aEntry);
62 public:
63 explicit nsHtml5HtmlAttributes(int32_t aMode);
64 ~nsHtml5HtmlAttributes();
66 void setDuplicateAttributeError() { mDuplicateAttributeError = true; }
67 bool getDuplicateAttributeError() { return mDuplicateAttributeError; }
69 // Remove getIndex when removing isindex support
70 int32_t getIndex(nsHtml5AttributeName* aName);
72 nsHtml5String getValue(nsHtml5AttributeName* aName);
73 int32_t getLength();
74 nsAtom* getLocalNameNoBoundsCheck(int32_t aIndex);
75 int32_t getURINoBoundsCheck(int32_t aIndex);
76 nsAtom* getPrefixNoBoundsCheck(int32_t aIndex);
77 nsHtml5String getValueNoBoundsCheck(int32_t aIndex);
78 nsHtml5AttributeName* getAttributeNameNoBoundsCheck(int32_t aIndex);
79 int32_t getLineNoBoundsCheck(int32_t aIndex);
80 void addAttribute(nsHtml5AttributeName* aName, nsHtml5String aValue,
81 int32_t aLine);
82 void AddAttributeWithLocal(nsAtom* aName, nsHtml5String aValue,
83 int32_t aLine);
84 void clear(int32_t aMode);
85 void releaseValue(int32_t aIndex);
86 void clearWithoutReleasingContents();
87 bool contains(nsHtml5AttributeName* aName);
88 void adjustForMath();
89 void adjustForSvg();
90 nsHtml5HtmlAttributes* cloneAttributes();
91 bool equalsAnother(nsHtml5HtmlAttributes* aOther);
92 static void initializeStatics();
93 static void releaseStatics();
96 #endif