aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcorvid <corvid@dillo.org>2013-09-05 19:19:28 +0000
committercorvid <corvid@dillo.org>2013-09-05 19:19:28 +0000
commit249ddc27f05bc334bc554a692e6b2d541053afb3 (patch)
tree6d8bc879e05f46482957a1819eee312a985cafcf /src
parent75ad99f0389fb9f7434cfbefa205b1636d4ee1f1 (diff)
some html5 structural elements
The spec also has some rules about how, for instance, a footer can't go inside a header, and that sort of thing, but that can wait until we have something more sophisticated than a collection of IN_* flags.
Diffstat (limited to 'src')
-rw-r--r--src/css.hh6
-rw-r--r--src/html.cc8
-rw-r--r--src/styleengine.cc5
3 files changed, 17 insertions, 2 deletions
diff --git a/src/css.hh b/src/css.hh
index e81fde62..c29912b3 100644
--- a/src/css.hh
+++ b/src/css.hh
@@ -451,7 +451,11 @@ class CssStyleSheet {
<lout::object::ConstString, RuleList > (true, true, 256) {};
};
- static const int ntags = 90; // \todo replace 90
+ static const int ntags = 90 + 8; // \todo don't hardcode
+ /* 90 is the full number of html4 elements, including those which we have
+ * implemented. From html 5, let's add: article, header, footer, nav,
+ * section, aside, figure, figcaption.
+ */
RuleList elementTable[ntags], anyTable;
RuleMap idTable, classTable;
diff --git a/src/html.cc b/src/html.cc
index 5e2c799b..03e46607 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -3209,6 +3209,8 @@ const TagInfo Tags[] = {
{"address", B8(010110),'R',2,Html_tag_open_default, NULL, Html_tag_close_par},
{"area", B8(010001),'F',0, Html_tag_open_default, Html_tag_content_area,
NULL},
+ {"article", B8(011110),'R',2, Html_tag_open_default, NULL, NULL},
+ {"aside", B8(011110),'R',2, Html_tag_open_default, NULL, NULL},
{"b", B8(010101),'R',2, Html_tag_open_default, NULL, NULL},
{"base", B8(100001),'F',0, Html_tag_open_base, NULL, NULL},
/* basefont 010001 */
@@ -3236,7 +3238,10 @@ const TagInfo Tags[] = {
{"dt", B8(010110),'O',1, Html_tag_open_dt, NULL, Html_tag_close_par},
{"em", B8(010101),'R',2, Html_tag_open_default, NULL, NULL},
/* fieldset */
+ {"figcaption", B8(011110),'R',2, Html_tag_open_default, NULL, NULL},
+ {"figure", B8(011110),'R',2, Html_tag_open_default, NULL, NULL},
{"font", B8(010101),'R',2, Html_tag_open_font, NULL, NULL},
+ {"footer", B8(011110),'R',2, Html_tag_open_default, NULL, NULL},
{"form", B8(011110),'R',2, Html_tag_open_form, NULL, Html_tag_close_form},
{"frame", B8(010010),'F',0, Html_tag_open_frame, Html_tag_content_frame,
NULL},
@@ -3249,6 +3254,7 @@ const TagInfo Tags[] = {
{"h5", B8(010110),'R',2, Html_tag_open_h, NULL, NULL},
{"h6", B8(010110),'R',2, Html_tag_open_h, NULL, NULL},
{"head", B8(101101),'O',1, Html_tag_open_head, NULL, Html_tag_close_head},
+ {"header", B8(011110),'R',2, Html_tag_open_default, NULL, NULL},
{"hr", B8(010010),'F',0, Html_tag_open_hr, Html_tag_content_hr,
NULL},
{"html", B8(001110),'O',1, Html_tag_open_html, NULL, Html_tag_close_html},
@@ -3270,6 +3276,7 @@ const TagInfo Tags[] = {
/* menu 1010 -- TODO: not exactly 1010, it can contain LI and inline */
{"menu", B8(011010),'R',2, Html_tag_open_menu, NULL, Html_tag_close_par},
{"meta", B8(100001),'F',0, Html_tag_open_meta, NULL, NULL},
+ {"nav", B8(011110),'R',2, Html_tag_open_default, NULL, NULL},
/* noframes 1011 */
/* noscript 1011 */
{"object", B8(111101),'R',2, Html_tag_open_object, NULL, NULL},
@@ -3284,6 +3291,7 @@ const TagInfo Tags[] = {
{"s", B8(010101),'R',2, Html_tag_open_default, NULL, NULL},
{"samp", B8(010101),'R',2, Html_tag_open_default, NULL, NULL},
{"script", B8(111001),'R',2, Html_tag_open_script,NULL,Html_tag_close_script},
+ {"section", B8(011110),'R',2, Html_tag_open_default, NULL, NULL},
{"select", B8(010101),'R',2, Html_tag_open_select,NULL,Html_tag_close_select},
{"small", B8(010101),'R',2, Html_tag_open_default, NULL, NULL},
{"span", B8(010101),'R',2, Html_tag_open_span, NULL, NULL},
diff --git a/src/styleengine.cc b/src/styleengine.cc
index b3ea8b3b..50bd4cb7 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -830,7 +830,9 @@ void StyleEngine::buildUserAgentStyle () {
":link {color: blue; text-decoration: underline; cursor: pointer}"
":visited {color: #800080; text-decoration: underline; cursor: pointer}"
"h1, h2, h3, h4, h5, h6, b, strong {font-weight: bolder}"
- "address, center, div, h1, h2, h3, h4, h5, h6, ol, p, ul, pre {display: block}"
+ "address, article, aside, center, div, figure, figcaption, footer,"
+ " h1, h2, h3, h4, h5, h6, header, nav, ol, p, pre, section, ul"
+ " {display: block}"
"i, em, cite, address, var {font-style: italic}"
":link img, :visited img {border: 1px solid}"
"frameset, ul, ol, dir {margin-left: 40px}"
@@ -839,6 +841,7 @@ void StyleEngine::buildUserAgentStyle () {
* look better like this.
*/
"p {margin: 0.5em 0}"
+ "figure {margin: 1em 40px}"
"h1 {font-size: 2em; margin-top: .67em; margin-bottom: 0}"
"h2 {font-size: 1.5em; margin-top: .75em; margin-bottom: 0}"
"h3 {font-size: 1.17em; margin-top: .83em; margin-bottom: 0}"