aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2014-07-26 17:22:21 +0200
committerSebastian Geerken <devnull@localhost>2014-07-26 17:22:21 +0200
commitcc71bb21e3444e1667553c545da2044482a31f18 (patch)
tree84a420cf437abe7017f883c2374e313bff212216 /src
parent107769eb5b34a361238c3baa04c5c9d610b55814 (diff)
parentb472ce688991d5c01812f02c128830132dcbe3f5 (diff)
Merge with main repo.
Diffstat (limited to 'src')
-rw-r--r--src/html.cc11
-rw-r--r--src/styleengine.cc17
-rw-r--r--src/styleengine.hh1
3 files changed, 22 insertions, 7 deletions
diff --git a/src/html.cc b/src/html.cc
index 9fe8715f..9eafbe5a 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -2880,7 +2880,16 @@ static void Html_tag_open_dir(DilloHtml *html, const char *tag, int tagsize)
*/
static void Html_tag_open_menu(DilloHtml *html, const char *tag, int tagsize)
{
- Html_tag_open_dir(html, tag, tagsize);
+ /* In another bit of ridiculous mess from the HTML5 world, the menu
+ * element, which was deprecated in HTML4:
+ * - does not appear at all in W3C's HTML5 spec
+ * - appears in WHATWG's HTML5 doc and the W3C's 5.1 draft, where it
+ * means something totally different than it did in the old days
+ * (now it's for popup menus and toolbar menus rather than being a
+ * sort of list).
+ */
+ if (!(html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f))
+ Html_tag_open_dir(html, tag, tagsize);
}
/*
diff --git a/src/styleengine.cc b/src/styleengine.cc
index f92cccf8..74a6330f 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -113,7 +113,7 @@ StyleEngine::~StyleEngine () {
void StyleEngine::stackPush () {
static const Node emptyNode = {
- NULL, NULL, NULL, NULL, NULL, NULL, false, NULL
+ NULL, NULL, NULL, NULL, NULL, NULL, false, false, NULL
};
stack->setSize (stack->size () + 1, emptyNode);
@@ -146,6 +146,8 @@ void StyleEngine::startElement (int element, BrowserWindow *bw) {
dn->element = element;
n->doctreeNode = dn;
+ if (stack->size () > 1)
+ n->displayNone = stack->getRef (stack->size () - 2)->displayNone;
}
void StyleEngine::startElement (const char *tagname, BrowserWindow *bw) {
@@ -365,8 +367,8 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props,
DilloUrl *imgUrl = NULL;
/* Determine font first so it can be used to resolve relative lengths. */
- for (int i = 0; i < props->size (); i++) {
- CssProperty *p = props->getRef (i);
+ for (int j = 0; j < props->size (); j++) {
+ CssProperty *p = props->getRef (j);
switch (p->name) {
case CSS_PROPERTY_FONT_FAMILY:
@@ -513,8 +515,8 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props,
attrs->font = Font::create (layout, &fontAttrs);
- for (int i = 0; i < props->size (); i++) {
- CssProperty *p = props->getRef (i);
+ for (int j = 0; j < props->size (); j++) {
+ CssProperty *p = props->getRef (j);
switch (p->name) {
/* \todo missing cases */
@@ -603,6 +605,8 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props,
break;
case CSS_PROPERTY_DISPLAY:
attrs->display = (DisplayType) p->value.intVal;
+ if (attrs->display == DISPLAY_NONE)
+ stack->getRef (i)->displayNone = true;
break;
case CSS_PROPERTY_FLOAT:
attrs->vloat = (FloatType) p->value.intVal;
@@ -730,7 +734,8 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props,
}
}
- if (imgUrl && prefs.load_background_images && attrs->display != DISPLAY_NONE)
+ if (imgUrl && prefs.load_background_images &&
+ !stack->getRef (i)->displayNone)
{
attrs->backgroundImage = StyleImage::create();
DilloImage *image =
diff --git a/src/styleengine.hh b/src/styleengine.hh
index 772e7f63..db3e3b85 100644
--- a/src/styleengine.hh
+++ b/src/styleengine.hh
@@ -27,6 +27,7 @@ class StyleEngine {
dw::core::style::Style *wordStyle;
dw::core::style::Style *backgroundStyle;
bool inheritBackgroundColor;
+ bool displayNone;
DoctreeNode *doctreeNode;
};