diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-05 14:43:11 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-05 14:43:11 +0100 |
commit | aa70b2f628549b2426693572baf96fc71341c404 (patch) | |
tree | 541faf8eebe02ee5fd72052d8e8c2b5e4ca9333e /src/table.cc | |
parent | c6dac9cfdfb1b193c0680834fdfebfdb96edcb23 (diff) |
reduce number of styleEngine::style0() calls
Rearrange code, so that for each new element, StyleEngine::setNonCssHints()
is called before the first call to StyleEngine::style() or
StyleEngine::wordStyle().
This avoids unnecessary CSS style computations which are expensive.
Add an assertion to ensure this.
Diffstat (limited to 'src/table.cc')
-rw-r--r-- | src/table.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/table.cc b/src/table.cc index 34c0f13e..53325410 100644 --- a/src/table.cc +++ b/src/table.cc @@ -48,7 +48,6 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) int cssLength; #endif - DW2TB(html->dw)->addParbreak (0, html->styleEngine->wordStyle ()); #ifdef USE_TABLES if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "border"))) @@ -101,6 +100,8 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) html->styleEngine->setNonCssHints (&props); + DW2TB(html->dw)->addParbreak (0, html->styleEngine->wordStyle ()); + /* The style for the cells */ table_cell_props = new CssPropertyList (); if (border > 0) { @@ -172,17 +173,16 @@ void Html_tag_open_tr(DilloHtml *html, const char *tag, int tagsize) } } - html->styleEngine->inheritBackgroundColor (); - html->styleEngine->setNonCssHints (&props); - - ((dw::Table*)S_TOP(html)->table)->addRow (html->styleEngine->style ()); - if (a_Html_get_attr (html, tag, tagsize, "align")) { S_TOP(html)->cell_text_align_set = TRUE; a_Html_tag_set_align_attr (html, &props, tag, tagsize); - html->styleEngine->setNonCssHints (&props); } + html->styleEngine->inheritBackgroundColor (); + html->styleEngine->setNonCssHints (&props); + + ((dw::Table*)S_TOP(html)->table)->addRow (html->styleEngine->style ()); + table_cell_props = new CssPropertyList (*S_TOP(html)->table_cell_props); if (bgcolor != -1) { table_cell_props->set (CSS_PROPERTY_BACKGROUND_COLOR, |