summaryrefslogtreecommitdiff
path: root/src/css.hh
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-06-07 22:44:49 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-06-07 22:44:49 +0200
commit586e6deefd4c8bcf7f904246a68063c1199865a1 (patch)
tree3daa9f8479a052211f4cba17d28182a7e648c385 /src/css.hh
parent09b83d718a1edaa10d6947dcba5e4093637a88b8 (diff)
Ensure the same number of tags for CSS and HTML
The Tags array can be modified without changing the "ntags" number in the CSS side. To prevent errors, an static assert ensures the same number is used in both sides, which is known at compilation time. Fixes: https://github.com/dillo-browser/dillo/issues/184
Diffstat (limited to 'src/css.hh')
-rw-r--r--src/css.hh20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/css.hh b/src/css.hh
index 011c17f8..44328c42 100644
--- a/src/css.hh
+++ b/src/css.hh
@@ -1,8 +1,21 @@
+/*
+ * File: css.hh
+ *
+ * Copyright (C) 2008-2014 Johannes Hofmann <Johannes.Hofmann@gmx.de>
+ * Copyright (C) 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ */
+
#ifndef __CSS_HH__
#define __CSS_HH__
#include "dw/core.hh"
#include "doctree.hh"
+#include "html.hh"
/* Origin and weight. Used only internally.*/
typedef enum {
@@ -482,12 +495,7 @@ class CssStyleSheet {
<lout::object::ConstString, RuleList > (true, true, 256) {};
};
- static const int ntags = 90 + 14; // \todo don't hardcode
- /* 90 is the full number of html4 elements, including those which we have
- * implemented. From html5, let's add: article, header, footer, mark,
- * nav, section, aside, figure, figcaption, wbr, audio, video, source,
- * embed.
- */
+ static const int ntags = HTML_NTAGS;
RuleList elementTable[ntags], anyTable;
RuleMap idTable, classTable;