diff options
-rw-r--r-- | src/styleengine.cc | 17 | ||||
-rw-r--r-- | src/styleengine.hh | 1 |
2 files changed, 12 insertions, 6 deletions
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; }; |