diff options
Diffstat (limited to 'src/css.cc')
-rw-r--r-- | src/css.cc | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -27,6 +27,7 @@ CssPropertyList::CssPropertyList (const CssPropertyList &p, bool deep) : lout::misc::SimpleVector <CssProperty> (p) { refCount = 0; + safe = p.safe; if (deep) { for (int i = 0; i < size (); i++) { CssProperty *p = getRef(i); @@ -58,6 +59,9 @@ void CssPropertyList::set (CssPropertyName name, CssValueType type, CssPropertyValue value) { CssProperty *prop; + if (name == CSS_PROPERTY_DISPLAY || name == CSS_PROPERTY_BACKGROUND_IMAGE) + safe = false; + for (int i = 0; i < size (); i++) { prop = getRef (i); @@ -169,6 +173,13 @@ void CssSelector::addSimpleSelector (Combinator c) { cs->selector = new CssSimpleSelector (); } +bool CssSelector::checksPseudoClass () { + for (int i = 0; i < selectorList->size (); i++) + if (selectorList->getRef (i)->selector->getPseudoClass ()) + return true; + return false; +} + /** * \brief Return the specificity of the selector. * @@ -517,6 +528,13 @@ void CssContext::addRule (CssSelector *sel, CssPropertyList *props, if (props->size () > 0) { CssRule *rule = new CssRule (sel, props, pos++); - sheet[order].addRule (rule); + if ((order == CSS_PRIMARY_AUTHOR || + order == CSS_PRIMARY_AUTHOR_IMPORTANT) && + !rule->isSafe ()) { + MSG_WARN ("Ignoring unsafe author style that might reveal browsing history\n"); + delete rule; + } else { + sheet[order].addRule (rule); + } } } |