Changeset 4762
- Timestamp:
- 02/06/11 19:19:06 (2 years ago)
- Location:
- gaycko/trunk
- Files:
-
- 4 edited
-
src/render/position.c (modified) (3 diffs)
-
src/render/renderer.h (modified) (1 diff)
-
src/render/table.c (modified) (6 diffs)
-
tests/table.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
gaycko/trunk/src/render/position.c
r4761 r4762 27 27 gaycko_get_position(node->children[c], parent); 28 28 x+=node->children[c]->properties->width; 29 30 31 gaycko_fix_table(node->children[c]); 29 32 if(node->children[c]->properties->width>w) { 30 33 w = (node->children[c]->properties->width); 31 34 } 32 gaycko_fix_table(node->children[c]);33 35 break; 34 36 … … 100 102 y+=node->children[c]->properties->height; 101 103 h+=node->children[c]->properties->height; 102 103 104 } 104 105 … … 108 109 109 110 110 111 111 void gaycko_add_node_x(gNode *node, unsigned int add) { 112 112 113 113 unsigned int e = 0; 114 114 for(e = 0 ; e < node->children_count; e++) { 115 node->children[e]->properties->x +=add; 115 //gaycko_add_node_x(node->children[e], add); 116 //gaycko_add_node_x(node->children[e], add); 117 node->children[e]->properties->width += add; 118 node->children[e]->properties->x += add; 116 119 } 120 node->properties->x += add; 121 117 122 } 118 123 -
gaycko/trunk/src/render/renderer.h
r4760 r4762 28 28 void gaycko_fix_table(gNode *table); 29 29 void gaycko_fix_tr(gNode *tr); 30 unsigned int gaycko_get_td_width(gNode *tr, unsigned int td_index); 31 void gaycko_set_td_width(gNode *tr, unsigned td_index, unsigned int width); 30 unsigned int gaycko_get_trtd_width(gNode *tr, unsigned int td_index); 31 unsigned int gaycko_get_node_width(gNode *td); 32 void gaycko_set_trtd_width(gNode *tr, unsigned td_index, unsigned int width); 33 unsigned int gaycko_get_tr_width(gNode *tr); 32 34 void gaycko_add_node_x(gNode *node, unsigned int add); 33 35 -
gaycko/trunk/src/render/table.c
r4761 r4762 29 29 /* Scan TD's and set each correspondants to the max width */ 30 30 unsigned int td = 0; 31 31 32 for(td = 0; td < last_tr->specific.tr->td_count; td++) { 32 33 unsigned int biggest_td = 0; 33 34 35 /* Find widest at a given X offset */ 34 36 for(e = 0 ; e < table->children_count; e++) { 35 37 if(table->children[e]->type == ELEM_TR) { 36 unsigned int td_width = gaycko_get_t d_width(table->children[e], td);38 unsigned int td_width = gaycko_get_trtd_width(table->children[e], td); 37 39 if(biggest_td < td_width) { 38 40 biggest_td = td_width; … … 40 42 } 41 43 } 44 /* Set the others's width to the widest one */ 42 45 for(e = 0 ; e < table->children_count; e++) { 43 46 if(table->children[e]->type == ELEM_TR) { 44 gaycko_set_t d_width(table->children[e], td, biggest_td);47 gaycko_set_trtd_width(table->children[e], td, biggest_td); 45 48 } 46 49 } 47 50 } 51 52 table->properties->width = gaycko_get_tr_width(last_tr); 53 printf("Table %d wide\n", table->properties->width); 54 48 55 } 56 57 58 59 unsigned int gaycko_get_tr_width(gNode *tr) { 60 unsigned int w = 0, td = 0; 61 62 for(td = 0 ; td < tr->children_count; td++) { 63 if(tr->children[td]->type == ELEM_TD) { 64 unsigned int tw = gaycko_get_node_width(tr->children[td]); 65 w += tw; 66 printf("TD width %d\n", tw); 67 } 68 } 69 printf("So TR width %d\n", w); 70 return w; 71 } 72 73 unsigned int gaycko_get_node_width(gNode *td) { 74 unsigned int e = 0; 75 unsigned int w = 0; 76 for(e = 0 ; e < td->children_count; e++) { 77 w+=td->properties->width; 78 } 79 return w; 80 } 81 49 82 50 83 void gaycko_fix_tr(gNode *tr) { … … 59 92 } 60 93 61 unsigned int gaycko_get_t d_width(gNode *tr, unsigned int td_index) {94 unsigned int gaycko_get_trtd_width(gNode *tr, unsigned int td_index) { 62 95 unsigned int e = 0; 63 96 unsigned int td = 0; … … 71 104 } 72 105 73 void gaycko_set_t d_width(gNode *tr, unsigned td_index, unsigned int width) {106 void gaycko_set_trtd_width(gNode *tr, unsigned td_index, unsigned int width) { 74 107 unsigned int e = 0; 75 108 unsigned int td = 0; … … 80 113 if(td == td_index) { 81 114 add_width = width - tr->children[e]->properties->width; 82 } else { 115 } 116 td++; 117 } 118 } 119 td = 0; 120 for(e = 0 ; e < tr->children_count; e++) { 121 if(tr->children[e]->type == ELEM_TD) { 122 if(td == td_index) { 123 124 } else if(td > td_index){ 125 tr->children[e]->properties->width = width; 83 126 gaycko_add_node_x(tr->children[e], add_width); 84 127 } … … 86 129 } 87 130 } 131 132 88 133 } 134 -
gaycko/trunk/tests/table.html
r4759 r4762 4 4 Du texte<br/> 5 5 <table width=50%> 6 <tr><td> Cell1 </td><td> Cell2</td>< /tr>7 <tr><td> Cell 3 plus grande</td><td> Cell4</td></tr>6 <tr><td> Cell1 </td><td> Cell2</td><td>Cell3 large</td></tr> 7 <tr><td> Cell4 wide too</td><td> Cell5</td><td>Cell6</td></tr> 8 8 </table> 9 9 </body>
Note: See TracChangeset
for help on using the changeset viewer.
