1 /* derived from PR optimization/11440 */
2
3 extern void abort (void);
4 extern void exit (int);
5
6 typedef _Bool bool;
7 const bool false = 0;
8 const bool true = 1;
9
10 enum EPosition
11 {
12 STATIC, RELATIVE, ABSOLUTE, FIXED
13 };
14 typedef enum EPosition EPosition;
15
16 enum EFloat
17 {
18 FNONE = 0, FLEFT, FRIGHT
19 };
20 typedef enum EFloat EFloat;
21
22 struct RenderBox
23 {
24 int unused[6];
25 short m_verticalPosition;
26
27 bool m_layouted : 1;
28 bool m_unused : 1;
29 bool m_minMaxKnown : 1;
30 bool m_floating : 1;
31
32 bool m_positioned : 1;
33 bool m_overhangingContents : 1;
34 bool m_relPositioned : 1;
35 bool m_paintSpecial : 1;
36
37 bool m_isAnonymous : 1;
38 bool m_recalcMinMax : 1;
39 bool m_isText : 1;
40 bool m_inline : 1;
41
42 bool m_replaced : 1;
43 bool m_mouseInside : 1;
44 bool m_hasFirstLine : 1;
45 bool m_isSelectionBorder : 1;
46
47 bool (*isTableCell) (struct RenderBox *this);
48 };
49
50 typedef struct RenderBox RenderBox;
51
52 struct RenderStyle
53 {
54 struct NonInheritedFlags
55 {
56 union
57 {
58 struct
59 {
60 unsigned int _display : 4;
61 unsigned int _bg_repeat : 2;
62 bool _bg_attachment : 1;
63 unsigned int _overflow : 4 ;
64 unsigned int _vertical_align : 4;
65 unsigned int _clear : 2;
66 EPosition _position : 2;
67 EFloat _floating : 2;
68 unsigned int _table_layout : 1;
69 bool _flowAroundFloats :1;
70
71 unsigned int _styleType : 3;
72 bool _hasHover : 1;
73 bool _hasActive : 1;
74 bool _clipSpecified : 1;
75 unsigned int _unicodeBidi : 2;
76 int _unused : 1;
77 } f;
78 int _niflags;
79 };
80 } noninherited_flags;
81 };
82
83 typedef struct RenderStyle RenderStyle;
84
85 extern void RenderObject_setStyle(RenderBox *this, RenderStyle *_style);
86 extern void removeFromSpecialObjects(RenderBox *this);
87
88
89
RenderBox_setStyle(RenderBox * thisin,RenderStyle * _style)90 void RenderBox_setStyle(RenderBox *thisin, RenderStyle *_style)
91 {
92 RenderBox *this = thisin;
93 bool oldpos, tmp;
94 EPosition tmppo;
95
96 tmp = this->m_positioned;
97
98 oldpos = tmp;
99
100 RenderObject_setStyle(this, _style);
101
102 tmppo = _style->noninherited_flags.f._position;
103
104 switch(tmppo)
105 {
106 case ABSOLUTE:
107 case FIXED:
108 {
109 bool ltrue = true;
110 this->m_positioned = ltrue;
111 break;
112 }
113
114 default:
115 {
116 EFloat tmpf;
117 EPosition tmpp;
118 if (oldpos)
119 {
120 bool ltrue = true;
121 this->m_positioned = ltrue;
122 removeFromSpecialObjects(this);
123 }
124 {
125 bool lfalse = false;
126 this->m_positioned = lfalse;
127 }
128
129 tmpf = _style->noninherited_flags.f._floating;
130
131 if(!this->isTableCell (this) && !(tmpf == FNONE))
132 {
133 bool ltrue = true;
134 this->m_floating = ltrue;
135 }
136 else
137 {
138 tmpp = _style->noninherited_flags.f._position;
139 if (tmpp == RELATIVE)
140 {
141 bool ltrue = true;
142 this->m_relPositioned = ltrue;
143 }
144 }
145 }
146 }
147 }
148
149
150
151
152 RenderBox g_this;
153 RenderStyle g__style;
154
RenderObject_setStyle(RenderBox * this,RenderStyle * _style)155 void RenderObject_setStyle(RenderBox *this, RenderStyle *_style)
156 {
157 (void) this;
158 (void) _style;
159 }
160
removeFromSpecialObjects(RenderBox * this)161 void removeFromSpecialObjects(RenderBox *this)
162 {
163 (void) this;
164 }
165
RenderBox_isTableCell(RenderBox * this)166 bool RenderBox_isTableCell (RenderBox *this)
167 {
168 (void) this;
169 return false;
170 }
171
main(void)172 int main (void)
173 {
174
175 g_this.m_relPositioned = false;
176 g_this.m_positioned = false;
177 g_this.m_floating = false;
178 g_this.isTableCell = RenderBox_isTableCell;
179
180 g__style.noninherited_flags.f._position = FIXED;
181 g__style.noninherited_flags.f._floating = FNONE;
182
183 RenderBox_setStyle (&g_this, &g__style);
184
185 if (g_this.m_positioned != true)
186 abort ();
187 if (g_this.m_relPositioned != false)
188 abort ();
189 if (g_this.m_floating != false)
190 abort ();
191
192 exit (0);
193 }
194