aboutsummaryrefslogtreecommitdiff
path: root/src/css.hh
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-10-28 21:27:48 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-10-28 21:27:48 +0100
commit3c493dd1d7470fcaaa26d18b3b8c4ebabdb1f688 (patch)
treec4197e2f3427c7c37a1ccb90c2411b4f0493f665 /src/css.hh
parentfffb653ce6ab4689cb3c5aec18e980497e73ac6d (diff)
add doctree.hh
Diffstat (limited to 'src/css.hh')
-rw-r--r--src/css.hh66
1 files changed, 63 insertions, 3 deletions
diff --git a/src/css.hh b/src/css.hh
index 50e5ae88..b59307ae 100644
--- a/src/css.hh
+++ b/src/css.hh
@@ -3,6 +3,8 @@
#include "dw/core.hh"
+#include "doctree.hh"
+
class CssProperty {
public:
typedef union {
@@ -116,19 +118,77 @@ class CssProperty {
void apply (dw::core::style::StyleAttrs *styleAttr);
};
-typedef lout::container::typed::List <CssProperty> CssPropertyList;
+class CssPropertyList : public lout::misc::SimpleVector <CssProperty*> {
+ public:
+ CssPropertyList() : lout::misc::SimpleVector <CssProperty*> (1) {};
+ void apply (dw::core::style::StyleAttrs *styleAttr);
+};
+/** \todo proper implementation */
class CssSelector {
+ private:
+ int tagIndex;
+ const char *klass, *id;
+
+ public:
+ CssSelector (int tagIndex, const char *klass, const char *id) {
+ this->tagIndex = tagIndex;
+ this->klass = klass;
+ this->id = id;
+ };
+
+ bool match (Doctree *dt);
};
class CssRule {
private:
- CssPropertyList props;
+ CssSelector *selector;
+ CssPropertyList *props;
public:
- CssRule ();
+ CssRule (CssSelector *selector, CssPropertyList *props) {
+ this->selector = selector;
+ this->props = props;
+ };
~CssRule ();
+ void apply (dw::core::style::StyleAttrs *styleAttr);
+};
+
+class CssStyleSheet : public lout::misc::SimpleVector <CssRule*> {
+ public:
+ CssStyleSheet() : lout::misc::SimpleVector <CssRule*> (1) {};
+ void apply (dw::core::style::StyleAttrs *styleAttr);
+};
+
+typedef enum {
+ CSS_PRIMARY_USER_IMPORTANT,
+ CSS_PRIMARY_AUTHOR_IMPORTANT,
+ CSS_PRIMARY_AUTHOR,
+ CSS_PRIMARY_USER,
+ CSS_PRIMARY_USER_AGENT
+} CssPrimaryOrder;
+
+class CssContext {
+ public:
+ typedef enum {
+ USER_IMPORTANT,
+ AUTHOR_IMPORTANT,
+ AUTHOR,
+ USER,
+ USER_AGENT
+ } PrimaryOrder;
+
+ private:
+ CssStyleSheet sheet[USER_AGENT + 1];
+
+ public:
+ void addRule (CssRule *rule, PrimaryOrder order) {
+ sheet[order].increase ();
+ sheet[order].set (sheet[order].size () - 1, rule);
+ };
+
+ void apply (dw::core::style::StyleAttrs *styleAttr);
};
#endif