summaryrefslogtreecommitdiffstats
path: root/parser/html/nsHtml5AttributeEntry.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /parser/html/nsHtml5AttributeEntry.h
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--parser/html/nsHtml5AttributeEntry.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/parser/html/nsHtml5AttributeEntry.h b/parser/html/nsHtml5AttributeEntry.h
new file mode 100644
index 0000000000..6fbca7f1cb
--- /dev/null
+++ b/parser/html/nsHtml5AttributeEntry.h
@@ -0,0 +1,70 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef nsHtml5AttributeEntry_h
+#define nsHtml5AttributeEntry_h
+
+#include "nsHtml5AttributeName.h"
+
+class nsHtml5AttributeEntry final {
+ public:
+ nsHtml5AttributeEntry(nsHtml5AttributeName* aName, nsHtml5String aValue,
+ int32_t aLine)
+ : mLine(aLine), mValue(aValue) {
+ // Let's hope the compiler coalesces the following as appropriate.
+ mLocals[0] = aName->getLocal(0);
+ mLocals[1] = aName->getLocal(1);
+ mLocals[2] = aName->getLocal(2);
+ mPrefixes[0] = aName->getPrefix(0);
+ mPrefixes[1] = aName->getPrefix(1);
+ mPrefixes[2] = aName->getPrefix(2);
+ mUris[0] = aName->getUri(0);
+ mUris[1] = aName->getUri(1);
+ mUris[2] = aName->getUri(2);
+ }
+
+ // Isindex-only so doesn't need to deal with SVG and MathML
+ nsHtml5AttributeEntry(nsAtom* aName, nsHtml5String aValue, int32_t aLine)
+ : mLine(aLine), mValue(aValue) {
+ // Let's hope the compiler coalesces the following as appropriate.
+ mLocals[0] = aName;
+ mLocals[1] = aName;
+ mLocals[2] = aName;
+ mPrefixes[0] = nullptr;
+ mPrefixes[1] = nullptr;
+ mPrefixes[2] = nullptr;
+ mUris[0] = kNameSpaceID_None;
+ mUris[1] = kNameSpaceID_None;
+ mUris[2] = kNameSpaceID_None;
+ }
+
+ inline nsAtom* GetLocal(int32_t aMode) { return mLocals[aMode]; }
+
+ inline nsAtom* GetPrefix(int32_t aMode) { return mPrefixes[aMode]; }
+
+ inline int32_t GetUri(int32_t aMode) { return mUris[aMode]; }
+
+ inline nsHtml5String GetValue() { return mValue; }
+
+ inline int32_t GetLine() { return mLine; }
+
+ inline void ReleaseValue() { mValue.Release(); }
+
+ inline nsHtml5AttributeEntry Clone() {
+ // Copy the memory
+ nsHtml5AttributeEntry clone(*this);
+ // Increment refcount for value
+ clone.mValue = this->mValue.Clone();
+ return clone;
+ }
+
+ private:
+ RefPtr<nsAtom> mLocals[3];
+ RefPtr<nsAtom> mPrefixes[3];
+ int32_t mUris[3];
+ int32_t mLine;
+ nsHtml5String mValue;
+};
+
+#endif // nsHtml5AttributeEntry_h