annotate src/styleengine.hh @ 590:eb1072890045

setNonCssProperties() -> setNonCssHints()
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 14 Nov 2008 16:16:25 +0100
parents d82c6a91385f
children 4ff90b6242f9
rev   line source
497
96713a0f5d8b css.[ch][ch] -> styleengine.[ch][ch]
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 495
diff changeset
1 #ifndef __STYLEENGINE_HH__
96713a0f5d8b css.[ch][ch] -> styleengine.[ch][ch]
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 495
diff changeset
2 #define __STYLEENGINE_HH__
493
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
3
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
4 #include "dw/core.hh"
501
424e4f409636 add doctree.hh
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 499
diff changeset
5 #include "doctree.hh"
506
03de2284bfa6 switch to original enum names from dillo-0.8.0-css-3
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 503
diff changeset
6 #include "css.hh"
493
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
7
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
8 class StyleEngine : public Doctree {
493
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
9 private:
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
10 class Node : public DoctreeNode {
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
11 public:
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
12 dw::core::style::Style *style;
509
fd2454cd0120 pass Layout to StyleEngine
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 506
diff changeset
13 const char *styleAttribute;
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
14 };
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
15
509
fd2454cd0120 pass Layout to StyleEngine
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 506
diff changeset
16 dw::core::Layout *layout;
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
17 lout::misc::SimpleVector <Node> *stack;
509
fd2454cd0120 pass Layout to StyleEngine
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 506
diff changeset
18 CssContext *cssContext;
493
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
19
590
eb1072890045 setNonCssProperties() -> setNonCssHints()
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 589
diff changeset
20 dw::core::style::Style *style0 (CssPropertyList *nonCssHints = NULL);
509
fd2454cd0120 pass Layout to StyleEngine
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 506
diff changeset
21 void apply (dw::core::style::StyleAttrs *attrs, CssPropertyList *props);
575
13bbef5403a2 use CssLength in computeValue
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 573
diff changeset
22 int computeValue (CssLength value, dw::core::style::Font *font);
506
03de2284bfa6 switch to original enum names from dillo-0.8.0-css-3
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 503
diff changeset
23
493
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
24 public:
509
fd2454cd0120 pass Layout to StyleEngine
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 506
diff changeset
25 StyleEngine (dw::core::Layout *layout);
493
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
26 ~StyleEngine ();
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
27
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
28 /* Doctree interface */
506
03de2284bfa6 switch to original enum names from dillo-0.8.0-css-3
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 503
diff changeset
29 inline const DoctreeNode *top () {
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
30 return stack->getRef (stack->size () - 1);
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
31 };
506
03de2284bfa6 switch to original enum names from dillo-0.8.0-css-3
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 503
diff changeset
32
03de2284bfa6 switch to original enum names from dillo-0.8.0-css-3
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 503
diff changeset
33 inline const DoctreeNode *parent (const DoctreeNode *n) {
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
34 if (n->depth > 0)
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
35 return stack->getRef (n->depth - 1);
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
36 else
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
37 return NULL;
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
38 };
493
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
39
589
d82c6a91385f call StyleEngine::startElement() in Html_force_push_tag() to fix assertions
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 576
diff changeset
40 void startElement (int tag, const char *id = NULL, const char *klass = NULL,
d82c6a91385f call StyleEngine::startElement() in Html_force_push_tag() to fix assertions
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 576
diff changeset
41 const char *style = NULL);
495
7224de9c34b7 add StyleEngine
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 493
diff changeset
42 void endElement (int tag);
590
eb1072890045 setNonCssProperties() -> setNonCssHints()
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 589
diff changeset
43 void setNonCssHints (CssPropertyList *nonCssHints);
536
c0af24cdb695 set CSS pseudo class in Html_tag_open_a()
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 519
diff changeset
44 void setPseudoClass (const char *pseudoClass);
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
45
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
46 inline dw::core::style::Style *style () {
506
03de2284bfa6 switch to original enum names from dillo-0.8.0-css-3
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 503
diff changeset
47 dw::core::style::Style *s = stack->getRef (stack->size () - 1)->style;
03de2284bfa6 switch to original enum names from dillo-0.8.0-css-3
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 503
diff changeset
48 if (s)
03de2284bfa6 switch to original enum names from dillo-0.8.0-css-3
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 503
diff changeset
49 return s;
03de2284bfa6 switch to original enum names from dillo-0.8.0-css-3
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 503
diff changeset
50 else
03de2284bfa6 switch to original enum names from dillo-0.8.0-css-3
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 503
diff changeset
51 return style0 ();
503
00b31843839b implement various apply() methods
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 501
diff changeset
52 };
493
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
53 };
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
54
03e0cacbb994 add css.hh css.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents:
diff changeset
55 #endif