From 7b26dbbb7cbb0a69b47c42e4204545e0f845e4f5 Mon Sep 17 00:00:00 2001 From: corvid Date: Wed, 23 Jul 2014 19:02:56 +0000 Subject: clarify situation with MENU element --- src/html.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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); } /* -- cgit v1.2.3 From b472ce688991d5c01812f02c128830132dcbe3f5 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 25 Jul 2014 22:48:32 +0200 Subject: avoid requesting background images if an ancestor has display:none noticed-by: eocene --- src/styleengine.cc | 17 +++++++++++------ src/styleengine.hh | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src') 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; }; -- cgit v1.2.3