diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2014-02-15 23:58:41 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2014-02-15 23:58:41 +0100 |
commit | 891ba8ec637c42a173dd5b044de4e56f86a33fec (patch) | |
tree | 5230b92f5c38966a52e61a58cedbd6f413a96c19 /src/css.cc | |
parent | ff62eabe7e4045721c8a22fb0d0ab75dc85cdb06 (diff) |
share user agent style between CssContext's
Diffstat (limited to 'src/css.cc')
-rw-r--r-- | src/css.cc | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -498,8 +498,11 @@ void CssStyleSheet::apply (CssPropertyList *props, Doctree *docTree, } } +CssStyleSheet CssContext::userAgentSheet; + CssContext::CssContext () { pos = 0; + matchCache[CSS_PRIMARY_USER_AGENT].setSize (userAgentSheet.matchCacheOffset, -1); } /** @@ -516,8 +519,8 @@ void CssContext::apply (CssPropertyList *props, Doctree *docTree, CssPropertyList *tagStyle, CssPropertyList *tagStyleImportant, CssPropertyList *nonCssHints) { - sheet[CSS_PRIMARY_USER_AGENT].apply (props, docTree, node, - &matchCache[CSS_PRIMARY_USER_AGENT]); + userAgentSheet.apply (props, docTree, node, + &matchCache[CSS_PRIMARY_USER_AGENT]); sheet[CSS_PRIMARY_USER].apply (props, docTree, node, &matchCache[CSS_PRIMARY_USER]); @@ -551,6 +554,9 @@ void CssContext::addRule (CssSelector *sel, CssPropertyList *props, !rule->isSafe ()) { MSG_WARN ("Ignoring unsafe author style that might reveal browsing history\n"); delete rule; + } else if (order == CSS_PRIMARY_USER_AGENT) { + userAgentSheet.addRule (rule); + matchCache[CSS_PRIMARY_USER_AGENT].setSize (userAgentSheet.matchCacheOffset, -1); } else { sheet[order].addRule (rule); matchCache[order].setSize (sheet[order].matchCacheOffset, -1); |