Changeset 4759
- Timestamp:
- 02/06/11 17:42:54 (2 years ago)
- Location:
- gaycko/trunk
- Files:
-
- 5 edited
-
src/dom/dom.c (modified) (1 diff)
-
src/dom/dom.h (modified) (2 diffs)
-
src/render/position.c (modified) (6 diffs)
-
src/render/renderer.h (modified) (1 diff)
-
tests/table.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gaycko/trunk/src/dom/dom.c
r4758 r4759 84 84 }else if(!strncmp(e->name, "table", 3)) { 85 85 e->type = ELEM_TABLE; 86 e->specific.table = malloc(sizeof(gTable)); 87 e->specific.table->border = 0; 88 e->specific.table->tr_count = 0; 86 89 }else if(!strncmp(e->name, "tr", 3)) { 87 90 e->type = ELEM_TR; 91 e->specific.tr = malloc(sizeof(gTr)); 92 e->specific.tr->border = 0; 93 e->specific.tr->td_count = 0; 88 94 }else if(!strncmp(e->name, "td", 3)) { 89 95 e->type = ELEM_TD; -
gaycko/trunk/src/dom/dom.h
r4758 r4759 55 55 typedef struct gAttribute_ gAttribute; 56 56 57 struct gTable_ { 58 unsigned int border; 59 unsigned int tr_count; 60 }; 61 typedef struct gTable_ gTable; 57 62 63 struct gTr_ { 64 unsigned int border; 65 unsigned int td_count; 66 }; 67 typedef struct gTr_ gTr; 58 68 59 69 typedef struct gNode_ gNode; 60 70 struct gNode_ { 71 72 /* General */ 61 73 nodeType type; 62 74 char *name; 63 75 unsigned int level; 76 77 unsigned int children_count; 78 gNode **children; 79 64 80 65 81 unsigned int attribute_count; … … 67 83 char *text; 68 84 69 unsigned int children_count;70 gNode **children; 85 gNode *parent; 86 71 87 88 /* Rendering */ 72 89 gProperty *properties; 73 74 gNode *parent; 90 union { 91 gTable *table; 92 gTr *tr; 93 }specific; 94 75 95 }; 76 96 -
gaycko/trunk/src/render/position.c
r4758 r4759 30 30 w = (node->children[c]->properties->width); 31 31 } 32 gaycko_fix_table(node->children[c]); 32 33 break; 33 34 … … 38 39 w+=node->children[c]->properties->width+1; 39 40 break; 41 40 42 case ELEM_TD: 41 43 gaycko_get_position(node->children[c], parent); … … 51 53 w+=node->children[c]->properties->width+1; 52 54 break; 55 53 56 case ELEM_HR: 54 57 node->children[c]->properties->height+=1; … … 56 59 w+=node->children[c]->properties->width+1; 57 60 break; 61 58 62 case ELEM_H1: 59 63 case ELEM_H2: … … 83 87 break; 84 88 89 85 90 default: 86 91 gaycko_get_position(node->children[c], node); … … 102 107 node->properties->height = h; 103 108 } 109 110 void gaycko_fix_table(gNode *table) { 111 unsigned int tr = 0; 112 table->specific.table->tr_count = 0; 113 114 for(tr = 0 ; tr < table->children_count; tr++) { 115 if(table->children[tr]->type == ELEM_TR) { 116 gaycko_fix_tr(table->children[tr]); 117 table->specific.table->tr_count++; 118 } 119 } 120 121 } 122 void gaycko_fix_tr(gNode *tr) { 123 unsigned int td = 0; 124 tr->specific.tr->td_count = 0; 125 126 for(td = 0 ; td < tr->children_count; td++) { 127 if(tr->children[td]->type == ELEM_TD) { 128 tr->specific.tr->td_count++; 129 } 130 } 131 } 132 133 134 135 136 -
gaycko/trunk/src/render/renderer.h
r4753 r4759 26 26 void gaycko_get_position (gNode *node, gNode *parent); 27 27 28 void gaycko_fix_table(gNode *table); 29 void gaycko_fix_tr(gNode *tr); 30 28 31 void gaycko_print_dom(gWindow *window); 29 32 void gaycko_print_node(gNode *node,gWindow *window); 33 34 30 35 31 36 #endif /* RENDERER_H */ -
gaycko/trunk/tests/table.html
r4752 r4759 5 5 <table width=50%> 6 6 <tr><td> Cell1 </td><td> Cell2</td></tr> 7 <tr><td> Cell3 </td><td> Cell4</td></tr>7 <tr><td> Cell3 plus grande</td><td> Cell4</td></tr> 8 8 </table> 9 9 </body>
Note: See TracChangeset
for help on using the changeset viewer.
