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
28 #include "nsHtml5AtomTable.h"
29 #include "nsHtml5String.h"
30 #include "nsNameSpaceManager.h"
31 #include "nsIContent.h"
32 #include "nsTraceRefcnt.h"
34 #include "nsHtml5ArrayCopy.h"
35 #include "nsAHtml5TreeBuilderState.h"
36 #include "nsHtml5ByteReadable.h"
37 #include "nsHtml5Macros.h"
38 #include "nsIContentHandle.h"
40 #include "nsHtml5AttributeEntry.h"
42 class nsHtml5StreamParser
;
44 class nsHtml5Tokenizer
;
45 class nsHtml5TreeBuilder
;
46 class nsHtml5MetaScanner
;
47 class nsHtml5AttributeName
;
48 class nsHtml5ElementName
;
49 class nsHtml5UTF16Buffer
;
50 class nsHtml5StateSnapshot
;
51 class nsHtml5Portability
;
53 class nsHtml5HtmlAttributes
{
55 static nsHtml5HtmlAttributes
* EMPTY_ATTRIBUTES
;
58 AutoTArray
<nsHtml5AttributeEntry
, 5> mStorage
;
60 void AddEntry(nsHtml5AttributeEntry
&& aEntry
);
63 explicit nsHtml5HtmlAttributes(int32_t aMode
);
64 ~nsHtml5HtmlAttributes();
66 // Remove getIndex when removing isindex support
67 int32_t getIndex(nsHtml5AttributeName
* aName
);
69 nsHtml5String
getValue(nsHtml5AttributeName
* aName
);
71 nsAtom
* getLocalNameNoBoundsCheck(int32_t aIndex
);
72 int32_t getURINoBoundsCheck(int32_t aIndex
);
73 nsAtom
* getPrefixNoBoundsCheck(int32_t aIndex
);
74 nsHtml5String
getValueNoBoundsCheck(int32_t aIndex
);
75 nsHtml5AttributeName
* getAttributeNameNoBoundsCheck(int32_t aIndex
);
76 int32_t getLineNoBoundsCheck(int32_t aIndex
);
77 void addAttribute(nsHtml5AttributeName
* aName
, nsHtml5String aValue
,
79 void AddAttributeWithLocal(nsAtom
* aName
, nsHtml5String aValue
,
81 void clear(int32_t aMode
);
82 void releaseValue(int32_t aIndex
);
83 void clearWithoutReleasingContents();
84 bool contains(nsHtml5AttributeName
* aName
);
87 nsHtml5HtmlAttributes
* cloneAttributes();
88 bool equalsAnother(nsHtml5HtmlAttributes
* aOther
);
89 static void initializeStatics();
90 static void releaseStatics();