diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-04-23 14:53:33 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-04-23 14:53:33 +0200 |
commit | 0b045d5fe5e9540ba22b2d441d4346fbd3646dd9 (patch) | |
tree | fdd30ece6f5c57c6c0fc380065db83ae2d2acd7d /src/css.hh | |
parent | 1b40d6342a64924426642cc742849a8172e25fb2 (diff) |
use CSS rule position when specificity is equal
When two CSS rules have the same specificity make sure they are
applied in the order as they appear in the stylesheets (see [1]).
Testcase:
<html><head><style>
A:link {color: red}
A.foo {color: green}
</style></head><body>
<a class="foo" href=http://www.dillo.org>should be green</a>
</body></html>
Reported by: corvid
[1] http://www.w3.org/TR/CSS2/cascade.html#cascading-order
Diffstat (limited to 'src/css.hh')
-rw-r--r-- | src/css.hh | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -407,17 +407,18 @@ class CssSelector { class CssRule { private: CssPropertyList *props; - int spec; + int spec, pos; public: CssSelector *selector; - CssRule (CssSelector *selector, CssPropertyList *props); + CssRule (CssSelector *selector, CssPropertyList *props, int pos); ~CssRule (); void apply (CssPropertyList *props, Doctree *docTree, const DoctreeNode *node); inline int specificity () { return spec; }; + inline int position () { return pos; }; void print (); }; @@ -475,6 +476,7 @@ class CssContext { static CssStyleSheet *userStyle; static CssStyleSheet *userImportantStyle; CssStyleSheet *sheet[CSS_PRIMARY_USER_IMPORTANT + 1]; + int pos; void buildUserAgentStyle (); void buildUserStyle (); |