changeset 519:ca0b92b40dfc

remove nonCssProperties from Node
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Thu, 30 Oct 2008 18:48:42 +0100
parents 52394e6577ba
children 9b75ec5b5de5
files src/html.cc src/html_common.hh src/styleengine.cc src/styleengine.hh
diffstat 4 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/html.cc	Thu Oct 30 18:24:26 2008 +0100
+++ b/src/html.cc	Thu Oct 30 18:48:42 2008 +0100
@@ -265,6 +265,7 @@
 void a_Html_set_top_font(DilloHtml *html, const char *name, int size,
                          int BI, int BImask)
 {
+#if 0
    FontAttrs font_attrs;
 
    font_attrs = *html->styleEngine->style ()->font;
@@ -279,6 +280,7 @@
 
    HTML_SET_TOP_ATTR (html, font,
                       Font::create (HT2LT(html), &font_attrs));
+#endif
 }
 
 /*
@@ -2464,7 +2466,7 @@
 static void Html_tag_open_a(DilloHtml *html, const char *tag, int tagsize)
 {
    DilloUrl *url;
-   CssPropertyList *props;
+   CssPropertyList props;
    CssProperty::Value propValue;
    const char *attrbuf;
 
@@ -2480,10 +2482,9 @@
       url = a_Html_url_new(html, attrbuf, NULL, 0);
       dReturn_if_fail ( url != NULL );
 
-      props = new CssPropertyList ();
       propValue.x_link = Html_set_new_link(html, &url);
-      props->set (CssProperty::PROPERTY_X_LINK, propValue);
-      html->styleEngine->setNonCssProperties (props);
+      props.set (CssProperty::PROPERTY_X_LINK, propValue);
+      html->styleEngine->setNonCssProperties (&props);
    }
 
    if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "name"))) {
--- a/src/html_common.hh	Thu Oct 30 18:24:26 2008 +0100
+++ b/src/html_common.hh	Thu Oct 30 18:48:42 2008 +0100
@@ -38,6 +38,7 @@
  * Change one toplevel attribute. var should be an identifier. val is
  * only evaluated once, so you can safely use a function call for it.
  */
+#if 0
 #define HTML_SET_TOP_ATTR(html, var, val) \
    do { \
       StyleAttrs style_attrs; \
@@ -50,7 +51,9 @@
          Style::create (HT2LT(html), &style_attrs); \
       old_style->unref (); \
    } while (FALSE)
-
+#else
+#define HTML_SET_TOP_ATTR(html, var, val) 
+#endif
 /*
  * Typedefs 
  */
--- a/src/styleengine.cc	Thu Oct 30 18:24:26 2008 +0100
+++ b/src/styleengine.cc	Thu Oct 30 18:48:42 2008 +0100
@@ -53,7 +53,6 @@
    stack->increase ();
    Node *n =  stack->getRef (stack->size () - 1);
    n->style = NULL;
-   n->nonCssProperties = NULL;
    n->depth = stack->size ();
    n->tag = tag;
    n->id = id;
@@ -62,7 +61,7 @@
 }
 
 void StyleEngine::setNonCssProperties (CssPropertyList *props) {
-   stack->getRef (stack->size () - 1)->nonCssProperties = props;
+   style0 (props); // evaluate now, so caller can free props
 }
 
 void StyleEngine::endElement (int tag) {
@@ -72,8 +71,6 @@
    Node *n =  stack->getRef (stack->size () - 1);
    if (n->style)
       n->style->unref ();
-   if (n->nonCssProperties)
-      delete n->nonCssProperties;
    
    stack->setSize (stack->size () - 1);
 }
@@ -128,15 +125,14 @@
    attrs->font = Font::create (layout, &fontAttrs);
 }
 
-Style * StyleEngine::style0 () {
+Style * StyleEngine::style0 (CssPropertyList *nonCssProperties) {
    CssPropertyList props;
    CssPropertyList *tagStyleProps = CssPropertyList::parse (
       stack->getRef (stack->size () - 1)->styleAttribute);
 
    StyleAttrs attrs = *stack->getRef (stack->size () - 2)->style;
 
-   cssContext->apply (&props, this, tagStyleProps,
-      stack->getRef (stack->size () - 1)->nonCssProperties);
+   cssContext->apply (&props, this, tagStyleProps, nonCssProperties);
 
    apply (&attrs, &props);
 
--- a/src/styleengine.hh	Thu Oct 30 18:24:26 2008 +0100
+++ b/src/styleengine.hh	Thu Oct 30 18:48:42 2008 +0100
@@ -10,7 +10,6 @@
       class Node : public DoctreeNode {
          public:
             dw::core::style::Style *style;
-            CssPropertyList *nonCssProperties;
             const char *styleAttribute;
       };
 
@@ -18,7 +17,7 @@
       lout::misc::SimpleVector <Node> *stack;
       CssContext *cssContext;
 
-      dw::core::style::Style *style0 ();
+      dw::core::style::Style *style0 (CssPropertyList *nonCssProperties = NULL);
       void apply (dw::core::style::StyleAttrs *attrs, CssPropertyList *props);
 
    public: