Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/text/qcssparser.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||
10 | using namespace QCss; | - | ||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||
12 | struct QCssKnownValue | - | ||||||||||||||||||||||||
13 | { | - | ||||||||||||||||||||||||
14 | const char name[28]; | - | ||||||||||||||||||||||||
15 | quint64 id; | - | ||||||||||||||||||||||||
16 | }; | - | ||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | static const QCssKnownValue properties[NumProperties - 1] = { | - | ||||||||||||||||||||||||
19 | { "-qt-background-role", QtBackgroundRole }, | - | ||||||||||||||||||||||||
20 | { "-qt-block-indent", QtBlockIndent }, | - | ||||||||||||||||||||||||
21 | { "-qt-line-height-type", QtLineHeightType }, | - | ||||||||||||||||||||||||
22 | { "-qt-list-indent", QtListIndent }, | - | ||||||||||||||||||||||||
23 | { "-qt-list-number-prefix", QtListNumberPrefix }, | - | ||||||||||||||||||||||||
24 | { "-qt-list-number-suffix", QtListNumberSuffix }, | - | ||||||||||||||||||||||||
25 | { "-qt-paragraph-type", QtParagraphType }, | - | ||||||||||||||||||||||||
26 | { "-qt-style-features", QtStyleFeatures }, | - | ||||||||||||||||||||||||
27 | { "-qt-table-type", QtTableType }, | - | ||||||||||||||||||||||||
28 | { "-qt-user-state", QtUserState }, | - | ||||||||||||||||||||||||
29 | { "alternate-background-color", QtAlternateBackground }, | - | ||||||||||||||||||||||||
30 | { "background", Background }, | - | ||||||||||||||||||||||||
31 | { "background-attachment", BackgroundAttachment }, | - | ||||||||||||||||||||||||
32 | { "background-clip", BackgroundClip }, | - | ||||||||||||||||||||||||
33 | { "background-color", BackgroundColor }, | - | ||||||||||||||||||||||||
34 | { "background-image", BackgroundImage }, | - | ||||||||||||||||||||||||
35 | { "background-origin", BackgroundOrigin }, | - | ||||||||||||||||||||||||
36 | { "background-position", BackgroundPosition }, | - | ||||||||||||||||||||||||
37 | { "background-repeat", BackgroundRepeat }, | - | ||||||||||||||||||||||||
38 | { "border", Border }, | - | ||||||||||||||||||||||||
39 | { "border-bottom", BorderBottom }, | - | ||||||||||||||||||||||||
40 | { "border-bottom-color", BorderBottomColor }, | - | ||||||||||||||||||||||||
41 | { "border-bottom-left-radius", BorderBottomLeftRadius }, | - | ||||||||||||||||||||||||
42 | { "border-bottom-right-radius", BorderBottomRightRadius }, | - | ||||||||||||||||||||||||
43 | { "border-bottom-style", BorderBottomStyle }, | - | ||||||||||||||||||||||||
44 | { "border-bottom-width", BorderBottomWidth }, | - | ||||||||||||||||||||||||
45 | { "border-color", BorderColor }, | - | ||||||||||||||||||||||||
46 | { "border-image", BorderImage }, | - | ||||||||||||||||||||||||
47 | { "border-left", BorderLeft }, | - | ||||||||||||||||||||||||
48 | { "border-left-color", BorderLeftColor }, | - | ||||||||||||||||||||||||
49 | { "border-left-style", BorderLeftStyle }, | - | ||||||||||||||||||||||||
50 | { "border-left-width", BorderLeftWidth }, | - | ||||||||||||||||||||||||
51 | { "border-radius", BorderRadius }, | - | ||||||||||||||||||||||||
52 | { "border-right", BorderRight }, | - | ||||||||||||||||||||||||
53 | { "border-right-color", BorderRightColor }, | - | ||||||||||||||||||||||||
54 | { "border-right-style", BorderRightStyle }, | - | ||||||||||||||||||||||||
55 | { "border-right-width", BorderRightWidth }, | - | ||||||||||||||||||||||||
56 | { "border-style", BorderStyles }, | - | ||||||||||||||||||||||||
57 | { "border-top", BorderTop }, | - | ||||||||||||||||||||||||
58 | { "border-top-color", BorderTopColor }, | - | ||||||||||||||||||||||||
59 | { "border-top-left-radius", BorderTopLeftRadius }, | - | ||||||||||||||||||||||||
60 | { "border-top-right-radius", BorderTopRightRadius }, | - | ||||||||||||||||||||||||
61 | { "border-top-style", BorderTopStyle }, | - | ||||||||||||||||||||||||
62 | { "border-top-width", BorderTopWidth }, | - | ||||||||||||||||||||||||
63 | { "border-width", BorderWidth }, | - | ||||||||||||||||||||||||
64 | { "bottom", Bottom }, | - | ||||||||||||||||||||||||
65 | { "color", Color }, | - | ||||||||||||||||||||||||
66 | { "float", Float }, | - | ||||||||||||||||||||||||
67 | { "font", Font }, | - | ||||||||||||||||||||||||
68 | { "font-family", FontFamily }, | - | ||||||||||||||||||||||||
69 | { "font-size", FontSize }, | - | ||||||||||||||||||||||||
70 | { "font-style", FontStyle }, | - | ||||||||||||||||||||||||
71 | { "font-variant", FontVariant }, | - | ||||||||||||||||||||||||
72 | { "font-weight", FontWeight }, | - | ||||||||||||||||||||||||
73 | { "height", Height }, | - | ||||||||||||||||||||||||
74 | { "image", QtImage }, | - | ||||||||||||||||||||||||
75 | { "image-position", QtImageAlignment }, | - | ||||||||||||||||||||||||
76 | { "left", Left }, | - | ||||||||||||||||||||||||
77 | { "line-height", LineHeight }, | - | ||||||||||||||||||||||||
78 | { "list-style", ListStyle }, | - | ||||||||||||||||||||||||
79 | { "list-style-type", ListStyleType }, | - | ||||||||||||||||||||||||
80 | { "margin" , Margin }, | - | ||||||||||||||||||||||||
81 | { "margin-bottom", MarginBottom }, | - | ||||||||||||||||||||||||
82 | { "margin-left", MarginLeft }, | - | ||||||||||||||||||||||||
83 | { "margin-right", MarginRight }, | - | ||||||||||||||||||||||||
84 | { "margin-top", MarginTop }, | - | ||||||||||||||||||||||||
85 | { "max-height", MaximumHeight }, | - | ||||||||||||||||||||||||
86 | { "max-width", MaximumWidth }, | - | ||||||||||||||||||||||||
87 | { "min-height", MinimumHeight }, | - | ||||||||||||||||||||||||
88 | { "min-width", MinimumWidth }, | - | ||||||||||||||||||||||||
89 | { "outline", Outline }, | - | ||||||||||||||||||||||||
90 | { "outline-bottom-left-radius", OutlineBottomLeftRadius }, | - | ||||||||||||||||||||||||
91 | { "outline-bottom-right-radius", OutlineBottomRightRadius }, | - | ||||||||||||||||||||||||
92 | { "outline-color", OutlineColor }, | - | ||||||||||||||||||||||||
93 | { "outline-offset", OutlineOffset }, | - | ||||||||||||||||||||||||
94 | { "outline-radius", OutlineRadius }, | - | ||||||||||||||||||||||||
95 | { "outline-style", OutlineStyle }, | - | ||||||||||||||||||||||||
96 | { "outline-top-left-radius", OutlineTopLeftRadius }, | - | ||||||||||||||||||||||||
97 | { "outline-top-right-radius", OutlineTopRightRadius }, | - | ||||||||||||||||||||||||
98 | { "outline-width", OutlineWidth }, | - | ||||||||||||||||||||||||
99 | { "padding", Padding }, | - | ||||||||||||||||||||||||
100 | { "padding-bottom", PaddingBottom }, | - | ||||||||||||||||||||||||
101 | { "padding-left", PaddingLeft }, | - | ||||||||||||||||||||||||
102 | { "padding-right", PaddingRight }, | - | ||||||||||||||||||||||||
103 | { "padding-top", PaddingTop }, | - | ||||||||||||||||||||||||
104 | { "page-break-after", PageBreakAfter }, | - | ||||||||||||||||||||||||
105 | { "page-break-before", PageBreakBefore }, | - | ||||||||||||||||||||||||
106 | { "position", Position }, | - | ||||||||||||||||||||||||
107 | { "right", Right }, | - | ||||||||||||||||||||||||
108 | { "selection-background-color", QtSelectionBackground }, | - | ||||||||||||||||||||||||
109 | { "selection-color", QtSelectionForeground }, | - | ||||||||||||||||||||||||
110 | { "spacing", QtSpacing }, | - | ||||||||||||||||||||||||
111 | { "subcontrol-origin", QtOrigin }, | - | ||||||||||||||||||||||||
112 | { "subcontrol-position", QtPosition }, | - | ||||||||||||||||||||||||
113 | { "text-align", TextAlignment }, | - | ||||||||||||||||||||||||
114 | { "text-decoration", TextDecoration }, | - | ||||||||||||||||||||||||
115 | { "text-indent", TextIndent }, | - | ||||||||||||||||||||||||
116 | { "text-transform", TextTransform }, | - | ||||||||||||||||||||||||
117 | { "text-underline-style", TextUnderlineStyle }, | - | ||||||||||||||||||||||||
118 | { "top", Top }, | - | ||||||||||||||||||||||||
119 | { "vertical-align", VerticalAlignment }, | - | ||||||||||||||||||||||||
120 | { "white-space", Whitespace }, | - | ||||||||||||||||||||||||
121 | { "width", Width } | - | ||||||||||||||||||||||||
122 | }; | - | ||||||||||||||||||||||||
123 | - | |||||||||||||||||||||||||
124 | static const QCssKnownValue values[NumKnownValues - 1] = { | - | ||||||||||||||||||||||||
125 | { "active", Value_Active }, | - | ||||||||||||||||||||||||
126 | { "alternate-base", Value_AlternateBase }, | - | ||||||||||||||||||||||||
127 | { "always", Value_Always }, | - | ||||||||||||||||||||||||
128 | { "auto", Value_Auto }, | - | ||||||||||||||||||||||||
129 | { "base", Value_Base }, | - | ||||||||||||||||||||||||
130 | { "bold", Value_Bold }, | - | ||||||||||||||||||||||||
131 | { "bottom", Value_Bottom }, | - | ||||||||||||||||||||||||
132 | { "bright-text", Value_BrightText }, | - | ||||||||||||||||||||||||
133 | { "button", Value_Button }, | - | ||||||||||||||||||||||||
134 | { "button-text", Value_ButtonText }, | - | ||||||||||||||||||||||||
135 | { "center", Value_Center }, | - | ||||||||||||||||||||||||
136 | { "circle", Value_Circle }, | - | ||||||||||||||||||||||||
137 | { "dark", Value_Dark }, | - | ||||||||||||||||||||||||
138 | { "dashed", Value_Dashed }, | - | ||||||||||||||||||||||||
139 | { "decimal", Value_Decimal }, | - | ||||||||||||||||||||||||
140 | { "disabled", Value_Disabled }, | - | ||||||||||||||||||||||||
141 | { "disc", Value_Disc }, | - | ||||||||||||||||||||||||
142 | { "dot-dash", Value_DotDash }, | - | ||||||||||||||||||||||||
143 | { "dot-dot-dash", Value_DotDotDash }, | - | ||||||||||||||||||||||||
144 | { "dotted", Value_Dotted }, | - | ||||||||||||||||||||||||
145 | { "double", Value_Double }, | - | ||||||||||||||||||||||||
146 | { "groove", Value_Groove }, | - | ||||||||||||||||||||||||
147 | { "highlight", Value_Highlight }, | - | ||||||||||||||||||||||||
148 | { "highlighted-text", Value_HighlightedText }, | - | ||||||||||||||||||||||||
149 | { "inset", Value_Inset }, | - | ||||||||||||||||||||||||
150 | { "italic", Value_Italic }, | - | ||||||||||||||||||||||||
151 | { "large", Value_Large }, | - | ||||||||||||||||||||||||
152 | { "left", Value_Left }, | - | ||||||||||||||||||||||||
153 | { "light", Value_Light }, | - | ||||||||||||||||||||||||
154 | { "line-through", Value_LineThrough }, | - | ||||||||||||||||||||||||
155 | { "link", Value_Link }, | - | ||||||||||||||||||||||||
156 | { "link-visited", Value_LinkVisited }, | - | ||||||||||||||||||||||||
157 | { "lower-alpha", Value_LowerAlpha }, | - | ||||||||||||||||||||||||
158 | { "lower-roman", Value_LowerRoman }, | - | ||||||||||||||||||||||||
159 | { "lowercase", Value_Lowercase }, | - | ||||||||||||||||||||||||
160 | { "medium", Value_Medium }, | - | ||||||||||||||||||||||||
161 | { "mid", Value_Mid }, | - | ||||||||||||||||||||||||
162 | { "middle", Value_Middle }, | - | ||||||||||||||||||||||||
163 | { "midlight", Value_Midlight }, | - | ||||||||||||||||||||||||
164 | { "native", Value_Native }, | - | ||||||||||||||||||||||||
165 | { "none", Value_None }, | - | ||||||||||||||||||||||||
166 | { "normal", Value_Normal }, | - | ||||||||||||||||||||||||
167 | { "nowrap", Value_NoWrap }, | - | ||||||||||||||||||||||||
168 | { "oblique", Value_Oblique }, | - | ||||||||||||||||||||||||
169 | { "off", Value_Off }, | - | ||||||||||||||||||||||||
170 | { "on", Value_On }, | - | ||||||||||||||||||||||||
171 | { "outset", Value_Outset }, | - | ||||||||||||||||||||||||
172 | { "overline", Value_Overline }, | - | ||||||||||||||||||||||||
173 | { "pre", Value_Pre }, | - | ||||||||||||||||||||||||
174 | { "pre-wrap", Value_PreWrap }, | - | ||||||||||||||||||||||||
175 | { "ridge", Value_Ridge }, | - | ||||||||||||||||||||||||
176 | { "right", Value_Right }, | - | ||||||||||||||||||||||||
177 | { "selected", Value_Selected }, | - | ||||||||||||||||||||||||
178 | { "shadow", Value_Shadow }, | - | ||||||||||||||||||||||||
179 | { "small" , Value_Small }, | - | ||||||||||||||||||||||||
180 | { "small-caps", Value_SmallCaps }, | - | ||||||||||||||||||||||||
181 | { "solid", Value_Solid }, | - | ||||||||||||||||||||||||
182 | { "square", Value_Square }, | - | ||||||||||||||||||||||||
183 | { "sub", Value_Sub }, | - | ||||||||||||||||||||||||
184 | { "super", Value_Super }, | - | ||||||||||||||||||||||||
185 | { "text", Value_Text }, | - | ||||||||||||||||||||||||
186 | { "top", Value_Top }, | - | ||||||||||||||||||||||||
187 | { "transparent", Value_Transparent }, | - | ||||||||||||||||||||||||
188 | { "underline", Value_Underline }, | - | ||||||||||||||||||||||||
189 | { "upper-alpha", Value_UpperAlpha }, | - | ||||||||||||||||||||||||
190 | { "upper-roman", Value_UpperRoman }, | - | ||||||||||||||||||||||||
191 | { "uppercase", Value_Uppercase }, | - | ||||||||||||||||||||||||
192 | { "wave", Value_Wave }, | - | ||||||||||||||||||||||||
193 | { "window", Value_Window }, | - | ||||||||||||||||||||||||
194 | { "window-text", Value_WindowText }, | - | ||||||||||||||||||||||||
195 | { "x-large", Value_XLarge }, | - | ||||||||||||||||||||||||
196 | { "xx-large", Value_XXLarge } | - | ||||||||||||||||||||||||
197 | }; | - | ||||||||||||||||||||||||
198 | - | |||||||||||||||||||||||||
199 | - | |||||||||||||||||||||||||
200 | static const short indexOfId[NumKnownValues] = { 0, 41, 48, 42, 49, 54, 35, 26, 70, 71, 25, 43, 5, 63, 47, | - | ||||||||||||||||||||||||
201 | 29, 58, 59, 27, 51, 61, 6, 10, 39, 56, 19, 13, 17, 18, 20, 21, 50, 24, 46, 67, 37, 3, 2, 40, 62, 16, | - | ||||||||||||||||||||||||
202 | 11, 57, 14, 32, 64, 33, 65, 55, 66, 34, 69, 8, 28, 38, 12, 36, 60, 7, 9, 4, 68, 53, 22, 23, 30, 31, | - | ||||||||||||||||||||||||
203 | 1, 15, 0, 52, 45, 44 }; | - | ||||||||||||||||||||||||
204 | - | |||||||||||||||||||||||||
205 | QString Value::toString() const | - | ||||||||||||||||||||||||
206 | { | - | ||||||||||||||||||||||||
207 | if (type == KnownIdentifier
| 0 | ||||||||||||||||||||||||
208 | return never executed: QLatin1String(values[indexOfId[variant.toInt()]].name);return QLatin1String(values[indexOfId[variant.toInt()]].name); never executed: return QLatin1String(values[indexOfId[variant.toInt()]].name); | 0 | ||||||||||||||||||||||||
209 | } else { | - | ||||||||||||||||||||||||
210 | return never executed: variant.toString();return variant.toString(); never executed: return variant.toString(); | 0 | ||||||||||||||||||||||||
211 | } | - | ||||||||||||||||||||||||
212 | } | - | ||||||||||||||||||||||||
213 | - | |||||||||||||||||||||||||
214 | static const QCssKnownValue pseudos[NumPseudos - 1] = { | - | ||||||||||||||||||||||||
215 | { "active", PseudoClass_Active }, | - | ||||||||||||||||||||||||
216 | { "adjoins-item", PseudoClass_Item }, | - | ||||||||||||||||||||||||
217 | { "alternate", PseudoClass_Alternate }, | - | ||||||||||||||||||||||||
218 | { "bottom", PseudoClass_Bottom }, | - | ||||||||||||||||||||||||
219 | { "checked", PseudoClass_Checked }, | - | ||||||||||||||||||||||||
220 | { "closable", PseudoClass_Closable }, | - | ||||||||||||||||||||||||
221 | { "closed", PseudoClass_Closed }, | - | ||||||||||||||||||||||||
222 | { "default", PseudoClass_Default }, | - | ||||||||||||||||||||||||
223 | { "disabled", PseudoClass_Disabled }, | - | ||||||||||||||||||||||||
224 | { "edit-focus", PseudoClass_EditFocus }, | - | ||||||||||||||||||||||||
225 | { "editable", PseudoClass_Editable }, | - | ||||||||||||||||||||||||
226 | { "enabled", PseudoClass_Enabled }, | - | ||||||||||||||||||||||||
227 | { "exclusive", PseudoClass_Exclusive }, | - | ||||||||||||||||||||||||
228 | { "first", PseudoClass_First }, | - | ||||||||||||||||||||||||
229 | { "flat", PseudoClass_Flat }, | - | ||||||||||||||||||||||||
230 | { "floatable", PseudoClass_Floatable }, | - | ||||||||||||||||||||||||
231 | { "focus", PseudoClass_Focus }, | - | ||||||||||||||||||||||||
232 | { "has-children", PseudoClass_Children }, | - | ||||||||||||||||||||||||
233 | { "has-siblings", PseudoClass_Sibling }, | - | ||||||||||||||||||||||||
234 | { "horizontal", PseudoClass_Horizontal }, | - | ||||||||||||||||||||||||
235 | { "hover", PseudoClass_Hover }, | - | ||||||||||||||||||||||||
236 | { "indeterminate" , PseudoClass_Indeterminate }, | - | ||||||||||||||||||||||||
237 | { "last", PseudoClass_Last }, | - | ||||||||||||||||||||||||
238 | { "left", PseudoClass_Left }, | - | ||||||||||||||||||||||||
239 | { "maximized", PseudoClass_Maximized }, | - | ||||||||||||||||||||||||
240 | { "middle", PseudoClass_Middle }, | - | ||||||||||||||||||||||||
241 | { "minimized", PseudoClass_Minimized }, | - | ||||||||||||||||||||||||
242 | { "movable", PseudoClass_Movable }, | - | ||||||||||||||||||||||||
243 | { "next-selected", PseudoClass_NextSelected }, | - | ||||||||||||||||||||||||
244 | { "no-frame", PseudoClass_Frameless }, | - | ||||||||||||||||||||||||
245 | { "non-exclusive", PseudoClass_NonExclusive }, | - | ||||||||||||||||||||||||
246 | { "off", PseudoClass_Unchecked }, | - | ||||||||||||||||||||||||
247 | { "on", PseudoClass_Checked }, | - | ||||||||||||||||||||||||
248 | { "only-one", PseudoClass_OnlyOne }, | - | ||||||||||||||||||||||||
249 | { "open", PseudoClass_Open }, | - | ||||||||||||||||||||||||
250 | { "pressed", PseudoClass_Pressed }, | - | ||||||||||||||||||||||||
251 | { "previous-selected", PseudoClass_PreviousSelected }, | - | ||||||||||||||||||||||||
252 | { "read-only", PseudoClass_ReadOnly }, | - | ||||||||||||||||||||||||
253 | { "right", PseudoClass_Right }, | - | ||||||||||||||||||||||||
254 | { "selected", PseudoClass_Selected }, | - | ||||||||||||||||||||||||
255 | { "top", PseudoClass_Top }, | - | ||||||||||||||||||||||||
256 | { "unchecked" , PseudoClass_Unchecked }, | - | ||||||||||||||||||||||||
257 | { "vertical", PseudoClass_Vertical }, | - | ||||||||||||||||||||||||
258 | { "window", PseudoClass_Window } | - | ||||||||||||||||||||||||
259 | }; | - | ||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||
261 | static const QCssKnownValue origins[NumKnownOrigins - 1] = { | - | ||||||||||||||||||||||||
262 | { "border", Origin_Border }, | - | ||||||||||||||||||||||||
263 | { "content", Origin_Content }, | - | ||||||||||||||||||||||||
264 | { "margin", Origin_Margin }, | - | ||||||||||||||||||||||||
265 | { "padding", Origin_Padding } | - | ||||||||||||||||||||||||
266 | }; | - | ||||||||||||||||||||||||
267 | - | |||||||||||||||||||||||||
268 | static const QCssKnownValue repeats[NumKnownRepeats - 1] = { | - | ||||||||||||||||||||||||
269 | { "no-repeat", Repeat_None }, | - | ||||||||||||||||||||||||
270 | { "repeat-x", Repeat_X }, | - | ||||||||||||||||||||||||
271 | { "repeat-xy", Repeat_XY }, | - | ||||||||||||||||||||||||
272 | { "repeat-y", Repeat_Y } | - | ||||||||||||||||||||||||
273 | }; | - | ||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||
275 | static const QCssKnownValue tileModes[NumKnownTileModes - 1] = { | - | ||||||||||||||||||||||||
276 | { "repeat", TileMode_Repeat }, | - | ||||||||||||||||||||||||
277 | { "round", TileMode_Round }, | - | ||||||||||||||||||||||||
278 | { "stretch", TileMode_Stretch }, | - | ||||||||||||||||||||||||
279 | }; | - | ||||||||||||||||||||||||
280 | - | |||||||||||||||||||||||||
281 | static const QCssKnownValue positions[NumKnownPositionModes - 1] = { | - | ||||||||||||||||||||||||
282 | { "absolute", PositionMode_Absolute }, | - | ||||||||||||||||||||||||
283 | { "fixed", PositionMode_Fixed }, | - | ||||||||||||||||||||||||
284 | { "relative", PositionMode_Relative }, | - | ||||||||||||||||||||||||
285 | { "static", PositionMode_Static } | - | ||||||||||||||||||||||||
286 | }; | - | ||||||||||||||||||||||||
287 | - | |||||||||||||||||||||||||
288 | static const QCssKnownValue attachments[NumKnownAttachments - 1] = { | - | ||||||||||||||||||||||||
289 | { "fixed", Attachment_Fixed }, | - | ||||||||||||||||||||||||
290 | { "scroll", Attachment_Scroll } | - | ||||||||||||||||||||||||
291 | }; | - | ||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||
293 | static const QCssKnownValue styleFeatures[NumKnownStyleFeatures - 1] = { | - | ||||||||||||||||||||||||
294 | { "background-color", StyleFeature_BackgroundColor }, | - | ||||||||||||||||||||||||
295 | { "background-gradient", StyleFeature_BackgroundGradient }, | - | ||||||||||||||||||||||||
296 | { "none", StyleFeature_None } | - | ||||||||||||||||||||||||
297 | }; | - | ||||||||||||||||||||||||
298 | static bool operator<(const QString &name, const QCssKnownValue &prop) | - | ||||||||||||||||||||||||
299 | { | - | ||||||||||||||||||||||||
300 | return never executed: QString::compare(name, QLatin1String(prop.name), Qt::CaseInsensitive) < 0;return QString::compare(name, QLatin1String(prop.name), Qt::CaseInsensitive) < 0; never executed: return QString::compare(name, QLatin1String(prop.name), Qt::CaseInsensitive) < 0; | 0 | ||||||||||||||||||||||||
301 | } | - | ||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||
303 | static bool operator<(const QCssKnownValue &prop, const QString &name) | - | ||||||||||||||||||||||||
304 | { | - | ||||||||||||||||||||||||
305 | return never executed: QString::compare(QLatin1String(prop.name), name, Qt::CaseInsensitive) < 0;return QString::compare(QLatin1String(prop.name), name, Qt::CaseInsensitive) < 0; never executed: return QString::compare(QLatin1String(prop.name), name, Qt::CaseInsensitive) < 0; | 0 | ||||||||||||||||||||||||
306 | } | - | ||||||||||||||||||||||||
307 | - | |||||||||||||||||||||||||
308 | static quint64 findKnownValue(const QString &name, const QCssKnownValue *start, int numValues) | - | ||||||||||||||||||||||||
309 | { | - | ||||||||||||||||||||||||
310 | const QCssKnownValue *end = &start[numValues - 1]; | - | ||||||||||||||||||||||||
311 | const QCssKnownValue *prop = std::lower_bound(start, end, name); | - | ||||||||||||||||||||||||
312 | if ((
| 0 | ||||||||||||||||||||||||
313 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
314 | return never executed: prop->id;return prop->id; never executed: return prop->id; | 0 | ||||||||||||||||||||||||
315 | } | - | ||||||||||||||||||||||||
316 | - | |||||||||||||||||||||||||
317 | static inline bool isInheritable(Property propertyId) | - | ||||||||||||||||||||||||
318 | { | - | ||||||||||||||||||||||||
319 | switch (propertyId) { | - | ||||||||||||||||||||||||
320 | case never executed: Font:case Font: never executed: case Font: | 0 | ||||||||||||||||||||||||
321 | case never executed: FontFamily:case FontFamily: never executed: case FontFamily: | 0 | ||||||||||||||||||||||||
322 | case never executed: FontSize:case FontSize: never executed: case FontSize: | 0 | ||||||||||||||||||||||||
323 | case never executed: FontStyle:case FontStyle: never executed: case FontStyle: | 0 | ||||||||||||||||||||||||
324 | case never executed: FontWeight:case FontWeight: never executed: case FontWeight: | 0 | ||||||||||||||||||||||||
325 | case never executed: TextIndent:case TextIndent: never executed: case TextIndent: | 0 | ||||||||||||||||||||||||
326 | case never executed: Whitespace:case Whitespace: never executed: case Whitespace: | 0 | ||||||||||||||||||||||||
327 | case never executed: ListStyleType:case ListStyleType: never executed: case ListStyleType: | 0 | ||||||||||||||||||||||||
328 | case never executed: ListStyle:case ListStyle: never executed: case ListStyle: | 0 | ||||||||||||||||||||||||
329 | case never executed: TextAlignment:case TextAlignment: never executed: case TextAlignment: | 0 | ||||||||||||||||||||||||
330 | case never executed: FontVariant:case FontVariant: never executed: case FontVariant: | 0 | ||||||||||||||||||||||||
331 | case never executed: TextTransform:case TextTransform: never executed: case TextTransform: | 0 | ||||||||||||||||||||||||
332 | case never executed: LineHeight:case LineHeight: never executed: case LineHeight: | 0 | ||||||||||||||||||||||||
333 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
334 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
335 | break; never executed: break; | 0 | ||||||||||||||||||||||||
336 | } | - | ||||||||||||||||||||||||
337 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
338 | } | - | ||||||||||||||||||||||||
339 | - | |||||||||||||||||||||||||
340 | - | |||||||||||||||||||||||||
341 | - | |||||||||||||||||||||||||
342 | ValueExtractor::ValueExtractor(const QVector<Declaration> &decls, const QPalette &pal) | - | ||||||||||||||||||||||||
343 | : declarations(decls), adjustment(0), fontExtracted(false), pal(pal) | - | ||||||||||||||||||||||||
344 | { | - | ||||||||||||||||||||||||
345 | } never executed: end of block | 0 | ||||||||||||||||||||||||
346 | - | |||||||||||||||||||||||||
347 | LengthData ValueExtractor::lengthValue(const Value& v) | - | ||||||||||||||||||||||||
348 | { | - | ||||||||||||||||||||||||
349 | QString s = v.variant.toString(); | - | ||||||||||||||||||||||||
350 | s.reserve(s.length()); | - | ||||||||||||||||||||||||
351 | LengthData data; | - | ||||||||||||||||||||||||
352 | data.unit = LengthData::None; | - | ||||||||||||||||||||||||
353 | if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)
| 0 | ||||||||||||||||||||||||
354 | data.unit = LengthData::Px; never executed: data.unit = LengthData::Px; | 0 | ||||||||||||||||||||||||
355 | else if (s.endsWith(QLatin1String("ex"), Qt::CaseInsensitive)
| 0 | ||||||||||||||||||||||||
356 | data.unit = LengthData::Ex; never executed: data.unit = LengthData::Ex; | 0 | ||||||||||||||||||||||||
357 | else if (s.endsWith(QLatin1String("em"), Qt::CaseInsensitive)
| 0 | ||||||||||||||||||||||||
358 | data.unit = LengthData::Em; never executed: data.unit = LengthData::Em; | 0 | ||||||||||||||||||||||||
359 | - | |||||||||||||||||||||||||
360 | if (data.unit != LengthData::None
| 0 | ||||||||||||||||||||||||
361 | s.chop(2); never executed: s.chop(2); | 0 | ||||||||||||||||||||||||
362 | - | |||||||||||||||||||||||||
363 | data.number = s.toDouble(); | - | ||||||||||||||||||||||||
364 | return never executed: data;return data; never executed: return data; | 0 | ||||||||||||||||||||||||
365 | } | - | ||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||
367 | static int lengthValueFromData(const LengthData& data, const QFont& f) | - | ||||||||||||||||||||||||
368 | { | - | ||||||||||||||||||||||||
369 | if (data.unit == LengthData::Ex
| 0 | ||||||||||||||||||||||||
370 | return never executed: qRound(QFontMetrics(f).xHeight() * data.number);return qRound(QFontMetrics(f).xHeight() * data.number); never executed: return qRound(QFontMetrics(f).xHeight() * data.number); | 0 | ||||||||||||||||||||||||
371 | else if (data.unit == LengthData::Em
| 0 | ||||||||||||||||||||||||
372 | return never executed: qRound(QFontMetrics(f).height() * data.number);return qRound(QFontMetrics(f).height() * data.number); never executed: return qRound(QFontMetrics(f).height() * data.number); | 0 | ||||||||||||||||||||||||
373 | return never executed: qRound(data.number);return qRound(data.number); never executed: return qRound(data.number); | 0 | ||||||||||||||||||||||||
374 | } | - | ||||||||||||||||||||||||
375 | - | |||||||||||||||||||||||||
376 | int ValueExtractor::lengthValue(const Declaration &decl) | - | ||||||||||||||||||||||||
377 | { | - | ||||||||||||||||||||||||
378 | if (decl.d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
379 | return never executed: lengthValueFromData(qvariant_cast<LengthData>(decl.d->parsed), f);return lengthValueFromData(qvariant_cast<LengthData>(decl.d->parsed), f); never executed: return lengthValueFromData(qvariant_cast<LengthData>(decl.d->parsed), f); | 0 | ||||||||||||||||||||||||
380 | if (decl.d->values.count() < 1
| 0 | ||||||||||||||||||||||||
381 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
382 | LengthData data = lengthValue(decl.d->values.at(0)); | - | ||||||||||||||||||||||||
383 | decl.d->parsed = QVariant::fromValue<LengthData>(data); | - | ||||||||||||||||||||||||
384 | return never executed: lengthValueFromData(data,f);return lengthValueFromData(data,f); never executed: return lengthValueFromData(data,f); | 0 | ||||||||||||||||||||||||
385 | } | - | ||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||
387 | void ValueExtractor::lengthValues(const Declaration &decl, int *m) | - | ||||||||||||||||||||||||
388 | { | - | ||||||||||||||||||||||||
389 | if (decl.d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
390 | QList<QVariant> v = decl.d->parsed.toList(); | - | ||||||||||||||||||||||||
391 | for (int i = 0; i < 4
| 0 | ||||||||||||||||||||||||
392 | m[i] = lengthValueFromData(qvariant_cast<LengthData>(v.at(i)), f); never executed: m[i] = lengthValueFromData(qvariant_cast<LengthData>(v.at(i)), f); | 0 | ||||||||||||||||||||||||
393 | return; never executed: return; | 0 | ||||||||||||||||||||||||
394 | } | - | ||||||||||||||||||||||||
395 | - | |||||||||||||||||||||||||
396 | LengthData datas[4]; | - | ||||||||||||||||||||||||
397 | int i; | - | ||||||||||||||||||||||||
398 | for (i = 0; i < qMin(decl.d->values.count(), 4)
| 0 | ||||||||||||||||||||||||
399 | datas[i] = lengthValue(decl.d->values[i]); never executed: datas[i] = lengthValue(decl.d->values[i]); | 0 | ||||||||||||||||||||||||
400 | - | |||||||||||||||||||||||||
401 | if (i == 0
| 0 | ||||||||||||||||||||||||
402 | LengthData zero = {0.0, LengthData::None}; | - | ||||||||||||||||||||||||
403 | datas[0] = datas[1] = datas[2] = datas[3] = zero; | - | ||||||||||||||||||||||||
404 | } never executed: else if (i == 1end of block
| 0 | ||||||||||||||||||||||||
405 | datas[3] = datas[2] = datas[1] = datas[0]; | - | ||||||||||||||||||||||||
406 | } never executed: else if (i == 2end of block
| 0 | ||||||||||||||||||||||||
407 | datas[2] = datas[0]; | - | ||||||||||||||||||||||||
408 | datas[3] = datas[1]; | - | ||||||||||||||||||||||||
409 | } never executed: else if (i == 3end of block
| 0 | ||||||||||||||||||||||||
410 | datas[3] = datas[1]; | - | ||||||||||||||||||||||||
411 | } never executed: end of block | 0 | ||||||||||||||||||||||||
412 | - | |||||||||||||||||||||||||
413 | QList<QVariant> v; | - | ||||||||||||||||||||||||
414 | v.reserve(4); | - | ||||||||||||||||||||||||
415 | for (i = 0; i < 4
| 0 | ||||||||||||||||||||||||
416 | v += QVariant::fromValue<LengthData>(datas[i]); | - | ||||||||||||||||||||||||
417 | m[i] = lengthValueFromData(datas[i], f); | - | ||||||||||||||||||||||||
418 | } never executed: end of block | 0 | ||||||||||||||||||||||||
419 | decl.d->parsed = v; | - | ||||||||||||||||||||||||
420 | } never executed: end of block | 0 | ||||||||||||||||||||||||
421 | - | |||||||||||||||||||||||||
422 | bool ValueExtractor::extractGeometry(int *w, int *h, int *minw, int *minh, int *maxw, int *maxh) | - | ||||||||||||||||||||||||
423 | { | - | ||||||||||||||||||||||||
424 | extractFont(); | - | ||||||||||||||||||||||||
425 | bool hit = false; | - | ||||||||||||||||||||||||
426 | for (int i = 0; i < declarations.count()
| 0 | ||||||||||||||||||||||||
427 | const Declaration &decl = declarations.at(i); | - | ||||||||||||||||||||||||
428 | switch (decl.d->propertyId) { | - | ||||||||||||||||||||||||
429 | case never executed: Width:case Width: never executed: *w = lengthValue(decl); break;case Width: never executed: break; | 0 | ||||||||||||||||||||||||
430 | case never executed: Height:case Height: never executed: *h = lengthValue(decl); break;case Height: never executed: break; | 0 | ||||||||||||||||||||||||
431 | case never executed: MinimumWidth:case MinimumWidth: never executed: *minw = lengthValue(decl); break;case MinimumWidth: never executed: break; | 0 | ||||||||||||||||||||||||
432 | case never executed: MinimumHeight:case MinimumHeight: never executed: *minh = lengthValue(decl); break;case MinimumHeight: never executed: break; | 0 | ||||||||||||||||||||||||
433 | case never executed: MaximumWidth:case MaximumWidth: never executed: *maxw = lengthValue(decl); break;case MaximumWidth: never executed: break; | 0 | ||||||||||||||||||||||||
434 | case never executed: MaximumHeight:case MaximumHeight: never executed: *maxh = lengthValue(decl); break;case MaximumHeight: never executed: break; | 0 | ||||||||||||||||||||||||
435 | default never executed: :default: never executed: continue;default: never executed: continue; | 0 | ||||||||||||||||||||||||
436 | } | - | ||||||||||||||||||||||||
437 | hit = true; | - | ||||||||||||||||||||||||
438 | } never executed: end of block | 0 | ||||||||||||||||||||||||
439 | - | |||||||||||||||||||||||||
440 | return never executed: hit;return hit; never executed: return hit; | 0 | ||||||||||||||||||||||||
441 | } | - | ||||||||||||||||||||||||
442 | - | |||||||||||||||||||||||||
443 | bool ValueExtractor::extractPosition(int *left, int *top, int *right, int *bottom, QCss::Origin *origin, | - | ||||||||||||||||||||||||
444 | Qt::Alignment *position, QCss::PositionMode *mode, Qt::Alignment *textAlignment) | - | ||||||||||||||||||||||||
445 | { | - | ||||||||||||||||||||||||
446 | extractFont(); | - | ||||||||||||||||||||||||
447 | bool hit = false; | - | ||||||||||||||||||||||||
448 | for (int i = 0; i < declarations.count()
| 0 | ||||||||||||||||||||||||
449 | const Declaration &decl = declarations.at(i); | - | ||||||||||||||||||||||||
450 | switch (decl.d->propertyId) { | - | ||||||||||||||||||||||||
451 | case never executed: Left:case Left: never executed: *left = lengthValue(decl); break;case Left: never executed: break; | 0 | ||||||||||||||||||||||||
452 | case never executed: Top:case Top: never executed: *top = lengthValue(decl); break;case Top: never executed: break; | 0 | ||||||||||||||||||||||||
453 | case never executed: Right:case Right: never executed: *right = lengthValue(decl); break;case Right: never executed: break; | 0 | ||||||||||||||||||||||||
454 | case never executed: Bottom:case Bottom: never executed: *bottom = lengthValue(decl); break;case Bottom: never executed: break; | 0 | ||||||||||||||||||||||||
455 | case never executed: QtOrigin:case QtOrigin: never executed: *origin = decl.originValue(); break;case QtOrigin: never executed: break; | 0 | ||||||||||||||||||||||||
456 | case never executed: QtPosition:case QtPosition: never executed: *position = decl.alignmentValue(); break;case QtPosition: never executed: break; | 0 | ||||||||||||||||||||||||
457 | case never executed: TextAlignment:case TextAlignment: never executed: *textAlignment = decl.alignmentValue(); break;case TextAlignment: never executed: break; | 0 | ||||||||||||||||||||||||
458 | case never executed: Position:case Position: never executed: *mode = decl.positionValue(); break;case Position: never executed: break; | 0 | ||||||||||||||||||||||||
459 | default never executed: :default: never executed: continue;default: never executed: continue; | 0 | ||||||||||||||||||||||||
460 | } | - | ||||||||||||||||||||||||
461 | hit = true; | - | ||||||||||||||||||||||||
462 | } never executed: end of block | 0 | ||||||||||||||||||||||||
463 | - | |||||||||||||||||||||||||
464 | return never executed: hit;return hit; never executed: return hit; | 0 | ||||||||||||||||||||||||
465 | } | - | ||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||
467 | bool ValueExtractor::extractBox(int *margins, int *paddings, int *spacing) | - | ||||||||||||||||||||||||
468 | { | - | ||||||||||||||||||||||||
469 | extractFont(); | - | ||||||||||||||||||||||||
470 | bool hit = false; | - | ||||||||||||||||||||||||
471 | for (int i = 0; i < declarations.count()
| 0 | ||||||||||||||||||||||||
472 | const Declaration &decl = declarations.at(i); | - | ||||||||||||||||||||||||
473 | switch (decl.d->propertyId) { | - | ||||||||||||||||||||||||
474 | case never executed: PaddingLeft:case PaddingLeft: never executed: paddings[LeftEdge] = lengthValue(decl); break;case PaddingLeft: never executed: break; | 0 | ||||||||||||||||||||||||
475 | case never executed: PaddingRight:case PaddingRight: never executed: paddings[RightEdge] = lengthValue(decl); break;case PaddingRight: never executed: break; | 0 | ||||||||||||||||||||||||
476 | case never executed: PaddingTop:case PaddingTop: never executed: paddings[TopEdge] = lengthValue(decl); break;case PaddingTop: never executed: break; | 0 | ||||||||||||||||||||||||
477 | case never executed: PaddingBottom:case PaddingBottom: never executed: paddings[BottomEdge] = lengthValue(decl); break;case PaddingBottom: never executed: break; | 0 | ||||||||||||||||||||||||
478 | case never executed: Padding:case Padding: never executed: lengthValues(decl, paddings); break;case Padding: never executed: break; | 0 | ||||||||||||||||||||||||
479 | - | |||||||||||||||||||||||||
480 | case never executed: MarginLeft:case MarginLeft: never executed: margins[LeftEdge] = lengthValue(decl); break;case MarginLeft: never executed: break; | 0 | ||||||||||||||||||||||||
481 | case never executed: MarginRight:case MarginRight: never executed: margins[RightEdge] = lengthValue(decl); break;case MarginRight: never executed: break; | 0 | ||||||||||||||||||||||||
482 | case never executed: MarginTop:case MarginTop: never executed: margins[TopEdge] = lengthValue(decl); break;case MarginTop: never executed: break; | 0 | ||||||||||||||||||||||||
483 | case never executed: MarginBottom:case MarginBottom: never executed: margins[BottomEdge] = lengthValue(decl); break;case MarginBottom: never executed: break; | 0 | ||||||||||||||||||||||||
484 | case never executed: Margin:case Margin: never executed: lengthValues(decl, margins); break;case Margin: never executed: break; | 0 | ||||||||||||||||||||||||
485 | case never executed: QtSpacing:case QtSpacing: never executed: if (spacingcase QtSpacing:
never executed: spacing = lengthValue(decl);*spacing = lengthValue(decl); never executed: break;*spacing = lengthValue(decl); never executed: break; | 0 | ||||||||||||||||||||||||
486 | - | |||||||||||||||||||||||||
487 | default never executed: :default: never executed: continue;default: never executed: continue; | 0 | ||||||||||||||||||||||||
488 | } | - | ||||||||||||||||||||||||
489 | hit = true; | - | ||||||||||||||||||||||||
490 | } never executed: end of block | 0 | ||||||||||||||||||||||||
491 | - | |||||||||||||||||||||||||
492 | return never executed: hit;return hit; never executed: return hit; | 0 | ||||||||||||||||||||||||
493 | } | - | ||||||||||||||||||||||||
494 | - | |||||||||||||||||||||||||
495 | int ValueExtractor::extractStyleFeatures() | - | ||||||||||||||||||||||||
496 | { | - | ||||||||||||||||||||||||
497 | int features = StyleFeature_None; | - | ||||||||||||||||||||||||
498 | for (int i = 0; i < declarations.count()
| 0 | ||||||||||||||||||||||||
499 | const Declaration &decl = declarations.at(i); | - | ||||||||||||||||||||||||
500 | if (decl.d->propertyId == QtStyleFeatures
| 0 | ||||||||||||||||||||||||
501 | features = decl.styleFeaturesValue(); never executed: features = decl.styleFeaturesValue(); | 0 | ||||||||||||||||||||||||
502 | } never executed: end of block | 0 | ||||||||||||||||||||||||
503 | return never executed: features;return features; never executed: return features; | 0 | ||||||||||||||||||||||||
504 | } | - | ||||||||||||||||||||||||
505 | - | |||||||||||||||||||||||||
506 | QSize ValueExtractor::sizeValue(const Declaration &decl) | - | ||||||||||||||||||||||||
507 | { | - | ||||||||||||||||||||||||
508 | if (decl.d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
509 | QList<QVariant> v = decl.d->parsed.toList(); | - | ||||||||||||||||||||||||
510 | return never executed: QSize(lengthValueFromData(qvariant_cast<LengthData>(v.at(0)), f),return QSize(lengthValueFromData(qvariant_cast<LengthData>(v.at(0)), f), lengthValueFromData(qvariant_cast<LengthData>(v.at(1)), f)); never executed: return QSize(lengthValueFromData(qvariant_cast<LengthData>(v.at(0)), f), lengthValueFromData(qvariant_cast<LengthData>(v.at(1)), f)); | 0 | ||||||||||||||||||||||||
511 | lengthValueFromData(qvariant_cast<LengthData>(v.at(1)), f)); never executed: return QSize(lengthValueFromData(qvariant_cast<LengthData>(v.at(0)), f), lengthValueFromData(qvariant_cast<LengthData>(v.at(1)), f)); | 0 | ||||||||||||||||||||||||
512 | } | - | ||||||||||||||||||||||||
513 | - | |||||||||||||||||||||||||
514 | LengthData x[2] = { {0, LengthData::None }, {0, LengthData::None} }; | - | ||||||||||||||||||||||||
515 | if (decl.d->values.count() > 0
| 0 | ||||||||||||||||||||||||
516 | x[0] = lengthValue(decl.d->values.at(0)); never executed: x[0] = lengthValue(decl.d->values.at(0)); | 0 | ||||||||||||||||||||||||
517 | if (decl.d->values.count() > 1
| 0 | ||||||||||||||||||||||||
518 | x[1] = lengthValue(decl.d->values.at(1)); never executed: x[1] = lengthValue(decl.d->values.at(1)); | 0 | ||||||||||||||||||||||||
519 | else | - | ||||||||||||||||||||||||
520 | x[1] = x[0]; never executed: x[1] = x[0]; | 0 | ||||||||||||||||||||||||
521 | QList<QVariant> v; | - | ||||||||||||||||||||||||
522 | v << QVariant::fromValue<LengthData>(x[0]) << QVariant::fromValue<LengthData>(x[1]); | - | ||||||||||||||||||||||||
523 | decl.d->parsed = v; | - | ||||||||||||||||||||||||
524 | return never executed: QSize(lengthValueFromData(x[0], f), lengthValueFromData(x[1], f));return QSize(lengthValueFromData(x[0], f), lengthValueFromData(x[1], f)); never executed: return QSize(lengthValueFromData(x[0], f), lengthValueFromData(x[1], f)); | 0 | ||||||||||||||||||||||||
525 | } | - | ||||||||||||||||||||||||
526 | - | |||||||||||||||||||||||||
527 | void ValueExtractor::sizeValues(const Declaration &decl, QSize *radii) | - | ||||||||||||||||||||||||
528 | { | - | ||||||||||||||||||||||||
529 | radii[0] = sizeValue(decl); | - | ||||||||||||||||||||||||
530 | for (int i = 1; i < 4
| 0 | ||||||||||||||||||||||||
531 | radii[i] = radii[0]; never executed: radii[i] = radii[0]; | 0 | ||||||||||||||||||||||||
532 | } never executed: end of block | 0 | ||||||||||||||||||||||||
533 | - | |||||||||||||||||||||||||
534 | bool ValueExtractor::extractBorder(int *borders, QBrush *colors, BorderStyle *styles, | - | ||||||||||||||||||||||||
535 | QSize *radii) | - | ||||||||||||||||||||||||
536 | { | - | ||||||||||||||||||||||||
537 | extractFont(); | - | ||||||||||||||||||||||||
538 | bool hit = false; | - | ||||||||||||||||||||||||
539 | for (int i = 0; i < declarations.count()
| 0 | ||||||||||||||||||||||||
540 | const Declaration &decl = declarations.at(i); | - | ||||||||||||||||||||||||
541 | switch (decl.d->propertyId) { | - | ||||||||||||||||||||||||
542 | case never executed: BorderLeftWidth:case BorderLeftWidth: never executed: borders[LeftEdge] = lengthValue(decl); break;case BorderLeftWidth: never executed: break; | 0 | ||||||||||||||||||||||||
543 | case never executed: BorderRightWidth:case BorderRightWidth: never executed: borders[RightEdge] = lengthValue(decl); break;case BorderRightWidth: never executed: break; | 0 | ||||||||||||||||||||||||
544 | case never executed: BorderTopWidth:case BorderTopWidth: never executed: borders[TopEdge] = lengthValue(decl); break;case BorderTopWidth: never executed: break; | 0 | ||||||||||||||||||||||||
545 | case never executed: BorderBottomWidth:case BorderBottomWidth: never executed: borders[BottomEdge] = lengthValue(decl); break;case BorderBottomWidth: never executed: break; | 0 | ||||||||||||||||||||||||
546 | case never executed: BorderWidth:case BorderWidth: never executed: lengthValues(decl, borders); break;case BorderWidth: never executed: break; | 0 | ||||||||||||||||||||||||
547 | - | |||||||||||||||||||||||||
548 | case never executed: BorderLeftColor:case BorderLeftColor: never executed: colors[LeftEdge] = decl.brushValue(pal); break;case BorderLeftColor: never executed: break; | 0 | ||||||||||||||||||||||||
549 | case never executed: BorderRightColor:case BorderRightColor: never executed: colors[RightEdge] = decl.brushValue(pal); break;case BorderRightColor: never executed: break; | 0 | ||||||||||||||||||||||||
550 | case never executed: BorderTopColor:case BorderTopColor: never executed: colors[TopEdge] = decl.brushValue(pal); break;case BorderTopColor: never executed: break; | 0 | ||||||||||||||||||||||||
551 | case never executed: BorderBottomColor:case BorderBottomColor: never executed: colors[BottomEdge] = decl.brushValue(pal); break;case BorderBottomColor: never executed: break; | 0 | ||||||||||||||||||||||||
552 | case never executed: BorderColor:case BorderColor: never executed: decl.brushValues(colors, pal); break;case BorderColor: never executed: break; | 0 | ||||||||||||||||||||||||
553 | - | |||||||||||||||||||||||||
554 | case never executed: BorderTopStyle:case BorderTopStyle: never executed: styles[TopEdge] = decl.styleValue(); break;case BorderTopStyle: never executed: break; | 0 | ||||||||||||||||||||||||
555 | case never executed: BorderBottomStyle:case BorderBottomStyle: never executed: styles[BottomEdge] = decl.styleValue(); break;case BorderBottomStyle: never executed: break; | 0 | ||||||||||||||||||||||||
556 | case never executed: BorderLeftStyle:case BorderLeftStyle: never executed: styles[LeftEdge] = decl.styleValue(); break;case BorderLeftStyle: never executed: break; | 0 | ||||||||||||||||||||||||
557 | case never executed: BorderRightStyle:case BorderRightStyle: never executed: styles[RightEdge] = decl.styleValue(); break;case BorderRightStyle: never executed: break; | 0 | ||||||||||||||||||||||||
558 | case never executed: BorderStyles:case BorderStyles: never executed: decl.styleValues(styles); break;case BorderStyles: never executed: break; | 0 | ||||||||||||||||||||||||
559 | - | |||||||||||||||||||||||||
560 | - | |||||||||||||||||||||||||
561 | case never executed: BorderTopLeftRadius:case BorderTopLeftRadius: never executed: radii[0] = sizeValue(decl); break;case BorderTopLeftRadius: never executed: break; | 0 | ||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||
564 | - | |||||||||||||||||||||||||
565 | case never executed: BorderTopRightRadius:case BorderTopRightRadius: never executed: radii[1] = sizeValue(decl); break;case BorderTopRightRadius: never executed: break; | 0 | ||||||||||||||||||||||||
566 | case never executed: BorderBottomLeftRadius:case BorderBottomLeftRadius: never executed: radii[2] = sizeValue(decl); break;case BorderBottomLeftRadius: never executed: break; | 0 | ||||||||||||||||||||||||
567 | case never executed: BorderBottomRightRadius:case BorderBottomRightRadius: never executed: radii[3] = sizeValue(decl); break;case BorderBottomRightRadius: never executed: break; | 0 | ||||||||||||||||||||||||
568 | case never executed: BorderRadius:case BorderRadius: never executed: sizeValues(decl, radii); break;case BorderRadius: never executed: break; | 0 | ||||||||||||||||||||||||
569 | - | |||||||||||||||||||||||||
570 | case never executed: BorderLeft:case BorderLeft: never executed: case BorderLeft: | 0 | ||||||||||||||||||||||||
571 | borderValue(decl, &borders[LeftEdge], &styles[LeftEdge], &colors[LeftEdge]); | - | ||||||||||||||||||||||||
572 | break; never executed: break; | 0 | ||||||||||||||||||||||||
573 | case never executed: BorderTop:case BorderTop: never executed: case BorderTop: | 0 | ||||||||||||||||||||||||
574 | borderValue(decl, &borders[TopEdge], &styles[TopEdge], &colors[TopEdge]); | - | ||||||||||||||||||||||||
575 | break; never executed: break; | 0 | ||||||||||||||||||||||||
576 | case never executed: BorderRight:case BorderRight: never executed: case BorderRight: | 0 | ||||||||||||||||||||||||
577 | borderValue(decl, &borders[RightEdge], &styles[RightEdge], &colors[RightEdge]); | - | ||||||||||||||||||||||||
578 | break; never executed: break; | 0 | ||||||||||||||||||||||||
579 | case never executed: BorderBottom:case BorderBottom: never executed: case BorderBottom: | 0 | ||||||||||||||||||||||||
580 | borderValue(decl, &borders[BottomEdge], &styles[BottomEdge], &colors[BottomEdge]); | - | ||||||||||||||||||||||||
581 | break; never executed: break; | 0 | ||||||||||||||||||||||||
582 | case never executed: Border:case Border: never executed: case Border: | 0 | ||||||||||||||||||||||||
583 | borderValue(decl, &borders[LeftEdge], &styles[LeftEdge], &colors[LeftEdge]); | - | ||||||||||||||||||||||||
584 | borders[TopEdge] = borders[RightEdge] = borders[BottomEdge] = borders[LeftEdge]; | - | ||||||||||||||||||||||||
585 | styles[TopEdge] = styles[RightEdge] = styles[BottomEdge] = styles[LeftEdge]; | - | ||||||||||||||||||||||||
586 | colors[TopEdge] = colors[RightEdge] = colors[BottomEdge] = colors[LeftEdge]; | - | ||||||||||||||||||||||||
587 | break; never executed: break; | 0 | ||||||||||||||||||||||||
588 | - | |||||||||||||||||||||||||
589 | default never executed: :default: never executed: continue;default: never executed: continue; | 0 | ||||||||||||||||||||||||
590 | } | - | ||||||||||||||||||||||||
591 | hit = true; | - | ||||||||||||||||||||||||
592 | } never executed: end of block | 0 | ||||||||||||||||||||||||
593 | - | |||||||||||||||||||||||||
594 | return never executed: hit;return hit; never executed: return hit; | 0 | ||||||||||||||||||||||||
595 | } | - | ||||||||||||||||||||||||
596 | - | |||||||||||||||||||||||||
597 | bool ValueExtractor::extractOutline(int *borders, QBrush *colors, BorderStyle *styles, | - | ||||||||||||||||||||||||
598 | QSize *radii, int *offsets) | - | ||||||||||||||||||||||||
599 | { | - | ||||||||||||||||||||||||
600 | extractFont(); | - | ||||||||||||||||||||||||
601 | bool hit = false; | - | ||||||||||||||||||||||||
602 | for (int i = 0; i < declarations.count()
| 0 | ||||||||||||||||||||||||
603 | const Declaration &decl = declarations.at(i); | - | ||||||||||||||||||||||||
604 | switch (decl.d->propertyId) { | - | ||||||||||||||||||||||||
605 | case never executed: OutlineWidth:case OutlineWidth: never executed: lengthValues(decl, borders); break;case OutlineWidth: never executed: break; | 0 | ||||||||||||||||||||||||
606 | case never executed: OutlineColor:case OutlineColor: never executed: decl.brushValues(colors, pal); break;case OutlineColor: never executed: break; | 0 | ||||||||||||||||||||||||
607 | case never executed: OutlineStyle:case OutlineStyle: never executed: decl.styleValues(styles); break;case OutlineStyle: never executed: break; | 0 | ||||||||||||||||||||||||
608 | - | |||||||||||||||||||||||||
609 | case never executed: OutlineTopLeftRadius:case OutlineTopLeftRadius: never executed: radii[0] = sizeValue(decl); break;case OutlineTopLeftRadius: never executed: break; | 0 | ||||||||||||||||||||||||
610 | case never executed: OutlineTopRightRadius:case OutlineTopRightRadius: never executed: radii[1] = sizeValue(decl); break;case OutlineTopRightRadius: never executed: break; | 0 | ||||||||||||||||||||||||
611 | case never executed: OutlineBottomLeftRadius:case OutlineBottomLeftRadius: never executed: radii[2] = sizeValue(decl); break;case OutlineBottomLeftRadius: never executed: break; | 0 | ||||||||||||||||||||||||
612 | case never executed: OutlineBottomRightRadius:case OutlineBottomRightRadius: never executed: radii[3] = sizeValue(decl); break;case OutlineBottomRightRadius: never executed: break; | 0 | ||||||||||||||||||||||||
613 | case never executed: OutlineRadius:case OutlineRadius: never executed: sizeValues(decl, radii); break;case OutlineRadius: never executed: break; | 0 | ||||||||||||||||||||||||
614 | case never executed: OutlineOffset:case OutlineOffset: never executed: lengthValues(decl, offsets); break;case OutlineOffset: never executed: break; | 0 | ||||||||||||||||||||||||
615 | - | |||||||||||||||||||||||||
616 | case never executed: Outline:case Outline: never executed: case Outline: | 0 | ||||||||||||||||||||||||
617 | borderValue(decl, &borders[LeftEdge], &styles[LeftEdge], &colors[LeftEdge]); | - | ||||||||||||||||||||||||
618 | borders[TopEdge] = borders[RightEdge] = borders[BottomEdge] = borders[LeftEdge]; | - | ||||||||||||||||||||||||
619 | styles[TopEdge] = styles[RightEdge] = styles[BottomEdge] = styles[LeftEdge]; | - | ||||||||||||||||||||||||
620 | colors[TopEdge] = colors[RightEdge] = colors[BottomEdge] = colors[LeftEdge]; | - | ||||||||||||||||||||||||
621 | break; never executed: break; | 0 | ||||||||||||||||||||||||
622 | - | |||||||||||||||||||||||||
623 | default never executed: :default: never executed: continue;default: never executed: continue; | 0 | ||||||||||||||||||||||||
624 | } | - | ||||||||||||||||||||||||
625 | hit = true; | - | ||||||||||||||||||||||||
626 | } never executed: end of block | 0 | ||||||||||||||||||||||||
627 | - | |||||||||||||||||||||||||
628 | return never executed: hit;return hit; never executed: return hit; | 0 | ||||||||||||||||||||||||
629 | } | - | ||||||||||||||||||||||||
630 | - | |||||||||||||||||||||||||
631 | static Qt::Alignment parseAlignment(const QCss::Value *values, int count) | - | ||||||||||||||||||||||||
632 | { | - | ||||||||||||||||||||||||
633 | Qt::Alignment a[2] = { 0, 0 }; | - | ||||||||||||||||||||||||
634 | for (int i = 0; i < qMin(2, count)
| 0 | ||||||||||||||||||||||||
635 | if (values[i].type != Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
636 | break; never executed: break; | 0 | ||||||||||||||||||||||||
637 | switch (values[i].variant.toInt()) { | - | ||||||||||||||||||||||||
638 | case never executed: Value_Left:case Value_Left: never executed: a[i] = Qt::AlignLeft; break;case Value_Left: never executed: break; | 0 | ||||||||||||||||||||||||
639 | case never executed: Value_Right:case Value_Right: never executed: a[i] = Qt::AlignRight; break;case Value_Right: never executed: break; | 0 | ||||||||||||||||||||||||
640 | case never executed: Value_Top:case Value_Top: never executed: a[i] = Qt::AlignTop; break;case Value_Top: never executed: break; | 0 | ||||||||||||||||||||||||
641 | case never executed: Value_Bottom:case Value_Bottom: never executed: a[i] = Qt::AlignBottom; break;case Value_Bottom: never executed: break; | 0 | ||||||||||||||||||||||||
642 | case never executed: Value_Center:case Value_Center: never executed: a[i] = Qt::AlignCenter; break;case Value_Center: never executed: break; | 0 | ||||||||||||||||||||||||
643 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||||||||
644 | } | - | ||||||||||||||||||||||||
645 | } | - | ||||||||||||||||||||||||
646 | - | |||||||||||||||||||||||||
647 | if (a[0] == Qt::AlignCenter
| 0 | ||||||||||||||||||||||||
648 | a[0] = (a[1] == Qt::AlignLeft
never executed: a[0] = (a[1] == Qt::AlignLeft || a[1] == Qt::AlignRight) ? Qt::AlignVCenter : Qt::AlignHCenter; | 0 | ||||||||||||||||||||||||
649 | if ((a[1] == 0
| 0 | ||||||||||||||||||||||||
650 | a[1] = (a[0] == Qt::AlignLeft
never executed: a[1] = (a[0] == Qt::AlignLeft || a[0] == Qt::AlignRight) ? Qt::AlignVCenter : Qt::AlignHCenter; | 0 | ||||||||||||||||||||||||
651 | return never executed: a[0] | a[1];return a[0] | a[1]; never executed: return a[0] | a[1]; | 0 | ||||||||||||||||||||||||
652 | } | - | ||||||||||||||||||||||||
653 | - | |||||||||||||||||||||||||
654 | static ColorData parseColorValue(QCss::Value v) | - | ||||||||||||||||||||||||
655 | { | - | ||||||||||||||||||||||||
656 | if (v.type == Value::Identifier
| 0 | ||||||||||||||||||||||||
657 | v.variant.convert(QVariant::Color); | - | ||||||||||||||||||||||||
658 | v.type = Value::Color; | - | ||||||||||||||||||||||||
659 | } never executed: end of block | 0 | ||||||||||||||||||||||||
660 | - | |||||||||||||||||||||||||
661 | if (v.type == Value::Color
| 0 | ||||||||||||||||||||||||
662 | return never executed: qvariant_cast<QColor>(v.variant);return qvariant_cast<QColor>(v.variant); never executed: return qvariant_cast<QColor>(v.variant); | 0 | ||||||||||||||||||||||||
663 | - | |||||||||||||||||||||||||
664 | if (v.type == Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
665 | return never executed: QColor(Qt::transparent);return QColor(Qt::transparent); never executed: return QColor(Qt::transparent); | 0 | ||||||||||||||||||||||||
666 | - | |||||||||||||||||||||||||
667 | if (v.type != Value::Function
| 0 | ||||||||||||||||||||||||
668 | return never executed: ColorData();return ColorData(); never executed: return ColorData(); | 0 | ||||||||||||||||||||||||
669 | - | |||||||||||||||||||||||||
670 | QStringList lst = v.variant.toStringList(); | - | ||||||||||||||||||||||||
671 | if (lst.count() != 2
| 0 | ||||||||||||||||||||||||
672 | return never executed: ColorData();return ColorData(); never executed: return ColorData(); | 0 | ||||||||||||||||||||||||
673 | - | |||||||||||||||||||||||||
674 | if ((
| 0 | ||||||||||||||||||||||||
675 | int role = findKnownValue(lst.at(1).trimmed(), values, NumKnownValues); | - | ||||||||||||||||||||||||
676 | if (role >= Value_FirstColorRole
| 0 | ||||||||||||||||||||||||
677 | return never executed: (QPalette::ColorRole)(role-Value_FirstColorRole);return (QPalette::ColorRole)(role-Value_FirstColorRole); never executed: return (QPalette::ColorRole)(role-Value_FirstColorRole); | 0 | ||||||||||||||||||||||||
678 | - | |||||||||||||||||||||||||
679 | return never executed: ColorData();return ColorData(); never executed: return ColorData(); | 0 | ||||||||||||||||||||||||
680 | } | - | ||||||||||||||||||||||||
681 | - | |||||||||||||||||||||||||
682 | bool rgb = lst.at(0).startsWith(QLatin1String("rgb")); | - | ||||||||||||||||||||||||
683 | bool rgba = lst.at(0).startsWith(QLatin1String("rgba")); | - | ||||||||||||||||||||||||
684 | - | |||||||||||||||||||||||||
685 | Parser p(lst.at(1)); | - | ||||||||||||||||||||||||
686 | if (!p.testExpr()
| 0 | ||||||||||||||||||||||||
687 | return never executed: ColorData();return ColorData(); never executed: return ColorData(); | 0 | ||||||||||||||||||||||||
688 | - | |||||||||||||||||||||||||
689 | QVector<QCss::Value> colorDigits; | - | ||||||||||||||||||||||||
690 | if (!p.parseExpr(&colorDigits)
| 0 | ||||||||||||||||||||||||
691 | return never executed: ColorData();return ColorData(); never executed: return ColorData(); | 0 | ||||||||||||||||||||||||
692 | const int tokenCount = colorDigits.count(); | - | ||||||||||||||||||||||||
693 | - | |||||||||||||||||||||||||
694 | for (int i = 0; i < qMin(tokenCount, 7)
| 0 | ||||||||||||||||||||||||
695 | if (colorDigits.at(i).type == Value::Percentage
| 0 | ||||||||||||||||||||||||
696 | colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.); | - | ||||||||||||||||||||||||
697 | colorDigits[i].type = Value::Number; | - | ||||||||||||||||||||||||
698 | } never executed: else if (colorDigits.at(i).type != Value::Numberend of block
| 0 | ||||||||||||||||||||||||
699 | return never executed: ColorData();return ColorData(); never executed: return ColorData(); | 0 | ||||||||||||||||||||||||
700 | } | - | ||||||||||||||||||||||||
701 | } never executed: end of block | 0 | ||||||||||||||||||||||||
702 | - | |||||||||||||||||||||||||
703 | - | |||||||||||||||||||||||||
704 | if (tokenCount < 5
| 0 | ||||||||||||||||||||||||
705 | return never executed: ColorData();return ColorData(); never executed: return ColorData(); | 0 | ||||||||||||||||||||||||
706 | - | |||||||||||||||||||||||||
707 | int v1 = colorDigits.at(0).variant.toInt(); | - | ||||||||||||||||||||||||
708 | int v2 = colorDigits.at(2).variant.toInt(); | - | ||||||||||||||||||||||||
709 | int v3 = colorDigits.at(4).variant.toInt(); | - | ||||||||||||||||||||||||
710 | int alpha = 255; | - | ||||||||||||||||||||||||
711 | if (tokenCount >= 7
| 0 | ||||||||||||||||||||||||
712 | int alphaValue = colorDigits.at(6).variant.toInt(); | - | ||||||||||||||||||||||||
713 | if (rgba
| 0 | ||||||||||||||||||||||||
714 | alpha = colorDigits.at(6).variant.toReal() * 255.; never executed: alpha = colorDigits.at(6).variant.toReal() * 255.; | 0 | ||||||||||||||||||||||||
715 | else | - | ||||||||||||||||||||||||
716 | alpha = alphaValue; never executed: alpha = alphaValue; | 0 | ||||||||||||||||||||||||
717 | } | - | ||||||||||||||||||||||||
718 | - | |||||||||||||||||||||||||
719 | return never executed: rgb ? QColor::fromRgb(v1, v2, v3, alpha)return rgb ? QColor::fromRgb(v1, v2, v3, alpha) : QColor::fromHsv(v1, v2, v3, alpha); never executed: return rgb ? QColor::fromRgb(v1, v2, v3, alpha) : QColor::fromHsv(v1, v2, v3, alpha); | 0 | ||||||||||||||||||||||||
720 | : QColor::fromHsv(v1, v2, v3, alpha); never executed: return rgb ? QColor::fromRgb(v1, v2, v3, alpha) : QColor::fromHsv(v1, v2, v3, alpha); | 0 | ||||||||||||||||||||||||
721 | } | - | ||||||||||||||||||||||||
722 | - | |||||||||||||||||||||||||
723 | static QColor colorFromData(const ColorData& c, const QPalette &pal) | - | ||||||||||||||||||||||||
724 | { | - | ||||||||||||||||||||||||
725 | if (c.type == ColorData::Color
| 0 | ||||||||||||||||||||||||
726 | return never executed: c.color;return c.color; never executed: return c.color; | 0 | ||||||||||||||||||||||||
727 | } else if (c.type == ColorData::Role
| 0 | ||||||||||||||||||||||||
728 | return never executed: pal.color(c.role);return pal.color(c.role); never executed: return pal.color(c.role); | 0 | ||||||||||||||||||||||||
729 | } | - | ||||||||||||||||||||||||
730 | return never executed: QColor();return QColor(); never executed: return QColor(); | 0 | ||||||||||||||||||||||||
731 | } | - | ||||||||||||||||||||||||
732 | - | |||||||||||||||||||||||||
733 | static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal) | - | ||||||||||||||||||||||||
734 | { | - | ||||||||||||||||||||||||
735 | ColorData c = parseColorValue(v); | - | ||||||||||||||||||||||||
736 | if (c.type == ColorData::Color
| 0 | ||||||||||||||||||||||||
737 | return never executed: QBrush(c.color);return QBrush(c.color); never executed: return QBrush(c.color); | 0 | ||||||||||||||||||||||||
738 | } else if (c.type == ColorData::Role
| 0 | ||||||||||||||||||||||||
739 | return never executed: c.role;return c.role; never executed: return c.role; | 0 | ||||||||||||||||||||||||
740 | } | - | ||||||||||||||||||||||||
741 | - | |||||||||||||||||||||||||
742 | if (v.type != Value::Function
| 0 | ||||||||||||||||||||||||
743 | return never executed: BrushData();return BrushData(); never executed: return BrushData(); | 0 | ||||||||||||||||||||||||
744 | - | |||||||||||||||||||||||||
745 | QStringList lst = v.variant.toStringList(); | - | ||||||||||||||||||||||||
746 | if (lst.count() != 2
| 0 | ||||||||||||||||||||||||
747 | return never executed: BrushData();return BrushData(); never executed: return BrushData(); | 0 | ||||||||||||||||||||||||
748 | - | |||||||||||||||||||||||||
749 | QStringList gradFuncs; | - | ||||||||||||||||||||||||
750 | gradFuncs << QLatin1String("qlineargradient") << QLatin1String("qradialgradient") << QLatin1String("qconicalgradient") << QLatin1String("qgradient"); | - | ||||||||||||||||||||||||
751 | int gradType = -1; | - | ||||||||||||||||||||||||
752 | - | |||||||||||||||||||||||||
753 | if ((
| 0 | ||||||||||||||||||||||||
754 | return never executed: BrushData();return BrushData(); never executed: return BrushData(); | 0 | ||||||||||||||||||||||||
755 | - | |||||||||||||||||||||||||
756 | QHash<QString, qreal> vars; | - | ||||||||||||||||||||||||
757 | QVector<QGradientStop> stops; | - | ||||||||||||||||||||||||
758 | - | |||||||||||||||||||||||||
759 | int spread = -1; | - | ||||||||||||||||||||||||
760 | QStringList spreads; | - | ||||||||||||||||||||||||
761 | spreads << QLatin1String("pad") << QLatin1String("reflect") << QLatin1String("repeat"); | - | ||||||||||||||||||||||||
762 | - | |||||||||||||||||||||||||
763 | bool dependsOnThePalette = false; | - | ||||||||||||||||||||||||
764 | Parser parser(lst.at(1)); | - | ||||||||||||||||||||||||
765 | while (parser.hasNext()
| 0 | ||||||||||||||||||||||||
766 | parser.skipSpace(); | - | ||||||||||||||||||||||||
767 | if (!parser.test(IDENT)
| 0 | ||||||||||||||||||||||||
768 | return never executed: BrushData();return BrushData(); never executed: return BrushData(); | 0 | ||||||||||||||||||||||||
769 | QString attr = parser.lexem(); | - | ||||||||||||||||||||||||
770 | parser.skipSpace(); | - | ||||||||||||||||||||||||
771 | if (!parser.test(COLON)
| 0 | ||||||||||||||||||||||||
772 | return never executed: BrushData();return BrushData(); never executed: return BrushData(); | 0 | ||||||||||||||||||||||||
773 | parser.skipSpace(); | - | ||||||||||||||||||||||||
774 | if (attr.compare(QLatin1String("stop"), Qt::CaseInsensitive) == 0
| 0 | ||||||||||||||||||||||||
775 | QCss::Value stop, color; | - | ||||||||||||||||||||||||
776 | parser.next(); | - | ||||||||||||||||||||||||
777 | if (!parser.parseTerm(&stop)
never executed: BrushData();return BrushData(); never executed: return BrushData(); | 0 | ||||||||||||||||||||||||
778 | parser.skipSpace(); | - | ||||||||||||||||||||||||
779 | parser.next(); | - | ||||||||||||||||||||||||
780 | if (!parser.parseTerm(&color)
never executed: BrushData();return BrushData(); never executed: return BrushData(); | 0 | ||||||||||||||||||||||||
781 | ColorData cd = parseColorValue(color); | - | ||||||||||||||||||||||||
782 | if(cd.type == ColorData::Role
| 0 | ||||||||||||||||||||||||
783 | dependsOnThePalette = true; never executed: dependsOnThePalette = true; | 0 | ||||||||||||||||||||||||
784 | stops.append(QGradientStop(stop.variant.toReal(), colorFromData(cd, pal))); | - | ||||||||||||||||||||||||
785 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
786 | parser.next(); | - | ||||||||||||||||||||||||
787 | QCss::Value value; | - | ||||||||||||||||||||||||
788 | (void)parser.parseTerm(&value); | - | ||||||||||||||||||||||||
789 | if (attr.compare(QLatin1String("spread"), Qt::CaseInsensitive) == 0
| 0 | ||||||||||||||||||||||||
790 | spread = spreads.indexOf(value.variant.toString()); | - | ||||||||||||||||||||||||
791 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
792 | vars[attr] = value.variant.toReal(); | - | ||||||||||||||||||||||||
793 | } never executed: end of block | 0 | ||||||||||||||||||||||||
794 | } | - | ||||||||||||||||||||||||
795 | parser.skipSpace(); | - | ||||||||||||||||||||||||
796 | (void)parser.test(COMMA); | - | ||||||||||||||||||||||||
797 | } never executed: end of block | 0 | ||||||||||||||||||||||||
798 | - | |||||||||||||||||||||||||
799 | if (gradType == 0
| 0 | ||||||||||||||||||||||||
800 | QLinearGradient lg(vars.value(QLatin1String("x1")), vars.value(QLatin1String("y1")), | - | ||||||||||||||||||||||||
801 | vars.value(QLatin1String("x2")), vars.value(QLatin1String("y2"))); | - | ||||||||||||||||||||||||
802 | lg.setCoordinateMode(QGradient::ObjectBoundingMode); | - | ||||||||||||||||||||||||
803 | lg.setStops(stops); | - | ||||||||||||||||||||||||
804 | if (spread != -1
| 0 | ||||||||||||||||||||||||
805 | lg.setSpread(QGradient::Spread(spread)); never executed: lg.setSpread(QGradient::Spread(spread)); | 0 | ||||||||||||||||||||||||
806 | BrushData bd = QBrush(lg); | - | ||||||||||||||||||||||||
807 | if (dependsOnThePalette
| 0 | ||||||||||||||||||||||||
808 | bd.type = BrushData::DependsOnThePalette; never executed: bd.type = BrushData::DependsOnThePalette; | 0 | ||||||||||||||||||||||||
809 | return never executed: bd;return bd; never executed: return bd; | 0 | ||||||||||||||||||||||||
810 | } | - | ||||||||||||||||||||||||
811 | - | |||||||||||||||||||||||||
812 | if (gradType == 1
| 0 | ||||||||||||||||||||||||
813 | QRadialGradient rg(vars.value(QLatin1String("cx")), vars.value(QLatin1String("cy")), | - | ||||||||||||||||||||||||
814 | vars.value(QLatin1String("radius")), vars.value(QLatin1String("fx")), | - | ||||||||||||||||||||||||
815 | vars.value(QLatin1String("fy"))); | - | ||||||||||||||||||||||||
816 | rg.setCoordinateMode(QGradient::ObjectBoundingMode); | - | ||||||||||||||||||||||||
817 | rg.setStops(stops); | - | ||||||||||||||||||||||||
818 | if (spread != -1
| 0 | ||||||||||||||||||||||||
819 | rg.setSpread(QGradient::Spread(spread)); never executed: rg.setSpread(QGradient::Spread(spread)); | 0 | ||||||||||||||||||||||||
820 | BrushData bd = QBrush(rg); | - | ||||||||||||||||||||||||
821 | if (dependsOnThePalette
| 0 | ||||||||||||||||||||||||
822 | bd.type = BrushData::DependsOnThePalette; never executed: bd.type = BrushData::DependsOnThePalette; | 0 | ||||||||||||||||||||||||
823 | return never executed: bd;return bd; never executed: return bd; | 0 | ||||||||||||||||||||||||
824 | } | - | ||||||||||||||||||||||||
825 | - | |||||||||||||||||||||||||
826 | if (gradType == 2
| 0 | ||||||||||||||||||||||||
827 | QConicalGradient cg(vars.value(QLatin1String("cx")), vars.value(QLatin1String("cy")), | - | ||||||||||||||||||||||||
828 | vars.value(QLatin1String("angle"))); | - | ||||||||||||||||||||||||
829 | cg.setCoordinateMode(QGradient::ObjectBoundingMode); | - | ||||||||||||||||||||||||
830 | cg.setStops(stops); | - | ||||||||||||||||||||||||
831 | if (spread != -1
| 0 | ||||||||||||||||||||||||
832 | cg.setSpread(QGradient::Spread(spread)); never executed: cg.setSpread(QGradient::Spread(spread)); | 0 | ||||||||||||||||||||||||
833 | BrushData bd = QBrush(cg); | - | ||||||||||||||||||||||||
834 | if (dependsOnThePalette
| 0 | ||||||||||||||||||||||||
835 | bd.type = BrushData::DependsOnThePalette; never executed: bd.type = BrushData::DependsOnThePalette; | 0 | ||||||||||||||||||||||||
836 | return never executed: bd;return bd; never executed: return bd; | 0 | ||||||||||||||||||||||||
837 | } | - | ||||||||||||||||||||||||
838 | - | |||||||||||||||||||||||||
839 | return never executed: BrushData();return BrushData(); never executed: return BrushData(); | 0 | ||||||||||||||||||||||||
840 | } | - | ||||||||||||||||||||||||
841 | - | |||||||||||||||||||||||||
842 | static QBrush brushFromData(const BrushData& c, const QPalette &pal) | - | ||||||||||||||||||||||||
843 | { | - | ||||||||||||||||||||||||
844 | if (c.type == BrushData::Role
| 0 | ||||||||||||||||||||||||
845 | return never executed: pal.color(c.role);return pal.color(c.role); never executed: return pal.color(c.role); | 0 | ||||||||||||||||||||||||
846 | } else { | - | ||||||||||||||||||||||||
847 | return never executed: c.brush;return c.brush; never executed: return c.brush; | 0 | ||||||||||||||||||||||||
848 | } | - | ||||||||||||||||||||||||
849 | } | - | ||||||||||||||||||||||||
850 | - | |||||||||||||||||||||||||
851 | static BorderStyle parseStyleValue(QCss::Value v) | - | ||||||||||||||||||||||||
852 | { | - | ||||||||||||||||||||||||
853 | if (v.type == Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
854 | switch (v.variant.toInt()) { | - | ||||||||||||||||||||||||
855 | case never executed: Value_None:case Value_None: never executed: case Value_None: | 0 | ||||||||||||||||||||||||
856 | return never executed: BorderStyle_None;return BorderStyle_None; never executed: return BorderStyle_None; | 0 | ||||||||||||||||||||||||
857 | case never executed: Value_Dotted:case Value_Dotted: never executed: case Value_Dotted: | 0 | ||||||||||||||||||||||||
858 | return never executed: BorderStyle_Dotted;return BorderStyle_Dotted; never executed: return BorderStyle_Dotted; | 0 | ||||||||||||||||||||||||
859 | case never executed: Value_Dashed:case Value_Dashed: never executed: case Value_Dashed: | 0 | ||||||||||||||||||||||||
860 | return never executed: BorderStyle_Dashed;return BorderStyle_Dashed; never executed: return BorderStyle_Dashed; | 0 | ||||||||||||||||||||||||
861 | case never executed: Value_Solid:case Value_Solid: never executed: case Value_Solid: | 0 | ||||||||||||||||||||||||
862 | return never executed: BorderStyle_Solid;return BorderStyle_Solid; never executed: return BorderStyle_Solid; | 0 | ||||||||||||||||||||||||
863 | case never executed: Value_Double:case Value_Double: never executed: case Value_Double: | 0 | ||||||||||||||||||||||||
864 | return never executed: BorderStyle_Double;return BorderStyle_Double; never executed: return BorderStyle_Double; | 0 | ||||||||||||||||||||||||
865 | case never executed: Value_DotDash:case Value_DotDash: never executed: case Value_DotDash: | 0 | ||||||||||||||||||||||||
866 | return never executed: BorderStyle_DotDash;return BorderStyle_DotDash; never executed: return BorderStyle_DotDash; | 0 | ||||||||||||||||||||||||
867 | case never executed: Value_DotDotDash:case Value_DotDotDash: never executed: case Value_DotDotDash: | 0 | ||||||||||||||||||||||||
868 | return never executed: BorderStyle_DotDotDash;return BorderStyle_DotDotDash; never executed: return BorderStyle_DotDotDash; | 0 | ||||||||||||||||||||||||
869 | case never executed: Value_Groove:case Value_Groove: never executed: case Value_Groove: | 0 | ||||||||||||||||||||||||
870 | return never executed: BorderStyle_Groove;return BorderStyle_Groove; never executed: return BorderStyle_Groove; | 0 | ||||||||||||||||||||||||
871 | case never executed: Value_Ridge:case Value_Ridge: never executed: case Value_Ridge: | 0 | ||||||||||||||||||||||||
872 | return never executed: BorderStyle_Ridge;return BorderStyle_Ridge; never executed: return BorderStyle_Ridge; | 0 | ||||||||||||||||||||||||
873 | case never executed: Value_Inset:case Value_Inset: never executed: case Value_Inset: | 0 | ||||||||||||||||||||||||
874 | return never executed: BorderStyle_Inset;return BorderStyle_Inset; never executed: return BorderStyle_Inset; | 0 | ||||||||||||||||||||||||
875 | case never executed: Value_Outset:case Value_Outset: never executed: case Value_Outset: | 0 | ||||||||||||||||||||||||
876 | return never executed: BorderStyle_Outset;return BorderStyle_Outset; never executed: return BorderStyle_Outset; | 0 | ||||||||||||||||||||||||
877 | case never executed: Value_Native:case Value_Native: never executed: case Value_Native: | 0 | ||||||||||||||||||||||||
878 | return never executed: BorderStyle_Native;return BorderStyle_Native; never executed: return BorderStyle_Native; | 0 | ||||||||||||||||||||||||
879 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
880 | break; never executed: break; | 0 | ||||||||||||||||||||||||
881 | } | - | ||||||||||||||||||||||||
882 | } | - | ||||||||||||||||||||||||
883 | - | |||||||||||||||||||||||||
884 | return never executed: BorderStyle_Unknown;return BorderStyle_Unknown; never executed: return BorderStyle_Unknown; | 0 | ||||||||||||||||||||||||
885 | } | - | ||||||||||||||||||||||||
886 | - | |||||||||||||||||||||||||
887 | void ValueExtractor::borderValue(const Declaration &decl, int *width, QCss::BorderStyle *style, QBrush *color) | - | ||||||||||||||||||||||||
888 | { | - | ||||||||||||||||||||||||
889 | if (decl.d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
890 | BorderData data = qvariant_cast<BorderData>(decl.d->parsed); | - | ||||||||||||||||||||||||
891 | *width = lengthValueFromData(data.width, f); | - | ||||||||||||||||||||||||
892 | *style = data.style; | - | ||||||||||||||||||||||||
893 | *color = data.color.type != BrushData::Invalid
| 0 | ||||||||||||||||||||||||
894 | return; never executed: return; | 0 | ||||||||||||||||||||||||
895 | } | - | ||||||||||||||||||||||||
896 | - | |||||||||||||||||||||||||
897 | *width = 0; | - | ||||||||||||||||||||||||
898 | *style = BorderStyle_None; | - | ||||||||||||||||||||||||
899 | *color = QColor(); | - | ||||||||||||||||||||||||
900 | - | |||||||||||||||||||||||||
901 | if (decl.d->values.isEmpty()
| 0 | ||||||||||||||||||||||||
902 | return; never executed: return; | 0 | ||||||||||||||||||||||||
903 | - | |||||||||||||||||||||||||
904 | BorderData data; | - | ||||||||||||||||||||||||
905 | data.width.number = 0; | - | ||||||||||||||||||||||||
906 | data.width.unit = LengthData::None; | - | ||||||||||||||||||||||||
907 | data.style = BorderStyle_None; | - | ||||||||||||||||||||||||
908 | - | |||||||||||||||||||||||||
909 | int i = 0; | - | ||||||||||||||||||||||||
910 | if (decl.d->values.at(i).type == Value::Length
| 0 | ||||||||||||||||||||||||
911 | data.width = lengthValue(decl.d->values.at(i)); | - | ||||||||||||||||||||||||
912 | *width = lengthValueFromData(data.width, f); | - | ||||||||||||||||||||||||
913 | if (++
| 0 | ||||||||||||||||||||||||
914 | decl.d->parsed = QVariant::fromValue<BorderData>(data); | - | ||||||||||||||||||||||||
915 | return; never executed: return; | 0 | ||||||||||||||||||||||||
916 | } | - | ||||||||||||||||||||||||
917 | } never executed: end of block | 0 | ||||||||||||||||||||||||
918 | - | |||||||||||||||||||||||||
919 | data.style = parseStyleValue(decl.d->values.at(i)); | - | ||||||||||||||||||||||||
920 | if (data.style != BorderStyle_Unknown
| 0 | ||||||||||||||||||||||||
921 | *style = data.style; | - | ||||||||||||||||||||||||
922 | if (++
| 0 | ||||||||||||||||||||||||
923 | decl.d->parsed = QVariant::fromValue<BorderData>(data); | - | ||||||||||||||||||||||||
924 | return; never executed: return; | 0 | ||||||||||||||||||||||||
925 | } | - | ||||||||||||||||||||||||
926 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
927 | data.style = BorderStyle_None; | - | ||||||||||||||||||||||||
928 | } never executed: end of block | 0 | ||||||||||||||||||||||||
929 | - | |||||||||||||||||||||||||
930 | data.color = parseBrushValue(decl.d->values.at(i), pal); | - | ||||||||||||||||||||||||
931 | *color = brushFromData(data.color, pal); | - | ||||||||||||||||||||||||
932 | if (data.color.type != BrushData::DependsOnThePalette
| 0 | ||||||||||||||||||||||||
933 | decl.d->parsed = QVariant::fromValue<BorderData>(data); never executed: decl.d->parsed = QVariant::fromValue<BorderData>(data); | 0 | ||||||||||||||||||||||||
934 | } never executed: end of block | 0 | ||||||||||||||||||||||||
935 | - | |||||||||||||||||||||||||
936 | static void parseShorthandBackgroundProperty(const QVector<QCss::Value> &values, BrushData *brush, QString *image, Repeat *repeat, Qt::Alignment *alignment, const QPalette &pal) | - | ||||||||||||||||||||||||
937 | { | - | ||||||||||||||||||||||||
938 | *brush = BrushData(); | - | ||||||||||||||||||||||||
939 | *image = QString(); | - | ||||||||||||||||||||||||
940 | *repeat = Repeat_XY; | - | ||||||||||||||||||||||||
941 | *alignment = Qt::AlignTop | Qt::AlignLeft; | - | ||||||||||||||||||||||||
942 | - | |||||||||||||||||||||||||
943 | for (int i = 0; i < values.count()
| 0 | ||||||||||||||||||||||||
944 | const QCss::Value &v = values.at(i); | - | ||||||||||||||||||||||||
945 | if (v.type == Value::Uri
| 0 | ||||||||||||||||||||||||
946 | *image = v.variant.toString(); | - | ||||||||||||||||||||||||
947 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
948 | } else if (v.type == Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
949 | *image = QString(); | - | ||||||||||||||||||||||||
950 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
951 | } else if (v.type == Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
952 | *brush = QBrush(Qt::transparent); | - | ||||||||||||||||||||||||
953 | } never executed: end of block | 0 | ||||||||||||||||||||||||
954 | - | |||||||||||||||||||||||||
955 | Repeat repeatAttempt = static_cast<Repeat>(findKnownValue(v.variant.toString(), | - | ||||||||||||||||||||||||
956 | repeats, NumKnownRepeats)); | - | ||||||||||||||||||||||||
957 | if (repeatAttempt != Repeat_Unknown
| 0 | ||||||||||||||||||||||||
958 | *repeat = repeatAttempt; | - | ||||||||||||||||||||||||
959 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
960 | } | - | ||||||||||||||||||||||||
961 | - | |||||||||||||||||||||||||
962 | if (v.type == Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
963 | const int start = i; | - | ||||||||||||||||||||||||
964 | int count = 1; | - | ||||||||||||||||||||||||
965 | if (i < values.count() - 1
| 0 | ||||||||||||||||||||||||
966 | && values.at(i + 1).type == Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
967 | ++i; | - | ||||||||||||||||||||||||
968 | ++count; | - | ||||||||||||||||||||||||
969 | } never executed: end of block | 0 | ||||||||||||||||||||||||
970 | Qt::Alignment a = parseAlignment(values.constData() + start, count); | - | ||||||||||||||||||||||||
971 | if (int(a) != 0
| 0 | ||||||||||||||||||||||||
972 | *alignment = a; | - | ||||||||||||||||||||||||
973 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
974 | } | - | ||||||||||||||||||||||||
975 | i -= count - 1; | - | ||||||||||||||||||||||||
976 | } never executed: end of block | 0 | ||||||||||||||||||||||||
977 | - | |||||||||||||||||||||||||
978 | *brush = parseBrushValue(v, pal); | - | ||||||||||||||||||||||||
979 | } never executed: end of block | 0 | ||||||||||||||||||||||||
980 | } never executed: end of block | 0 | ||||||||||||||||||||||||
981 | - | |||||||||||||||||||||||||
982 | bool ValueExtractor::extractBackground(QBrush *brush, QString *image, Repeat *repeat, | - | ||||||||||||||||||||||||
983 | Qt::Alignment *alignment, Origin *origin, Attachment *attachment, | - | ||||||||||||||||||||||||
984 | Origin *clip) | - | ||||||||||||||||||||||||
985 | { | - | ||||||||||||||||||||||||
986 | bool hit = false; | - | ||||||||||||||||||||||||
987 | for (int i = 0; i < declarations.count()
| 0 | ||||||||||||||||||||||||
988 | const Declaration &decl = declarations.at(i); | - | ||||||||||||||||||||||||
989 | if (decl.d->values.isEmpty()
| 0 | ||||||||||||||||||||||||
990 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
991 | const QCss::Value &val = decl.d->values.at(0); | - | ||||||||||||||||||||||||
992 | switch (decl.d->propertyId) { | - | ||||||||||||||||||||||||
993 | case never executed: BackgroundColor:case BackgroundColor: never executed: case BackgroundColor: | 0 | ||||||||||||||||||||||||
994 | *brush = decl.brushValue(); | - | ||||||||||||||||||||||||
995 | break; never executed: break; | 0 | ||||||||||||||||||||||||
996 | case never executed: BackgroundImage:case BackgroundImage: never executed: case BackgroundImage: | 0 | ||||||||||||||||||||||||
997 | if (val.type == Value::Uri
| 0 | ||||||||||||||||||||||||
998 | * never executed: image = val.variant.toString();*image = val.variant.toString(); never executed: *image = val.variant.toString(); | 0 | ||||||||||||||||||||||||
999 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1000 | case never executed: BackgroundRepeat:case BackgroundRepeat: never executed: case BackgroundRepeat: | 0 | ||||||||||||||||||||||||
1001 | if (decl.d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1002 | *repeat = static_cast<Repeat>(decl.d->parsed.toInt()); | - | ||||||||||||||||||||||||
1003 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1004 | *repeat = static_cast<Repeat>(findKnownValue(val.variant.toString(), | - | ||||||||||||||||||||||||
1005 | repeats, NumKnownRepeats)); | - | ||||||||||||||||||||||||
1006 | decl.d->parsed = *repeat; | - | ||||||||||||||||||||||||
1007 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1008 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1009 | case never executed: BackgroundPosition:case BackgroundPosition: never executed: case BackgroundPosition: | 0 | ||||||||||||||||||||||||
1010 | *alignment = decl.alignmentValue(); | - | ||||||||||||||||||||||||
1011 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1012 | case never executed: BackgroundOrigin:case BackgroundOrigin: never executed: case BackgroundOrigin: | 0 | ||||||||||||||||||||||||
1013 | *origin = decl.originValue(); | - | ||||||||||||||||||||||||
1014 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1015 | case never executed: BackgroundClip:case BackgroundClip: never executed: case BackgroundClip: | 0 | ||||||||||||||||||||||||
1016 | *clip = decl.originValue(); | - | ||||||||||||||||||||||||
1017 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1018 | case never executed: Background:case Background: never executed: case Background: | 0 | ||||||||||||||||||||||||
1019 | if (decl.d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1020 | BackgroundData data = qvariant_cast<BackgroundData>(decl.d->parsed); | - | ||||||||||||||||||||||||
1021 | *brush = brushFromData(data.brush, pal); | - | ||||||||||||||||||||||||
1022 | *image = data.image; | - | ||||||||||||||||||||||||
1023 | *repeat = data.repeat; | - | ||||||||||||||||||||||||
1024 | *alignment = data.alignment; | - | ||||||||||||||||||||||||
1025 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1026 | BrushData brushData; | - | ||||||||||||||||||||||||
1027 | parseShorthandBackgroundProperty(decl.d->values, &brushData, image, repeat, alignment, pal); | - | ||||||||||||||||||||||||
1028 | *brush = brushFromData(brushData, pal); | - | ||||||||||||||||||||||||
1029 | if (brushData.type != BrushData::DependsOnThePalette
| 0 | ||||||||||||||||||||||||
1030 | BackgroundData data = { brushData, *image, *repeat, *alignment }; | - | ||||||||||||||||||||||||
1031 | decl.d->parsed = QVariant::fromValue<BackgroundData>(data); | - | ||||||||||||||||||||||||
1032 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1033 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1034 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1035 | case never executed: BackgroundAttachment:case BackgroundAttachment: never executed: case BackgroundAttachment: | 0 | ||||||||||||||||||||||||
1036 | *attachment = decl.attachmentValue(); | - | ||||||||||||||||||||||||
1037 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1038 | default never executed: :default: never executed: continue;default: never executed: continue; | 0 | ||||||||||||||||||||||||
1039 | } | - | ||||||||||||||||||||||||
1040 | hit = true; | - | ||||||||||||||||||||||||
1041 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1042 | return never executed: hit;return hit; never executed: return hit; | 0 | ||||||||||||||||||||||||
1043 | } | - | ||||||||||||||||||||||||
1044 | - | |||||||||||||||||||||||||
1045 | static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAdjustment) | - | ||||||||||||||||||||||||
1046 | { | - | ||||||||||||||||||||||||
1047 | if (value.type == Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
1048 | bool valid = true; | - | ||||||||||||||||||||||||
1049 | switch (value.variant.toInt()) { | - | ||||||||||||||||||||||||
1050 | case never executed: Value_Small:case Value_Small: never executed: *fontSizeAdjustment = -1; break;case Value_Small: never executed: break; | 0 | ||||||||||||||||||||||||
1051 | case never executed: Value_Medium:case Value_Medium: never executed: *fontSizeAdjustment = 0; break;case Value_Medium: never executed: break; | 0 | ||||||||||||||||||||||||
1052 | case never executed: Value_Large:case Value_Large: never executed: *fontSizeAdjustment = 1; break;case Value_Large: never executed: break; | 0 | ||||||||||||||||||||||||
1053 | case never executed: Value_XLarge:case Value_XLarge: never executed: *fontSizeAdjustment = 2; break;case Value_XLarge: never executed: break; | 0 | ||||||||||||||||||||||||
1054 | case never executed: Value_XXLarge:case Value_XXLarge: never executed: *fontSizeAdjustment = 3; break;case Value_XXLarge: never executed: break; | 0 | ||||||||||||||||||||||||
1055 | default never executed: :default: never executed: valid = false; break;default: never executed: break; | 0 | ||||||||||||||||||||||||
1056 | } | - | ||||||||||||||||||||||||
1057 | return never executed: valid;return valid; never executed: return valid; | 0 | ||||||||||||||||||||||||
1058 | } | - | ||||||||||||||||||||||||
1059 | if (value.type != Value::Length
| 0 | ||||||||||||||||||||||||
1060 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1061 | - | |||||||||||||||||||||||||
1062 | bool valid = false; | - | ||||||||||||||||||||||||
1063 | QString s = value.variant.toString(); | - | ||||||||||||||||||||||||
1064 | if (s.endsWith(QLatin1String("pt"), Qt::CaseInsensitive)
| 0 | ||||||||||||||||||||||||
1065 | s.chop(2); | - | ||||||||||||||||||||||||
1066 | value.variant = s; | - | ||||||||||||||||||||||||
1067 | if (value.variant.convert((QVariant::Type)qMetaTypeId<qreal>())
| 0 | ||||||||||||||||||||||||
1068 | font->setPointSizeF(value.variant.toReal()); | - | ||||||||||||||||||||||||
1069 | valid = true; | - | ||||||||||||||||||||||||
1070 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1071 | } never executed: else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)end of block
| 0 | ||||||||||||||||||||||||
1072 | s.chop(2); | - | ||||||||||||||||||||||||
1073 | value.variant = s; | - | ||||||||||||||||||||||||
1074 | if (value.variant.convert(QVariant::Int)
| 0 | ||||||||||||||||||||||||
1075 | font->setPixelSize(value.variant.toInt()); | - | ||||||||||||||||||||||||
1076 | valid = true; | - | ||||||||||||||||||||||||
1077 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1078 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1079 | return never executed: valid;return valid; never executed: return valid; | 0 | ||||||||||||||||||||||||
1080 | } | - | ||||||||||||||||||||||||
1081 | - | |||||||||||||||||||||||||
1082 | static bool setFontStyleFromValue(const QCss::Value &value, QFont *font) | - | ||||||||||||||||||||||||
1083 | { | - | ||||||||||||||||||||||||
1084 | if (value.type != Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
1085 | return never executed: false ;return false ; never executed: return false ; | 0 | ||||||||||||||||||||||||
1086 | switch (value.variant.toInt()) { | - | ||||||||||||||||||||||||
1087 | case never executed: Value_Normal:case Value_Normal: never executed: font->setStyle(QFont::StyleNormal); returncase Value_Normal: never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1088 | case never executed: Value_Italic:case Value_Italic: never executed: font->setStyle(QFont::StyleItalic); returncase Value_Italic: never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1089 | case never executed: Value_Oblique:case Value_Oblique: never executed: font->setStyle(QFont::StyleOblique); returncase Value_Oblique: never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1090 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||||||||
1091 | } | - | ||||||||||||||||||||||||
1092 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1093 | } | - | ||||||||||||||||||||||||
1094 | - | |||||||||||||||||||||||||
1095 | static bool setFontWeightFromValue(const QCss::Value &value, QFont *font) | - | ||||||||||||||||||||||||
1096 | { | - | ||||||||||||||||||||||||
1097 | if (value.type == Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
1098 | switch (value.variant.toInt()) { | - | ||||||||||||||||||||||||
1099 | case never executed: Value_Normal:case Value_Normal: never executed: font->setWeight(QFont::Normal); returncase Value_Normal: never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1100 | case never executed: Value_Bold:case Value_Bold: never executed: font->setWeight(QFont::Bold); returncase Value_Bold: never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1101 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||||||||
1102 | } | - | ||||||||||||||||||||||||
1103 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1104 | } | - | ||||||||||||||||||||||||
1105 | if (value.type != Value::Number
| 0 | ||||||||||||||||||||||||
1106 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1107 | font->setWeight(qMin(value.variant.toInt() / 8, 99)); | - | ||||||||||||||||||||||||
1108 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1109 | } | - | ||||||||||||||||||||||||
1110 | - | |||||||||||||||||||||||||
1111 | - | |||||||||||||||||||||||||
1112 | - | |||||||||||||||||||||||||
1113 | - | |||||||||||||||||||||||||
1114 | - | |||||||||||||||||||||||||
1115 | - | |||||||||||||||||||||||||
1116 | static bool setFontFamilyFromValues(const QVector<QCss::Value> &values, QFont *font, int start = 0) | - | ||||||||||||||||||||||||
1117 | { | - | ||||||||||||||||||||||||
1118 | QString family; | - | ||||||||||||||||||||||||
1119 | bool shouldAddSpace = false; | - | ||||||||||||||||||||||||
1120 | for (int i = start; i < values.count()
| 0 | ||||||||||||||||||||||||
1121 | const QCss::Value &v = values.at(i); | - | ||||||||||||||||||||||||
1122 | if (v.type == Value::TermOperatorComma
| 0 | ||||||||||||||||||||||||
1123 | family += QLatin1Char(','); | - | ||||||||||||||||||||||||
1124 | shouldAddSpace = false; | - | ||||||||||||||||||||||||
1125 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1126 | } | - | ||||||||||||||||||||||||
1127 | const QString str = v.variant.toString(); | - | ||||||||||||||||||||||||
1128 | if (str.isEmpty()
| 0 | ||||||||||||||||||||||||
1129 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1130 | if (shouldAddSpace
| 0 | ||||||||||||||||||||||||
1131 | family += QLatin1Char(' '); never executed: family += QLatin1Char(' '); | 0 | ||||||||||||||||||||||||
1132 | family += str; | - | ||||||||||||||||||||||||
1133 | shouldAddSpace = true; | - | ||||||||||||||||||||||||
1134 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1135 | if (family.isEmpty()
| 0 | ||||||||||||||||||||||||
1136 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1137 | font->setFamily(family); | - | ||||||||||||||||||||||||
1138 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1139 | } | - | ||||||||||||||||||||||||
1140 | - | |||||||||||||||||||||||||
1141 | static void setTextDecorationFromValues(const QVector<QCss::Value> &values, QFont *font) | - | ||||||||||||||||||||||||
1142 | { | - | ||||||||||||||||||||||||
1143 | for (int i = 0; i < values.count()
| 0 | ||||||||||||||||||||||||
1144 | if (values.at(i).type != Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
1145 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1146 | switch (values.at(i).variant.toInt()) { | - | ||||||||||||||||||||||||
1147 | case never executed: Value_Underline:case Value_Underline: never executed: font->setUnderline(true); break;case Value_Underline: never executed: break; | 0 | ||||||||||||||||||||||||
1148 | case never executed: Value_Overline:case Value_Overline: never executed: font->setOverline(true); break;case Value_Overline: never executed: break; | 0 | ||||||||||||||||||||||||
1149 | case never executed: Value_LineThrough:case Value_LineThrough: never executed: font->setStrikeOut(true); break;case Value_LineThrough: never executed: break; | 0 | ||||||||||||||||||||||||
1150 | case never executed: Value_None:case Value_None: never executed: case Value_None: | 0 | ||||||||||||||||||||||||
1151 | font->setUnderline(false); | - | ||||||||||||||||||||||||
1152 | font->setOverline(false); | - | ||||||||||||||||||||||||
1153 | font->setStrikeOut(false); | - | ||||||||||||||||||||||||
1154 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1155 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||||||||
1156 | } | - | ||||||||||||||||||||||||
1157 | } | - | ||||||||||||||||||||||||
1158 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1159 | - | |||||||||||||||||||||||||
1160 | static void parseShorthandFontProperty(const QVector<QCss::Value> &values, QFont *font, int *fontSizeAdjustment) | - | ||||||||||||||||||||||||
1161 | { | - | ||||||||||||||||||||||||
1162 | font->setStyle(QFont::StyleNormal); | - | ||||||||||||||||||||||||
1163 | font->setWeight(QFont::Normal); | - | ||||||||||||||||||||||||
1164 | *fontSizeAdjustment = -255; | - | ||||||||||||||||||||||||
1165 | - | |||||||||||||||||||||||||
1166 | int i = 0; | - | ||||||||||||||||||||||||
1167 | while (i < values.count()
| 0 | ||||||||||||||||||||||||
1168 | if (setFontStyleFromValue(values.at(i), font)
| 0 | ||||||||||||||||||||||||
1169 | || setFontWeightFromValue(values.at(i), font)
| 0 | ||||||||||||||||||||||||
1170 | ++ never executed: i;++i; never executed: ++i; | 0 | ||||||||||||||||||||||||
1171 | else | - | ||||||||||||||||||||||||
1172 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1173 | } | - | ||||||||||||||||||||||||
1174 | - | |||||||||||||||||||||||||
1175 | if (i < values.count()
| 0 | ||||||||||||||||||||||||
1176 | setFontSizeFromValue(values.at(i), font, fontSizeAdjustment); | - | ||||||||||||||||||||||||
1177 | ++i; | - | ||||||||||||||||||||||||
1178 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1179 | - | |||||||||||||||||||||||||
1180 | if (i < values.count()
| 0 | ||||||||||||||||||||||||
1181 | setFontFamilyFromValues(values, font, i); | - | ||||||||||||||||||||||||
1182 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1183 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1184 | - | |||||||||||||||||||||||||
1185 | static void setFontVariantFromValue(const QCss::Value &value, QFont *font) | - | ||||||||||||||||||||||||
1186 | { | - | ||||||||||||||||||||||||
1187 | if (value.type == Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
1188 | switch (value.variant.toInt()) { | - | ||||||||||||||||||||||||
1189 | case never executed: Value_Normal:case Value_Normal: never executed: font->setCapitalization(QFont::MixedCase); break;case Value_Normal: never executed: break; | 0 | ||||||||||||||||||||||||
1190 | case never executed: Value_SmallCaps:case Value_SmallCaps: never executed: font->setCapitalization(QFont::SmallCaps); break;case Value_SmallCaps: never executed: break; | 0 | ||||||||||||||||||||||||
1191 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||||||||
1192 | } | - | ||||||||||||||||||||||||
1193 | } | - | ||||||||||||||||||||||||
1194 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1195 | - | |||||||||||||||||||||||||
1196 | static void setTextTransformFromValue(const QCss::Value &value, QFont *font) | - | ||||||||||||||||||||||||
1197 | { | - | ||||||||||||||||||||||||
1198 | if (value.type == Value::KnownIdentifier
| 0 | ||||||||||||||||||||||||
1199 | switch (value.variant.toInt()) { | - | ||||||||||||||||||||||||
1200 | case never executed: Value_None:case Value_None: never executed: font->setCapitalization(QFont::MixedCase); break;case Value_None: never executed: break; | 0 | ||||||||||||||||||||||||
1201 | case never executed: Value_Uppercase:case Value_Uppercase: never executed: font->setCapitalization(QFont::AllUppercase); break;case Value_Uppercase: never executed: break; | 0 | ||||||||||||||||||||||||
1202 | case never executed: Value_Lowercase:case Value_Lowercase: never executed: font->setCapitalization(QFont::AllLowercase); break;case Value_Lowercase: never executed: break; | 0 | ||||||||||||||||||||||||
1203 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||||||||
1204 | } | - | ||||||||||||||||||||||||
1205 | } | - | ||||||||||||||||||||||||
1206 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1207 | - | |||||||||||||||||||||||||
1208 | bool ValueExtractor::extractFont(QFont *font, int *fontSizeAdjustment) | - | ||||||||||||||||||||||||
1209 | { | - | ||||||||||||||||||||||||
1210 | if (fontExtracted
| 0 | ||||||||||||||||||||||||
1211 | *font = f; | - | ||||||||||||||||||||||||
1212 | *fontSizeAdjustment = adjustment; | - | ||||||||||||||||||||||||
1213 | return never executed: fontExtracted == 1;return fontExtracted == 1; never executed: return fontExtracted == 1; | 0 | ||||||||||||||||||||||||
1214 | } | - | ||||||||||||||||||||||||
1215 | - | |||||||||||||||||||||||||
1216 | bool hit = false; | - | ||||||||||||||||||||||||
1217 | for (int i = 0; i < declarations.count()
| 0 | ||||||||||||||||||||||||
1218 | const Declaration &decl = declarations.at(i); | - | ||||||||||||||||||||||||
1219 | if (decl.d->values.isEmpty()
| 0 | ||||||||||||||||||||||||
1220 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1221 | const QCss::Value &val = decl.d->values.at(0); | - | ||||||||||||||||||||||||
1222 | switch (decl.d->propertyId) { | - | ||||||||||||||||||||||||
1223 | case never executed: FontSize:case FontSize: never executed: setFontSizeFromValue(val, font, fontSizeAdjustment); break;case FontSize: never executed: break; | 0 | ||||||||||||||||||||||||
1224 | case never executed: FontStyle:case FontStyle: never executed: setFontStyleFromValue(val, font); break;case FontStyle: never executed: break; | 0 | ||||||||||||||||||||||||
1225 | case never executed: FontWeight:case FontWeight: never executed: setFontWeightFromValue(val, font); break;case FontWeight: never executed: break; | 0 | ||||||||||||||||||||||||
1226 | case never executed: FontFamily:case FontFamily: never executed: setFontFamilyFromValues(decl.d->values, font); break;case FontFamily: never executed: break; | 0 | ||||||||||||||||||||||||
1227 | case never executed: TextDecoration:case TextDecoration: never executed: setTextDecorationFromValues(decl.d->values, font); break;case TextDecoration: never executed: break; | 0 | ||||||||||||||||||||||||
1228 | case never executed: Font:case Font: never executed: parseShorthandFontProperty(decl.d->values, font, fontSizeAdjustment); break;case Font: never executed: break; | 0 | ||||||||||||||||||||||||
1229 | case never executed: FontVariant:case FontVariant: never executed: setFontVariantFromValue(val, font); break;case FontVariant: never executed: break; | 0 | ||||||||||||||||||||||||
1230 | case never executed: TextTransform:case TextTransform: never executed: setTextTransformFromValue(val, font); break;case TextTransform: never executed: break; | 0 | ||||||||||||||||||||||||
1231 | default never executed: :default: never executed: continue;default: never executed: continue; | 0 | ||||||||||||||||||||||||
1232 | } | - | ||||||||||||||||||||||||
1233 | hit = true; | - | ||||||||||||||||||||||||
1234 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1235 | - | |||||||||||||||||||||||||
1236 | f = *font; | - | ||||||||||||||||||||||||
1237 | adjustment = *fontSizeAdjustment; | - | ||||||||||||||||||||||||
1238 | fontExtracted = hit
| 0 | ||||||||||||||||||||||||
1239 | return never executed: hit;return hit; never executed: return hit; | 0 | ||||||||||||||||||||||||
1240 | } | - | ||||||||||||||||||||||||
1241 | - | |||||||||||||||||||||||||
1242 | bool ValueExtractor::extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg) | - | ||||||||||||||||||||||||
1243 | { | - | ||||||||||||||||||||||||
1244 | bool hit = false; | - | ||||||||||||||||||||||||
1245 | for (int i = 0; i < declarations.count()
| 0 | ||||||||||||||||||||||||
1246 | const Declaration &decl = declarations.at(i); | - | ||||||||||||||||||||||||
1247 | switch (decl.d->propertyId) { | - | ||||||||||||||||||||||||
1248 | case never executed: Color:case Color: never executed: *fg = decl.brushValue(pal); break;case Color: never executed: break; | 0 | ||||||||||||||||||||||||
1249 | case never executed: QtSelectionForeground:case QtSelectionForeground: never executed: *sfg = decl.brushValue(pal); break;case QtSelectionForeground: never executed: break; | 0 | ||||||||||||||||||||||||
1250 | case never executed: QtSelectionBackground:case QtSelectionBackground: never executed: *sbg = decl.brushValue(pal); break;case QtSelectionBackground: never executed: break; | 0 | ||||||||||||||||||||||||
1251 | case never executed: QtAlternateBackground:case QtAlternateBackground: never executed: *abg = decl.brushValue(pal); break;case QtAlternateBackground: never executed: break; | 0 | ||||||||||||||||||||||||
1252 | default never executed: :default: never executed: continue;default: never executed: continue; | 0 | ||||||||||||||||||||||||
1253 | } | - | ||||||||||||||||||||||||
1254 | hit = true; | - | ||||||||||||||||||||||||
1255 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1256 | return never executed: hit;return hit; never executed: return hit; | 0 | ||||||||||||||||||||||||
1257 | } | - | ||||||||||||||||||||||||
1258 | - | |||||||||||||||||||||||||
1259 | void ValueExtractor::extractFont() | - | ||||||||||||||||||||||||
1260 | { | - | ||||||||||||||||||||||||
1261 | if (fontExtracted
| 0 | ||||||||||||||||||||||||
1262 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1263 | int dummy = -255; | - | ||||||||||||||||||||||||
1264 | extractFont(&f, &dummy); | - | ||||||||||||||||||||||||
1265 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1266 | - | |||||||||||||||||||||||||
1267 | bool ValueExtractor::extractImage(QIcon *icon, Qt::Alignment *a, QSize *size) | - | ||||||||||||||||||||||||
1268 | { | - | ||||||||||||||||||||||||
1269 | bool hit = false; | - | ||||||||||||||||||||||||
1270 | for (int i = 0; i < declarations.count()
| 0 | ||||||||||||||||||||||||
1271 | const Declaration &decl = declarations.at(i); | - | ||||||||||||||||||||||||
1272 | switch (decl.d->propertyId) { | - | ||||||||||||||||||||||||
1273 | case never executed: QtImage:case QtImage: never executed: case QtImage: | 0 | ||||||||||||||||||||||||
1274 | *icon = decl.iconValue(); | - | ||||||||||||||||||||||||
1275 | if (decl.d->values.count() > 0
| 0 | ||||||||||||||||||||||||
1276 | - | |||||||||||||||||||||||||
1277 | QImageReader imageReader(decl.d->values.at(0).variant.toString()); | - | ||||||||||||||||||||||||
1278 | if ((*
| 0 | ||||||||||||||||||||||||
1279 | - | |||||||||||||||||||||||||
1280 | - | |||||||||||||||||||||||||
1281 | *size = imageReader.read().size(); | - | ||||||||||||||||||||||||
1282 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1283 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1284 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1285 | case never executed: QtImageAlignment:case QtImageAlignment: never executed: *a = decl.alignmentValue(); break;case QtImageAlignment: never executed: break; | 0 | ||||||||||||||||||||||||
1286 | default never executed: :default: never executed: continue;default: never executed: continue; | 0 | ||||||||||||||||||||||||
1287 | } | - | ||||||||||||||||||||||||
1288 | hit = true; | - | ||||||||||||||||||||||||
1289 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1290 | return never executed: hit;return hit; never executed: return hit; | 0 | ||||||||||||||||||||||||
1291 | } | - | ||||||||||||||||||||||||
1292 | - | |||||||||||||||||||||||||
1293 | - | |||||||||||||||||||||||||
1294 | - | |||||||||||||||||||||||||
1295 | QColor Declaration::colorValue(const QPalette &pal) const | - | ||||||||||||||||||||||||
1296 | { | - | ||||||||||||||||||||||||
1297 | if (d->values.count() != 1
| 0 | ||||||||||||||||||||||||
1298 | return never executed: QColor();return QColor(); never executed: return QColor(); | 0 | ||||||||||||||||||||||||
1299 | - | |||||||||||||||||||||||||
1300 | if (d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1301 | if (d->parsed.type() == QVariant::Color
| 0 | ||||||||||||||||||||||||
1302 | return never executed: qvariant_cast<QColor>(d->parsed);return qvariant_cast<QColor>(d->parsed); never executed: return qvariant_cast<QColor>(d->parsed); | 0 | ||||||||||||||||||||||||
1303 | if (d->parsed.type() == QVariant::Int
| 0 | ||||||||||||||||||||||||
1304 | return never executed: pal.color((QPalette::ColorRole)(d->parsed.toInt()));return pal.color((QPalette::ColorRole)(d->parsed.toInt())); never executed: return pal.color((QPalette::ColorRole)(d->parsed.toInt())); | 0 | ||||||||||||||||||||||||
1305 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1306 | - | |||||||||||||||||||||||||
1307 | ColorData color = parseColorValue(d->values.at(0)); | - | ||||||||||||||||||||||||
1308 | if(color.type == ColorData::Role
| 0 | ||||||||||||||||||||||||
1309 | d->parsed = QVariant::fromValue<int>(color.role); | - | ||||||||||||||||||||||||
1310 | return never executed: pal.color((QPalette::ColorRole)(color.role));return pal.color((QPalette::ColorRole)(color.role)); never executed: return pal.color((QPalette::ColorRole)(color.role)); | 0 | ||||||||||||||||||||||||
1311 | } else { | - | ||||||||||||||||||||||||
1312 | d->parsed = QVariant::fromValue<QColor>(color.color); | - | ||||||||||||||||||||||||
1313 | return never executed: color.color;return color.color; never executed: return color.color; | 0 | ||||||||||||||||||||||||
1314 | } | - | ||||||||||||||||||||||||
1315 | } | - | ||||||||||||||||||||||||
1316 | - | |||||||||||||||||||||||||
1317 | QBrush Declaration::brushValue(const QPalette &pal) const | - | ||||||||||||||||||||||||
1318 | { | - | ||||||||||||||||||||||||
1319 | if (d->values.count() != 1
| 0 | ||||||||||||||||||||||||
1320 | return never executed: QBrush();return QBrush(); never executed: return QBrush(); | 0 | ||||||||||||||||||||||||
1321 | - | |||||||||||||||||||||||||
1322 | if (d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1323 | if (d->parsed.type() == QVariant::Brush
| 0 | ||||||||||||||||||||||||
1324 | return never executed: qvariant_cast<QBrush>(d->parsed);return qvariant_cast<QBrush>(d->parsed); never executed: return qvariant_cast<QBrush>(d->parsed); | 0 | ||||||||||||||||||||||||
1325 | if (d->parsed.type() == QVariant::Int
| 0 | ||||||||||||||||||||||||
1326 | return never executed: pal.color((QPalette::ColorRole)(d->parsed.toInt()));return pal.color((QPalette::ColorRole)(d->parsed.toInt())); never executed: return pal.color((QPalette::ColorRole)(d->parsed.toInt())); | 0 | ||||||||||||||||||||||||
1327 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1328 | - | |||||||||||||||||||||||||
1329 | BrushData data = parseBrushValue(d->values.at(0), pal); | - | ||||||||||||||||||||||||
1330 | - | |||||||||||||||||||||||||
1331 | if(data.type == BrushData::Role
| 0 | ||||||||||||||||||||||||
1332 | d->parsed = QVariant::fromValue<int>(data.role); | - | ||||||||||||||||||||||||
1333 | return never executed: pal.color((QPalette::ColorRole)(data.role));return pal.color((QPalette::ColorRole)(data.role)); never executed: return pal.color((QPalette::ColorRole)(data.role)); | 0 | ||||||||||||||||||||||||
1334 | } else { | - | ||||||||||||||||||||||||
1335 | if (data.type != BrushData::DependsOnThePalette
| 0 | ||||||||||||||||||||||||
1336 | d->parsed = QVariant::fromValue<QBrush>(data.brush); never executed: d->parsed = QVariant::fromValue<QBrush>(data.brush); | 0 | ||||||||||||||||||||||||
1337 | return never executed: data.brush;return data.brush; never executed: return data.brush; | 0 | ||||||||||||||||||||||||
1338 | } | - | ||||||||||||||||||||||||
1339 | } | - | ||||||||||||||||||||||||
1340 | - | |||||||||||||||||||||||||
1341 | void Declaration::brushValues(QBrush *c, const QPalette &pal) const | - | ||||||||||||||||||||||||
1342 | { | - | ||||||||||||||||||||||||
1343 | int needParse = 0x1f; | - | ||||||||||||||||||||||||
1344 | - | |||||||||||||||||||||||||
1345 | int i = 0; | - | ||||||||||||||||||||||||
1346 | if (d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1347 | needParse = 0; | - | ||||||||||||||||||||||||
1348 | QList<QVariant> v = d->parsed.toList(); | - | ||||||||||||||||||||||||
1349 | for (i = 0; i < qMin(v.count(), 4)
| 0 | ||||||||||||||||||||||||
1350 | if (v.at(i).type() == QVariant::Brush
| 0 | ||||||||||||||||||||||||
1351 | c[i] = qvariant_cast<QBrush>(v.at(i)); | - | ||||||||||||||||||||||||
1352 | } never executed: else if (v.at(i).type() == QVariant::Intend of block
| 0 | ||||||||||||||||||||||||
1353 | c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt())); | - | ||||||||||||||||||||||||
1354 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1355 | needParse |= (1<<i); | - | ||||||||||||||||||||||||
1356 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1357 | } | - | ||||||||||||||||||||||||
1358 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1359 | if (needParse != 0
| 0 | ||||||||||||||||||||||||
1360 | QList<QVariant> v; | - | ||||||||||||||||||||||||
1361 | for (i = 0; i < qMin(d->values.count(), 4)
| 0 | ||||||||||||||||||||||||
1362 | if (!(needParse & (1<<i))
| 0 | ||||||||||||||||||||||||
1363 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1364 | BrushData data = parseBrushValue(d->values.at(i), pal); | - | ||||||||||||||||||||||||
1365 | if(data.type == BrushData::Role
| 0 | ||||||||||||||||||||||||
1366 | v += QVariant::fromValue<int>(data.role); | - | ||||||||||||||||||||||||
1367 | c[i] = pal.color((QPalette::ColorRole)(data.role)); | - | ||||||||||||||||||||||||
1368 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1369 | if (data.type != BrushData::DependsOnThePalette
| 0 | ||||||||||||||||||||||||
1370 | v += QVariant::fromValue<QBrush>(data.brush); | - | ||||||||||||||||||||||||
1371 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1372 | v += QVariant(); | - | ||||||||||||||||||||||||
1373 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1374 | c[i] = data.brush; | - | ||||||||||||||||||||||||
1375 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1376 | } | - | ||||||||||||||||||||||||
1377 | if (needParse & 0x10
| 0 | ||||||||||||||||||||||||
1378 | d->parsed = v; never executed: d->parsed = v; | 0 | ||||||||||||||||||||||||
1379 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1380 | if (i == 0
never executed: c[0] = c[1] = c[2] = c[3] = QBrush(); | 0 | ||||||||||||||||||||||||
1381 | else if (i == 1
never executed: c[3] = c[2] = c[1] = c[0]; | 0 | ||||||||||||||||||||||||
1382 | else if (i == 2
never executed: c[2] = c[0], c[3] = c[1]; | 0 | ||||||||||||||||||||||||
1383 | else if (i == 3
never executed: c[3] = c[1]; | 0 | ||||||||||||||||||||||||
1384 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1385 | - | |||||||||||||||||||||||||
1386 | bool Declaration::realValue(qreal *real, const char *unit) const | - | ||||||||||||||||||||||||
1387 | { | - | ||||||||||||||||||||||||
1388 | if (d->values.count() != 1
| 0 | ||||||||||||||||||||||||
1389 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1390 | const Value &v = d->values.at(0); | - | ||||||||||||||||||||||||
1391 | if (unit
| 0 | ||||||||||||||||||||||||
1392 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1393 | QString s = v.variant.toString(); | - | ||||||||||||||||||||||||
1394 | if (unit
| 0 | ||||||||||||||||||||||||
1395 | if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive)
| 0 | ||||||||||||||||||||||||
1396 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1397 | s.chop(qstrlen(unit)); | - | ||||||||||||||||||||||||
1398 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1399 | bool ok = false; | - | ||||||||||||||||||||||||
1400 | qreal val = s.toDouble(&ok); | - | ||||||||||||||||||||||||
1401 | if (ok
| 0 | ||||||||||||||||||||||||
1402 | * never executed: real = val;*real = val; never executed: *real = val; | 0 | ||||||||||||||||||||||||
1403 | return never executed: ok;return ok; never executed: return ok; | 0 | ||||||||||||||||||||||||
1404 | } | - | ||||||||||||||||||||||||
1405 | - | |||||||||||||||||||||||||
1406 | static bool intValueHelper(const QCss::Value &v, int *i, const char *unit) | - | ||||||||||||||||||||||||
1407 | { | - | ||||||||||||||||||||||||
1408 | if (unit
| 0 | ||||||||||||||||||||||||
1409 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1410 | QString s = v.variant.toString(); | - | ||||||||||||||||||||||||
1411 | if (unit
| 0 | ||||||||||||||||||||||||
1412 | if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive)
| 0 | ||||||||||||||||||||||||
1413 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1414 | s.chop(qstrlen(unit)); | - | ||||||||||||||||||||||||
1415 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1416 | bool ok = false; | - | ||||||||||||||||||||||||
1417 | int val = s.toInt(&ok); | - | ||||||||||||||||||||||||
1418 | if (ok
| 0 | ||||||||||||||||||||||||
1419 | * never executed: i = val;*i = val; never executed: *i = val; | 0 | ||||||||||||||||||||||||
1420 | return never executed: ok;return ok; never executed: return ok; | 0 | ||||||||||||||||||||||||
1421 | } | - | ||||||||||||||||||||||||
1422 | - | |||||||||||||||||||||||||
1423 | bool Declaration::intValue(int *i, const char *unit) const | - | ||||||||||||||||||||||||
1424 | { | - | ||||||||||||||||||||||||
1425 | if (d->values.count() != 1
| 0 | ||||||||||||||||||||||||
1426 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1427 | return never executed: intValueHelper(d->values.at(0), i, unit);return intValueHelper(d->values.at(0), i, unit); never executed: return intValueHelper(d->values.at(0), i, unit); | 0 | ||||||||||||||||||||||||
1428 | } | - | ||||||||||||||||||||||||
1429 | - | |||||||||||||||||||||||||
1430 | QSize Declaration::sizeValue() const | - | ||||||||||||||||||||||||
1431 | { | - | ||||||||||||||||||||||||
1432 | if (d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1433 | return never executed: qvariant_cast<QSize>(d->parsed);return qvariant_cast<QSize>(d->parsed); never executed: return qvariant_cast<QSize>(d->parsed); | 0 | ||||||||||||||||||||||||
1434 | - | |||||||||||||||||||||||||
1435 | int x[2] = { 0, 0 }; | - | ||||||||||||||||||||||||
1436 | if (d->values.count() > 0
| 0 | ||||||||||||||||||||||||
1437 | intValueHelper(d->values.at(0), &x[0], "px"); never executed: intValueHelper(d->values.at(0), &x[0], "px"); | 0 | ||||||||||||||||||||||||
1438 | if (d->values.count() > 1
| 0 | ||||||||||||||||||||||||
1439 | intValueHelper(d->values.at(1), &x[1], "px"); never executed: intValueHelper(d->values.at(1), &x[1], "px"); | 0 | ||||||||||||||||||||||||
1440 | else | - | ||||||||||||||||||||||||
1441 | x[1] = x[0]; never executed: x[1] = x[0]; | 0 | ||||||||||||||||||||||||
1442 | QSize size(x[0], x[1]); | - | ||||||||||||||||||||||||
1443 | d->parsed = QVariant::fromValue<QSize>(size); | - | ||||||||||||||||||||||||
1444 | return never executed: size;return size; never executed: return size; | 0 | ||||||||||||||||||||||||
1445 | } | - | ||||||||||||||||||||||||
1446 | - | |||||||||||||||||||||||||
1447 | QRect Declaration::rectValue() const | - | ||||||||||||||||||||||||
1448 | { | - | ||||||||||||||||||||||||
1449 | if (d->values.count() != 1
| 0 | ||||||||||||||||||||||||
1450 | return never executed: QRect();return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||
1451 | - | |||||||||||||||||||||||||
1452 | if (d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1453 | return never executed: qvariant_cast<QRect>(d->parsed);return qvariant_cast<QRect>(d->parsed); never executed: return qvariant_cast<QRect>(d->parsed); | 0 | ||||||||||||||||||||||||
1454 | - | |||||||||||||||||||||||||
1455 | const QCss::Value &v = d->values.at(0); | - | ||||||||||||||||||||||||
1456 | if (v.type != Value::Function
| 0 | ||||||||||||||||||||||||
1457 | return never executed: QRect();return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||
1458 | const QStringList func = v.variant.toStringList(); | - | ||||||||||||||||||||||||
1459 | if (func.count() != 2
| 0 | ||||||||||||||||||||||||
1460 | return never executed: QRect();return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||
1461 | const auto args = func[1].splitRef(QLatin1Char(' '), QString::SkipEmptyParts); | - | ||||||||||||||||||||||||
1462 | if (args.count() != 4
| 0 | ||||||||||||||||||||||||
1463 | return never executed: QRect();return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||
1464 | QRect rect(args[0].toInt(), args[1].toInt(), args[2].toInt(), args[3].toInt()); | - | ||||||||||||||||||||||||
1465 | d->parsed = QVariant::fromValue<QRect>(rect); | - | ||||||||||||||||||||||||
1466 | return never executed: rect;return rect; never executed: return rect; | 0 | ||||||||||||||||||||||||
1467 | } | - | ||||||||||||||||||||||||
1468 | - | |||||||||||||||||||||||||
1469 | void Declaration::colorValues(QColor *c, const QPalette &pal) const | - | ||||||||||||||||||||||||
1470 | { | - | ||||||||||||||||||||||||
1471 | int i; | - | ||||||||||||||||||||||||
1472 | if (d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1473 | QList<QVariant> v = d->parsed.toList(); | - | ||||||||||||||||||||||||
1474 | for (i = 0; i < qMin(d->values.count(), 4)
| 0 | ||||||||||||||||||||||||
1475 | if (v.at(i).type() == QVariant::Color
| 0 | ||||||||||||||||||||||||
1476 | c[i] = qvariant_cast<QColor>(v.at(i)); | - | ||||||||||||||||||||||||
1477 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1478 | c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt())); | - | ||||||||||||||||||||||||
1479 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1480 | } | - | ||||||||||||||||||||||||
1481 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1482 | QList<QVariant> v; | - | ||||||||||||||||||||||||
1483 | for (i = 0; i < qMin(d->values.count(), 4)
| 0 | ||||||||||||||||||||||||
1484 | ColorData color = parseColorValue(d->values.at(i)); | - | ||||||||||||||||||||||||
1485 | if(color.type == ColorData::Role
| 0 | ||||||||||||||||||||||||
1486 | v += QVariant::fromValue<int>(color.role); | - | ||||||||||||||||||||||||
1487 | c[i] = pal.color((QPalette::ColorRole)(color.role)); | - | ||||||||||||||||||||||||
1488 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1489 | v += QVariant::fromValue<QColor>(color.color); | - | ||||||||||||||||||||||||
1490 | c[i] = color.color; | - | ||||||||||||||||||||||||
1491 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1492 | } | - | ||||||||||||||||||||||||
1493 | d->parsed = v; | - | ||||||||||||||||||||||||
1494 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1495 | - | |||||||||||||||||||||||||
1496 | if (i == 0
never executed: c[0] = c[1] = c[2] = c[3] = QColor(); | 0 | ||||||||||||||||||||||||
1497 | else if (i == 1
never executed: c[3] = c[2] = c[1] = c[0]; | 0 | ||||||||||||||||||||||||
1498 | else if (i == 2
never executed: c[2] = c[0], c[3] = c[1]; | 0 | ||||||||||||||||||||||||
1499 | else if (i == 3
never executed: c[3] = c[1]; | 0 | ||||||||||||||||||||||||
1500 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1501 | - | |||||||||||||||||||||||||
1502 | BorderStyle Declaration::styleValue() const | - | ||||||||||||||||||||||||
1503 | { | - | ||||||||||||||||||||||||
1504 | if (d->values.count() != 1
| 0 | ||||||||||||||||||||||||
1505 | return never executed: BorderStyle_None;return BorderStyle_None; never executed: return BorderStyle_None; | 0 | ||||||||||||||||||||||||
1506 | return never executed: parseStyleValue(d->values.at(0));return parseStyleValue(d->values.at(0)); never executed: return parseStyleValue(d->values.at(0)); | 0 | ||||||||||||||||||||||||
1507 | } | - | ||||||||||||||||||||||||
1508 | - | |||||||||||||||||||||||||
1509 | void Declaration::styleValues(BorderStyle *s) const | - | ||||||||||||||||||||||||
1510 | { | - | ||||||||||||||||||||||||
1511 | int i; | - | ||||||||||||||||||||||||
1512 | for (i = 0; i < qMin(d->values.count(), 4)
| 0 | ||||||||||||||||||||||||
1513 | s[i] = parseStyleValue(d->values.at(i)); never executed: s[i] = parseStyleValue(d->values.at(i)); | 0 | ||||||||||||||||||||||||
1514 | if (i == 0
never executed: s[0] = s[1] = s[2] = s[3] = BorderStyle_None; | 0 | ||||||||||||||||||||||||
1515 | else if (i == 1
never executed: s[3] = s[2] = s[1] = s[0]; | 0 | ||||||||||||||||||||||||
1516 | else if (i == 2
never executed: s[2] = s[0], s[3] = s[1]; | 0 | ||||||||||||||||||||||||
1517 | else if (i == 3
never executed: s[3] = s[1]; | 0 | ||||||||||||||||||||||||
1518 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1519 | - | |||||||||||||||||||||||||
1520 | Repeat Declaration::repeatValue() const | - | ||||||||||||||||||||||||
1521 | { | - | ||||||||||||||||||||||||
1522 | if (d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1523 | return never executed: static_cast<Repeat>(d->parsed.toInt());return static_cast<Repeat>(d->parsed.toInt()); never executed: return static_cast<Repeat>(d->parsed.toInt()); | 0 | ||||||||||||||||||||||||
1524 | if (d->values.count() != 1
| 0 | ||||||||||||||||||||||||
1525 | return never executed: Repeat_Unknown;return Repeat_Unknown; never executed: return Repeat_Unknown; | 0 | ||||||||||||||||||||||||
1526 | int v = findKnownValue(d->values.at(0).variant.toString(), | - | ||||||||||||||||||||||||
1527 | repeats, NumKnownRepeats); | - | ||||||||||||||||||||||||
1528 | d->parsed = v; | - | ||||||||||||||||||||||||
1529 | return never executed: static_cast<Repeat>(v);return static_cast<Repeat>(v); never executed: return static_cast<Repeat>(v); | 0 | ||||||||||||||||||||||||
1530 | } | - | ||||||||||||||||||||||||
1531 | - | |||||||||||||||||||||||||
1532 | Origin Declaration::originValue() const | - | ||||||||||||||||||||||||
1533 | { | - | ||||||||||||||||||||||||
1534 | if (d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1535 | return never executed: static_cast<Origin>(d->parsed.toInt());return static_cast<Origin>(d->parsed.toInt()); never executed: return static_cast<Origin>(d->parsed.toInt()); | 0 | ||||||||||||||||||||||||
1536 | if (d->values.count() != 1
| 0 | ||||||||||||||||||||||||
1537 | return never executed: Origin_Unknown;return Origin_Unknown; never executed: return Origin_Unknown; | 0 | ||||||||||||||||||||||||
1538 | int v = findKnownValue(d->values.at(0).variant.toString(), | - | ||||||||||||||||||||||||
1539 | origins, NumKnownOrigins); | - | ||||||||||||||||||||||||
1540 | d->parsed = v; | - | ||||||||||||||||||||||||
1541 | return never executed: static_cast<Origin>(v);return static_cast<Origin>(v); never executed: return static_cast<Origin>(v); | 0 | ||||||||||||||||||||||||
1542 | } | - | ||||||||||||||||||||||||
1543 | - | |||||||||||||||||||||||||
1544 | PositionMode Declaration::positionValue() const | - | ||||||||||||||||||||||||
1545 | { | - | ||||||||||||||||||||||||
1546 | if (d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1547 | return never executed: static_cast<PositionMode>(d->parsed.toInt());return static_cast<PositionMode>(d->parsed.toInt()); never executed: return static_cast<PositionMode>(d->parsed.toInt()); | 0 | ||||||||||||||||||||||||
1548 | if (d->values.count() != 1
| 0 | ||||||||||||||||||||||||
1549 | return never executed: PositionMode_Unknown;return PositionMode_Unknown; never executed: return PositionMode_Unknown; | 0 | ||||||||||||||||||||||||
1550 | int v = findKnownValue(d->values.at(0).variant.toString(), | - | ||||||||||||||||||||||||
1551 | positions, NumKnownPositionModes); | - | ||||||||||||||||||||||||
1552 | d->parsed = v; | - | ||||||||||||||||||||||||
1553 | return never executed: static_cast<PositionMode>(v);return static_cast<PositionMode>(v); never executed: return static_cast<PositionMode>(v); | 0 | ||||||||||||||||||||||||
1554 | } | - | ||||||||||||||||||||||||
1555 | - | |||||||||||||||||||||||||
1556 | Attachment Declaration::attachmentValue() const | - | ||||||||||||||||||||||||
1557 | { | - | ||||||||||||||||||||||||
1558 | if (d->parsed.isValid()
| 0 | ||||||||||||||||||||||||
1559 | return never executed: static_cast<Attachment>(d->parsed.toInt());return static_cast<Attachment>(d->parsed.toInt()); never executed:
|