text/qcssparser.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qcssparser_p.h" -
43 -
44#include <qdebug.h> -
45#include <qicon.h> -
46#include <qcolor.h> -
47#include <qfont.h> -
48#include <qfileinfo.h> -
49#include <qfontmetrics.h> -
50#include <qbrush.h> -
51#include <qimagereader.h> -
52#include "private/qfunctions_p.h" -
53 -
54#ifndef QT_NO_CSSPARSER -
55 -
56QT_BEGIN_NAMESPACE -
57 -
58#include "qcssscanner.cpp" -
59 -
60using namespace QCss; -
61 -
62struct QCssKnownValue -
63{ -
64 const char *name; -
65 quint64 id; -
66}; -
67 -
68static const QCssKnownValue properties[NumProperties - 1] = { -
69 { "-qt-background-role", QtBackgroundRole }, -
70 { "-qt-block-indent", QtBlockIndent }, -
71 { "-qt-list-indent", QtListIndent }, -
72 { "-qt-list-number-prefix", QtListNumberPrefix }, -
73 { "-qt-list-number-suffix", QtListNumberSuffix }, -
74 { "-qt-paragraph-type", QtParagraphType }, -
75 { "-qt-style-features", QtStyleFeatures }, -
76 { "-qt-table-type", QtTableType }, -
77 { "-qt-user-state", QtUserState }, -
78 { "alternate-background-color", QtAlternateBackground }, -
79 { "background", Background }, -
80 { "background-attachment", BackgroundAttachment }, -
81 { "background-clip", BackgroundClip }, -
82 { "background-color", BackgroundColor }, -
83 { "background-image", BackgroundImage }, -
84 { "background-origin", BackgroundOrigin }, -
85 { "background-position", BackgroundPosition }, -
86 { "background-repeat", BackgroundRepeat }, -
87 { "border", Border }, -
88 { "border-bottom", BorderBottom }, -
89 { "border-bottom-color", BorderBottomColor }, -
90 { "border-bottom-left-radius", BorderBottomLeftRadius }, -
91 { "border-bottom-right-radius", BorderBottomRightRadius }, -
92 { "border-bottom-style", BorderBottomStyle }, -
93 { "border-bottom-width", BorderBottomWidth }, -
94 { "border-color", BorderColor }, -
95 { "border-image", BorderImage }, -
96 { "border-left", BorderLeft }, -
97 { "border-left-color", BorderLeftColor }, -
98 { "border-left-style", BorderLeftStyle }, -
99 { "border-left-width", BorderLeftWidth }, -
100 { "border-radius", BorderRadius }, -
101 { "border-right", BorderRight }, -
102 { "border-right-color", BorderRightColor }, -
103 { "border-right-style", BorderRightStyle }, -
104 { "border-right-width", BorderRightWidth }, -
105 { "border-style", BorderStyles }, -
106 { "border-top", BorderTop }, -
107 { "border-top-color", BorderTopColor }, -
108 { "border-top-left-radius", BorderTopLeftRadius }, -
109 { "border-top-right-radius", BorderTopRightRadius }, -
110 { "border-top-style", BorderTopStyle }, -
111 { "border-top-width", BorderTopWidth }, -
112 { "border-width", BorderWidth }, -
113 { "bottom", Bottom }, -
114 { "color", Color }, -
115 { "float", Float }, -
116 { "font", Font }, -
117 { "font-family", FontFamily }, -
118 { "font-size", FontSize }, -
119 { "font-style", FontStyle }, -
120 { "font-variant", FontVariant }, -
121 { "font-weight", FontWeight }, -
122 { "height", Height }, -
123 { "image", QtImage }, -
124 { "image-position", QtImageAlignment }, -
125 { "left", Left }, -
126 { "line-height", LineHeight }, -
127 { "list-style", ListStyle }, -
128 { "list-style-type", ListStyleType }, -
129 { "margin" , Margin }, -
130 { "margin-bottom", MarginBottom }, -
131 { "margin-left", MarginLeft }, -
132 { "margin-right", MarginRight }, -
133 { "margin-top", MarginTop }, -
134 { "max-height", MaximumHeight }, -
135 { "max-width", MaximumWidth }, -
136 { "min-height", MinimumHeight }, -
137 { "min-width", MinimumWidth }, -
138 { "outline", Outline }, -
139 { "outline-bottom-left-radius", OutlineBottomLeftRadius }, -
140 { "outline-bottom-right-radius", OutlineBottomRightRadius }, -
141 { "outline-color", OutlineColor }, -
142 { "outline-offset", OutlineOffset }, -
143 { "outline-radius", OutlineRadius }, -
144 { "outline-style", OutlineStyle }, -
145 { "outline-top-left-radius", OutlineTopLeftRadius }, -
146 { "outline-top-right-radius", OutlineTopRightRadius }, -
147 { "outline-width", OutlineWidth }, -
148 { "padding", Padding }, -
149 { "padding-bottom", PaddingBottom }, -
150 { "padding-left", PaddingLeft }, -
151 { "padding-right", PaddingRight }, -
152 { "padding-top", PaddingTop }, -
153 { "page-break-after", PageBreakAfter }, -
154 { "page-break-before", PageBreakBefore }, -
155 { "position", Position }, -
156 { "right", Right }, -
157 { "selection-background-color", QtSelectionBackground }, -
158 { "selection-color", QtSelectionForeground }, -
159 { "spacing", QtSpacing }, -
160 { "subcontrol-origin", QtOrigin }, -
161 { "subcontrol-position", QtPosition }, -
162 { "text-align", TextAlignment }, -
163 { "text-decoration", TextDecoration }, -
164 { "text-indent", TextIndent }, -
165 { "text-transform", TextTransform }, -
166 { "text-underline-style", TextUnderlineStyle }, -
167 { "top", Top }, -
168 { "vertical-align", VerticalAlignment }, -
169 { "white-space", Whitespace }, -
170 { "width", Width } -
171}; -
172 -
173static const QCssKnownValue values[NumKnownValues - 1] = { -
174 { "active", Value_Active }, -
175 { "alternate-base", Value_AlternateBase }, -
176 { "always", Value_Always }, -
177 { "auto", Value_Auto }, -
178 { "base", Value_Base }, -
179 { "bold", Value_Bold }, -
180 { "bottom", Value_Bottom }, -
181 { "bright-text", Value_BrightText }, -
182 { "button", Value_Button }, -
183 { "button-text", Value_ButtonText }, -
184 { "center", Value_Center }, -
185 { "circle", Value_Circle }, -
186 { "dark", Value_Dark }, -
187 { "dashed", Value_Dashed }, -
188 { "decimal", Value_Decimal }, -
189 { "disabled", Value_Disabled }, -
190 { "disc", Value_Disc }, -
191 { "dot-dash", Value_DotDash }, -
192 { "dot-dot-dash", Value_DotDotDash }, -
193 { "dotted", Value_Dotted }, -
194 { "double", Value_Double }, -
195 { "groove", Value_Groove }, -
196 { "highlight", Value_Highlight }, -
197 { "highlighted-text", Value_HighlightedText }, -
198 { "inset", Value_Inset }, -
199 { "italic", Value_Italic }, -
200 { "large", Value_Large }, -
201 { "left", Value_Left }, -
202 { "light", Value_Light }, -
203 { "line-through", Value_LineThrough }, -
204 { "link", Value_Link }, -
205 { "link-visited", Value_LinkVisited }, -
206 { "lower-alpha", Value_LowerAlpha }, -
207 { "lower-roman", Value_LowerRoman }, -
208 { "lowercase", Value_Lowercase }, -
209 { "medium", Value_Medium }, -
210 { "mid", Value_Mid }, -
211 { "middle", Value_Middle }, -
212 { "midlight", Value_Midlight }, -
213 { "native", Value_Native }, -
214 { "none", Value_None }, -
215 { "normal", Value_Normal }, -
216 { "nowrap", Value_NoWrap }, -
217 { "oblique", Value_Oblique }, -
218 { "off", Value_Off }, -
219 { "on", Value_On }, -
220 { "outset", Value_Outset }, -
221 { "overline", Value_Overline }, -
222 { "pre", Value_Pre }, -
223 { "pre-wrap", Value_PreWrap }, -
224 { "ridge", Value_Ridge }, -
225 { "right", Value_Right }, -
226 { "selected", Value_Selected }, -
227 { "shadow", Value_Shadow }, -
228 { "small" , Value_Small }, -
229 { "small-caps", Value_SmallCaps }, -
230 { "solid", Value_Solid }, -
231 { "square", Value_Square }, -
232 { "sub", Value_Sub }, -
233 { "super", Value_Super }, -
234 { "text", Value_Text }, -
235 { "top", Value_Top }, -
236 { "transparent", Value_Transparent }, -
237 { "underline", Value_Underline }, -
238 { "upper-alpha", Value_UpperAlpha }, -
239 { "upper-roman", Value_UpperRoman }, -
240 { "uppercase", Value_Uppercase }, -
241 { "wave", Value_Wave }, -
242 { "window", Value_Window }, -
243 { "window-text", Value_WindowText }, -
244 { "x-large", Value_XLarge }, -
245 { "xx-large", Value_XXLarge } -
246}; -
247 -
248//Map id to strings as they appears in the 'values' array above -
249static const short indexOfId[NumKnownValues] = { 0, 41, 48, 42, 49, 54, 35, 26, 70, 71, 25, 43, 5, 63, 47, -
250 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, -
251 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, -
252 1, 15, 0, 52, 45, 44 }; -
253 -
254QString Value::toString() const -
255{ -
256 if (type == KnownIdentifier) {
never evaluated: type == KnownIdentifier
0
257 return QLatin1String(values[indexOfId[variant.toInt()]].name);
never executed: return QLatin1String(values[indexOfId[variant.toInt()]].name);
0
258 } else { -
259 return variant.toString();
never executed: return variant.toString();
0
260 } -
261} -
262 -
263static const QCssKnownValue pseudos[NumPseudos - 1] = { -
264 { "active", PseudoClass_Active }, -
265 { "adjoins-item", PseudoClass_Item }, -
266 { "alternate", PseudoClass_Alternate }, -
267 { "bottom", PseudoClass_Bottom }, -
268 { "checked", PseudoClass_Checked }, -
269 { "closable", PseudoClass_Closable }, -
270 { "closed", PseudoClass_Closed }, -
271 { "default", PseudoClass_Default }, -
272 { "disabled", PseudoClass_Disabled }, -
273 { "edit-focus", PseudoClass_EditFocus }, -
274 { "editable", PseudoClass_Editable }, -
275 { "enabled", PseudoClass_Enabled }, -
276 { "exclusive", PseudoClass_Exclusive }, -
277 { "first", PseudoClass_First }, -
278 { "flat", PseudoClass_Flat }, -
279 { "floatable", PseudoClass_Floatable }, -
280 { "focus", PseudoClass_Focus }, -
281 { "has-children", PseudoClass_Children }, -
282 { "has-siblings", PseudoClass_Sibling }, -
283 { "horizontal", PseudoClass_Horizontal }, -
284 { "hover", PseudoClass_Hover }, -
285 { "indeterminate" , PseudoClass_Indeterminate }, -
286 { "last", PseudoClass_Last }, -
287 { "left", PseudoClass_Left }, -
288 { "maximized", PseudoClass_Maximized }, -
289 { "middle", PseudoClass_Middle }, -
290 { "minimized", PseudoClass_Minimized }, -
291 { "movable", PseudoClass_Movable }, -
292 { "next-selected", PseudoClass_NextSelected }, -
293 { "no-frame", PseudoClass_Frameless }, -
294 { "non-exclusive", PseudoClass_NonExclusive }, -
295 { "off", PseudoClass_Unchecked }, -
296 { "on", PseudoClass_Checked }, -
297 { "only-one", PseudoClass_OnlyOne }, -
298 { "open", PseudoClass_Open }, -
299 { "pressed", PseudoClass_Pressed }, -
300 { "previous-selected", PseudoClass_PreviousSelected }, -
301 { "read-only", PseudoClass_ReadOnly }, -
302 { "right", PseudoClass_Right }, -
303 { "selected", PseudoClass_Selected }, -
304 { "top", PseudoClass_Top }, -
305 { "unchecked" , PseudoClass_Unchecked }, -
306 { "vertical", PseudoClass_Vertical }, -
307 { "window", PseudoClass_Window } -
308}; -
309 -
310static const QCssKnownValue origins[NumKnownOrigins - 1] = { -
311 { "border", Origin_Border }, -
312 { "content", Origin_Content }, -
313 { "margin", Origin_Margin }, // not in css -
314 { "padding", Origin_Padding } -
315}; -
316 -
317static const QCssKnownValue repeats[NumKnownRepeats - 1] = { -
318 { "no-repeat", Repeat_None }, -
319 { "repeat-x", Repeat_X }, -
320 { "repeat-xy", Repeat_XY }, -
321 { "repeat-y", Repeat_Y } -
322}; -
323 -
324static const QCssKnownValue tileModes[NumKnownTileModes - 1] = { -
325 { "repeat", TileMode_Repeat }, -
326 { "round", TileMode_Round }, -
327 { "stretch", TileMode_Stretch }, -
328}; -
329 -
330static const QCssKnownValue positions[NumKnownPositionModes - 1] = { -
331 { "absolute", PositionMode_Absolute }, -
332 { "fixed", PositionMode_Fixed }, -
333 { "relative", PositionMode_Relative }, -
334 { "static", PositionMode_Static } -
335}; -
336 -
337static const QCssKnownValue attachments[NumKnownAttachments - 1] = { -
338 { "fixed", Attachment_Fixed }, -
339 { "scroll", Attachment_Scroll } -
340}; -
341 -
342static const QCssKnownValue styleFeatures[NumKnownStyleFeatures - 1] = { -
343 { "background-color", StyleFeature_BackgroundColor }, -
344 { "background-gradient", StyleFeature_BackgroundGradient }, -
345 { "none", StyleFeature_None } -
346}; -
347 -
348Q_STATIC_GLOBAL_OPERATOR bool operator<(const QString &name, const QCssKnownValue &prop) -
349{ -
350 return QString::compare(name, QLatin1String(prop.name), Qt::CaseInsensitive) < 0;
executed: return QString::compare(name, QLatin1String(prop.name), Qt::CaseInsensitive) < 0;
Execution Count:722
722
351} -
352 -
353Q_STATIC_GLOBAL_OPERATOR bool operator<(const QCssKnownValue &prop, const QString &name) -
354{ -
355 return QString::compare(QLatin1String(prop.name), name, Qt::CaseInsensitive) < 0;
executed: return QString::compare(QLatin1String(prop.name), name, Qt::CaseInsensitive) < 0;
Execution Count:4689
4689
356} -
357 -
358static quint64 findKnownValue(const QString &name, const QCssKnownValue *start, int numValues) -
359{ -
360 const QCssKnownValue *end = &start[numValues - 1];
executed (the execution status of this line is deduced): const QCssKnownValue *end = &start[numValues - 1];
-
361 const QCssKnownValue *prop = qBinaryFind(start, end, name);
executed (the execution status of this line is deduced): const QCssKnownValue *prop = qBinaryFind(start, end, name);
-
362 if (prop == end)
evaluated: prop == end
TRUEFALSE
yes
Evaluation Count:113
yes
Evaluation Count:610
113-610
363 return 0;
executed: return 0;
Execution Count:113
113
364 return prop->id;
executed: return prop->id;
Execution Count:610
610
365} -
366 -
367/////////////////////////////////////////////////////////////////////////////// -
368// Value Extractor -
369ValueExtractor::ValueExtractor(const QVector<Declaration> &decls, const QPalette &pal) -
370: declarations(decls), adjustment(0), fontExtracted(false), pal(pal) -
371{ -
372}
executed: }
Execution Count:5492
5492
373 -
374LengthData ValueExtractor::lengthValue(const Value& v) -
375{ -
376 QString s = v.variant.toString();
executed (the execution status of this line is deduced): QString s = v.variant.toString();
-
377 s.reserve(s.length());
executed (the execution status of this line is deduced): s.reserve(s.length());
-
378 LengthData data;
executed (the execution status of this line is deduced): LengthData data;
-
379 data.unit = LengthData::None;
executed (the execution status of this line is deduced): data.unit = LengthData::None;
-
380 if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive))
evaluated: s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)
TRUEFALSE
yes
Evaluation Count:189
yes
Evaluation Count:6
6-189
381 data.unit = LengthData::Px;
executed: data.unit = LengthData::Px;
Execution Count:189
189
382 else if (s.endsWith(QLatin1String("ex"), Qt::CaseInsensitive))
partially evaluated: s.endsWith(QLatin1String("ex"), Qt::CaseInsensitive)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
383 data.unit = LengthData::Ex;
never executed: data.unit = LengthData::Ex;
0
384 else if (s.endsWith(QLatin1String("em"), Qt::CaseInsensitive))
partially evaluated: s.endsWith(QLatin1String("em"), Qt::CaseInsensitive)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
385 data.unit = LengthData::Em;
never executed: data.unit = LengthData::Em;
0
386 -
387 if (data.unit != LengthData::None)
evaluated: data.unit != LengthData::None
TRUEFALSE
yes
Evaluation Count:189
yes
Evaluation Count:6
6-189
388 s.chop(2);
executed: s.chop(2);
Execution Count:189
189
389 -
390 data.number = s.toDouble();
executed (the execution status of this line is deduced): data.number = s.toDouble();
-
391 return data;
executed: return data;
Execution Count:195
195
392} -
393 -
394static int lengthValueFromData(const LengthData& data, const QFont& f) -
395{ -
396 if (data.unit == LengthData::Ex)
partially evaluated: data.unit == LengthData::Ex
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1022
0-1022
397 return qRound(QFontMetrics(f).xHeight() * data.number);
never executed: return qRound(QFontMetrics(f).xHeight() * data.number);
0
398 else if (data.unit == LengthData::Em)
partially evaluated: data.unit == LengthData::Em
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1022
0-1022
399 return qRound(QFontMetrics(f).height() * data.number);
never executed: return qRound(QFontMetrics(f).height() * data.number);
0
400 return qRound(data.number);
executed: return qRound(data.number);
Execution Count:1022
1022
401} -
402 -
403int ValueExtractor::lengthValue(const Declaration &decl) -
404{ -
405 if (decl.d->parsed.isValid())
partially evaluated: decl.d->parsed.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:193
0-193
406 return lengthValueFromData(qvariant_cast<LengthData>(decl.d->parsed), f);
never executed: return lengthValueFromData(qvariant_cast<LengthData>(decl.d->parsed), f);
0
407 if (decl.d->values.count() < 1)
partially evaluated: decl.d->values.count() < 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:193
0-193
408 return 0;
never executed: return 0;
0
409 LengthData data = lengthValue(decl.d->values.at(0));
executed (the execution status of this line is deduced): LengthData data = lengthValue(decl.d->values.at(0));
-
410 decl.d->parsed = QVariant::fromValue<LengthData>(data);
executed (the execution status of this line is deduced): decl.d->parsed = QVariant::fromValue<LengthData>(data);
-
411 return lengthValueFromData(data,f);
executed: return lengthValueFromData(data,f);
Execution Count:193
193
412} -
413 -
414void ValueExtractor::lengthValues(const Declaration &decl, int *m) -
415{ -
416 if (decl.d->parsed.isValid()) {
partially evaluated: decl.d->parsed.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
417 QList<QVariant> v = decl.d->parsed.toList();
never executed (the execution status of this line is deduced): QList<QVariant> v = decl.d->parsed.toList();
-
418 for (int i = 0; i < 4; i++)
never evaluated: i < 4
0
419 m[i] = lengthValueFromData(qvariant_cast<LengthData>(v.at(i)), f);
never executed: m[i] = lengthValueFromData(qvariant_cast<LengthData>(v.at(i)), f);
0
420 return;
never executed: return;
0
421 } -
422 -
423 LengthData datas[4];
executed (the execution status of this line is deduced): LengthData datas[4];
-
424 int i;
executed (the execution status of this line is deduced): int i;
-
425 for (i = 0; i < qMin(decl.d->values.count(), 4); i++)
evaluated: i < qMin(decl.d->values.count(), 4)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
426 datas[i] = lengthValue(decl.d->values[i]);
executed: datas[i] = lengthValue(decl.d->values[i]);
Execution Count:1
1
427 -
428 if (i == 0) {
partially evaluated: i == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
429 LengthData zero = {0.0, LengthData::None};
never executed (the execution status of this line is deduced): LengthData zero = {0.0, LengthData::None};
-
430 datas[0] = datas[1] = datas[2] = datas[3] = zero;
never executed (the execution status of this line is deduced): datas[0] = datas[1] = datas[2] = datas[3] = zero;
-
431 } else if (i == 1) {
never executed: }
partially evaluated: i == 1
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
432 datas[3] = datas[2] = datas[1] = datas[0];
executed (the execution status of this line is deduced): datas[3] = datas[2] = datas[1] = datas[0];
-
433 } else if (i == 2) {
executed: }
Execution Count:1
never evaluated: i == 2
0-1
434 datas[2] = datas[0];
never executed (the execution status of this line is deduced): datas[2] = datas[0];
-
435 datas[3] = datas[1];
never executed (the execution status of this line is deduced): datas[3] = datas[1];
-
436 } else if (i == 3) {
never executed: }
never evaluated: i == 3
0
437 datas[3] = datas[1];
never executed (the execution status of this line is deduced): datas[3] = datas[1];
-
438 }
never executed: }
0
439 -
440 QList<QVariant> v;
executed (the execution status of this line is deduced): QList<QVariant> v;
-
441 for (i = 0; i < 4; i++) {
evaluated: i < 4
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
442 v += QVariant::fromValue<LengthData>(datas[i]);
executed (the execution status of this line is deduced): v += QVariant::fromValue<LengthData>(datas[i]);
-
443 m[i] = lengthValueFromData(datas[i], f);
executed (the execution status of this line is deduced): m[i] = lengthValueFromData(datas[i], f);
-
444 }
executed: }
Execution Count:4
4
445 decl.d->parsed = v;
executed (the execution status of this line is deduced): decl.d->parsed = v;
-
446}
executed: }
Execution Count:1
1
447 -
448bool ValueExtractor::extractGeometry(int *w, int *h, int *minw, int *minh, int *maxw, int *maxh) -
449{ -
450 extractFont();
executed (the execution status of this line is deduced): extractFont();
-
451 bool hit = false;
executed (the execution status of this line is deduced): bool hit = false;
-
452 for (int i = 0; i < declarations.count(); i++) {
evaluated: i < declarations.count()
TRUEFALSE
yes
Evaluation Count:2915
yes
Evaluation Count:3726
2915-3726
453 const Declaration &decl = declarations.at(i);
executed (the execution status of this line is deduced): const Declaration &decl = declarations.at(i);
-
454 switch (decl.d->propertyId) { -
455 case Width: *w = lengthValue(decl); break;
never executed: break;
0
456 case Height: *h = lengthValue(decl); break;
never executed: break;
0
457 case MinimumWidth: *minw = lengthValue(decl); break;
never executed: break;
0
458 case MinimumHeight: *minh = lengthValue(decl); break;
never executed: break;
0
459 case MaximumWidth: *maxw = lengthValue(decl); break;
never executed: break;
0
460 case MaximumHeight: *maxh = lengthValue(decl); break;
never executed: break;
0
461 default: continue;
executed: continue;
Execution Count:2915
2915
462 } -
463 hit = true;
never executed (the execution status of this line is deduced): hit = true;
-
464 }
never executed: }
0
465 -
466 return hit;
executed: return hit;
Execution Count:3726
3726
467} -
468 -
469bool ValueExtractor::extractPosition(int *left, int *top, int *right, int *bottom, QCss::Origin *origin, -
470 Qt::Alignment *position, QCss::PositionMode *mode, Qt::Alignment *textAlignment) -
471{ -
472 extractFont();
executed (the execution status of this line is deduced): extractFont();
-
473 bool hit = false;
executed (the execution status of this line is deduced): bool hit = false;
-
474 for (int i = 0; i < declarations.count(); i++) {
evaluated: i < declarations.count()
TRUEFALSE
yes
Evaluation Count:2915
yes
Evaluation Count:3726
2915-3726
475 const Declaration &decl = declarations.at(i);
executed (the execution status of this line is deduced): const Declaration &decl = declarations.at(i);
-
476 switch (decl.d->propertyId) { -
477 case Left: *left = lengthValue(decl); break;
never executed: break;
0
478 case Top: *top = lengthValue(decl); break;
never executed: break;
0
479 case Right: *right = lengthValue(decl); break;
never executed: break;
0
480 case Bottom: *bottom = lengthValue(decl); break;
never executed: break;
0
481 case QtOrigin: *origin = decl.originValue(); break;
never executed: break;
0
482 case QtPosition: *position = decl.alignmentValue(); break;
never executed: break;
0
483 case TextAlignment: *textAlignment = decl.alignmentValue(); break;
never executed: break;
0
484 case Position: *mode = decl.positionValue(); break;
never executed: break;
0
485 default: continue;
executed: continue;
Execution Count:2915
2915
486 } -
487 hit = true;
never executed (the execution status of this line is deduced): hit = true;
-
488 }
never executed: }
0
489 -
490 return hit;
executed: return hit;
Execution Count:3726
3726
491} -
492 -
493bool ValueExtractor::extractBox(int *margins, int *paddings, int *spacing) -
494{ -
495 extractFont();
executed (the execution status of this line is deduced): extractFont();
-
496 bool hit = false;
executed (the execution status of this line is deduced): bool hit = false;
-
497 for (int i = 0; i < declarations.count(); i++) {
evaluated: i < declarations.count()
TRUEFALSE
yes
Evaluation Count:3448
yes
Evaluation Count:5492
3448-5492
498 const Declaration &decl = declarations.at(i);
executed (the execution status of this line is deduced): const Declaration &decl = declarations.at(i);
-
499 switch (decl.d->propertyId) { -
500 case PaddingLeft: paddings[LeftEdge] = lengthValue(decl); break;
executed: break;
Execution Count:1
1
501 case PaddingRight: paddings[RightEdge] = lengthValue(decl); break;
executed: break;
Execution Count:1
1
502 case PaddingTop: paddings[TopEdge] = lengthValue(decl); break;
executed: break;
Execution Count:1
1
503 case PaddingBottom: paddings[BottomEdge] = lengthValue(decl); break;
executed: break;
Execution Count:1
1
504 case Padding: lengthValues(decl, paddings); break;
executed: break;
Execution Count:1
1
505 -
506 case MarginLeft: margins[LeftEdge] = lengthValue(decl); break;
executed: break;
Execution Count:51
51
507 case MarginRight: margins[RightEdge] = lengthValue(decl); break;
executed: break;
Execution Count:44
44
508 case MarginTop: margins[TopEdge] = lengthValue(decl); break;
executed: break;
Execution Count:47
47
509 case MarginBottom: margins[BottomEdge] = lengthValue(decl); break;
executed: break;
Execution Count:45
45
510 case Margin: lengthValues(decl, margins); break;
never executed: break;
0
511 case QtSpacing: if (spacing) *spacing = lengthValue(decl); break;
never executed: *spacing = lengthValue(decl);
never executed: break;
never evaluated: spacing
0
512 -
513 default: continue;
executed: continue;
Execution Count:3256
3256
514 } -
515 hit = true;
executed (the execution status of this line is deduced): hit = true;
-
516 }
executed: }
Execution Count:192
192
517 -
518 return hit;
executed: return hit;
Execution Count:5492
5492
519} -
520 -
521int ValueExtractor::extractStyleFeatures() -
522{ -
523 int features = StyleFeature_None;
executed (the execution status of this line is deduced): int features = StyleFeature_None;
-
524 for (int i = 0; i < declarations.count(); i++) {
evaluated: i < declarations.count()
TRUEFALSE
yes
Evaluation Count:2915
yes
Evaluation Count:3726
2915-3726
525 const Declaration &decl = declarations.at(i);
executed (the execution status of this line is deduced): const Declaration &decl = declarations.at(i);
-
526 if (decl.d->propertyId == QtStyleFeatures)
evaluated: decl.d->propertyId == QtStyleFeatures
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:2886
29-2886
527 features = decl.styleFeaturesValue();
executed: features = decl.styleFeaturesValue();
Execution Count:29
29
528 }
executed: }
Execution Count:2915
2915
529 return features;
executed: return features;
Execution Count:3726
3726
530} -
531 -
532QSize ValueExtractor::sizeValue(const Declaration &decl) -
533{ -
534 if (decl.d->parsed.isValid()) {
never evaluated: decl.d->parsed.isValid()
0
535 QList<QVariant> v = decl.d->parsed.toList();
never executed (the execution status of this line is deduced): QList<QVariant> v = decl.d->parsed.toList();
-
536 return QSize(lengthValueFromData(qvariant_cast<LengthData>(v.at(0)), f),
never executed: return QSize(lengthValueFromData(qvariant_cast<LengthData>(v.at(0)), f), lengthValueFromData(qvariant_cast<LengthData>(v.at(1)), f));
0
537 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
538 } -
539 -
540 LengthData x[2] = { {0, LengthData::None }, {0, LengthData::None} };
never executed (the execution status of this line is deduced): LengthData x[2] = { {0, LengthData::None }, {0, LengthData::None} };
-
541 if (decl.d->values.count() > 0)
never evaluated: decl.d->values.count() > 0
0
542 x[0] = lengthValue(decl.d->values.at(0));
never executed: x[0] = lengthValue(decl.d->values.at(0));
0
543 if (decl.d->values.count() > 1)
never evaluated: decl.d->values.count() > 1
0
544 x[1] = lengthValue(decl.d->values.at(1));
never executed: x[1] = lengthValue(decl.d->values.at(1));
0
545 else -
546 x[1] = x[0];
never executed: x[1] = x[0];
0
547 QList<QVariant> v;
never executed (the execution status of this line is deduced): QList<QVariant> v;
-
548 v << QVariant::fromValue<LengthData>(x[0]) << QVariant::fromValue<LengthData>(x[1]);
never executed (the execution status of this line is deduced): v << QVariant::fromValue<LengthData>(x[0]) << QVariant::fromValue<LengthData>(x[1]);
-
549 decl.d->parsed = v;
never executed (the execution status of this line is deduced): decl.d->parsed = v;
-
550 return QSize(lengthValueFromData(x[0], f), lengthValueFromData(x[1], f));
never executed: return QSize(lengthValueFromData(x[0], f), lengthValueFromData(x[1], f));
0
551} -
552 -
553void ValueExtractor::sizeValues(const Declaration &decl, QSize *radii) -
554{ -
555 radii[0] = sizeValue(decl);
never executed (the execution status of this line is deduced): radii[0] = sizeValue(decl);
-
556 for (int i = 1; i < 4; i++)
never evaluated: i < 4
0
557 radii[i] = radii[0];
never executed: radii[i] = radii[0];
0
558}
never executed: }
0
559 -
560bool ValueExtractor::extractBorder(int *borders, QBrush *colors, BorderStyle *styles, -
561 QSize *radii) -
562{ -
563 extractFont();
executed (the execution status of this line is deduced): extractFont();
-
564 bool hit = false;
executed (the execution status of this line is deduced): bool hit = false;
-
565 for (int i = 0; i < declarations.count(); i++) {
evaluated: i < declarations.count()
TRUEFALSE
yes
Evaluation Count:2915
yes
Evaluation Count:3726
2915-3726
566 const Declaration &decl = declarations.at(i);
executed (the execution status of this line is deduced): const Declaration &decl = declarations.at(i);
-
567 switch (decl.d->propertyId) { -
568 case BorderLeftWidth: borders[LeftEdge] = lengthValue(decl); break;
never executed: break;
0
569 case BorderRightWidth: borders[RightEdge] = lengthValue(decl); break;
never executed: break;
0
570 case BorderTopWidth: borders[TopEdge] = lengthValue(decl); break;
never executed: break;
0
571 case BorderBottomWidth: borders[BottomEdge] = lengthValue(decl); break;
never executed: break;
0
572 case BorderWidth: lengthValues(decl, borders); break;
never executed: break;
0
573 -
574 case BorderLeftColor: colors[LeftEdge] = decl.brushValue(pal); break;
never executed: break;
0
575 case BorderRightColor: colors[RightEdge] = decl.brushValue(pal); break;
never executed: break;
0
576 case BorderTopColor: colors[TopEdge] = decl.brushValue(pal); break;
never executed: break;
0
577 case BorderBottomColor: colors[BottomEdge] = decl.brushValue(pal); break;
never executed: break;
0
578 case BorderColor: decl.brushValues(colors, pal); break;
never executed: break;
0
579 -
580 case BorderTopStyle: styles[TopEdge] = decl.styleValue(); break;
never executed: break;
0
581 case BorderBottomStyle: styles[BottomEdge] = decl.styleValue(); break;
never executed: break;
0
582 case BorderLeftStyle: styles[LeftEdge] = decl.styleValue(); break;
never executed: break;
0
583 case BorderRightStyle: styles[RightEdge] = decl.styleValue(); break;
never executed: break;
0
584 case BorderStyles: decl.styleValues(styles); break;
executed: break;
Execution Count:21
21
585 -
586 case BorderTopLeftRadius: radii[0] = sizeValue(decl); break;
never executed: break;
0
587 case BorderTopRightRadius: radii[1] = sizeValue(decl); break;
never executed: break;
0
588 case BorderBottomLeftRadius: radii[2] = sizeValue(decl); break;
never executed: break;
0
589 case BorderBottomRightRadius: radii[3] = sizeValue(decl); break;
never executed: break;
0
590 case BorderRadius: sizeValues(decl, radii); break;
never executed: break;
0
591 -
592 case BorderLeft: -
593 borderValue(decl, &borders[LeftEdge], &styles[LeftEdge], &colors[LeftEdge]);
never executed (the execution status of this line is deduced): borderValue(decl, &borders[LeftEdge], &styles[LeftEdge], &colors[LeftEdge]);
-
594 break;
never executed: break;
0
595 case BorderTop: -
596 borderValue(decl, &borders[TopEdge], &styles[TopEdge], &colors[TopEdge]);
never executed (the execution status of this line is deduced): borderValue(decl, &borders[TopEdge], &styles[TopEdge], &colors[TopEdge]);
-
597 break;
never executed: break;
0
598 case BorderRight: -
599 borderValue(decl, &borders[RightEdge], &styles[RightEdge], &colors[RightEdge]);
never executed (the execution status of this line is deduced): borderValue(decl, &borders[RightEdge], &styles[RightEdge], &colors[RightEdge]);
-
600 break;
never executed: break;
0
601 case BorderBottom: -
602 borderValue(decl, &borders[BottomEdge], &styles[BottomEdge], &colors[BottomEdge]);
never executed (the execution status of this line is deduced): borderValue(decl, &borders[BottomEdge], &styles[BottomEdge], &colors[BottomEdge]);
-
603 break;
never executed: break;
0
604 case Border: -
605 borderValue(decl, &borders[LeftEdge], &styles[LeftEdge], &colors[LeftEdge]);
executed (the execution status of this line is deduced): borderValue(decl, &borders[LeftEdge], &styles[LeftEdge], &colors[LeftEdge]);
-
606 borders[TopEdge] = borders[RightEdge] = borders[BottomEdge] = borders[LeftEdge];
executed (the execution status of this line is deduced): borders[TopEdge] = borders[RightEdge] = borders[BottomEdge] = borders[LeftEdge];
-
607 styles[TopEdge] = styles[RightEdge] = styles[BottomEdge] = styles[LeftEdge];
executed (the execution status of this line is deduced): styles[TopEdge] = styles[RightEdge] = styles[BottomEdge] = styles[LeftEdge];
-
608 colors[TopEdge] = colors[RightEdge] = colors[BottomEdge] = colors[LeftEdge];
executed (the execution status of this line is deduced): colors[TopEdge] = colors[RightEdge] = colors[BottomEdge] = colors[LeftEdge];
-
609 break;
executed: break;
Execution Count:1216
1216
610 -
611 default: continue;
executed: continue;
Execution Count:1678
1678
612 } -
613 hit = true;
executed (the execution status of this line is deduced): hit = true;
-
614 }
executed: }
Execution Count:1237
1237
615 -
616 return hit;
executed: return hit;
Execution Count:3726
3726
617} -
618 -
619bool ValueExtractor::extractOutline(int *borders, QBrush *colors, BorderStyle *styles, -
620 QSize *radii, int *offsets) -
621{ -
622 extractFont();
executed (the execution status of this line is deduced): extractFont();
-
623 bool hit = false;
executed (the execution status of this line is deduced): bool hit = false;
-
624 for (int i = 0; i < declarations.count(); i++) {
evaluated: i < declarations.count()
TRUEFALSE
yes
Evaluation Count:2915
yes
Evaluation Count:3726
2915-3726
625 const Declaration &decl = declarations.at(i);
executed (the execution status of this line is deduced): const Declaration &decl = declarations.at(i);
-
626 switch (decl.d->propertyId) { -
627 case OutlineWidth: lengthValues(decl, borders); break;
never executed: break;
0
628 case OutlineColor: decl.brushValues(colors, pal); break;
never executed: break;
0
629 case OutlineStyle: decl.styleValues(styles); break;
never executed: break;
0
630 -
631 case OutlineTopLeftRadius: radii[0] = sizeValue(decl); break;
never executed: break;
0
632 case OutlineTopRightRadius: radii[1] = sizeValue(decl); break;
never executed: break;
0
633 case OutlineBottomLeftRadius: radii[2] = sizeValue(decl); break;
never executed: break;
0
634 case OutlineBottomRightRadius: radii[3] = sizeValue(decl); break;
never executed: break;
0
635 case OutlineRadius: sizeValues(decl, radii); break;
never executed: break;
0
636 case OutlineOffset: lengthValues(decl, offsets); break;
never executed: break;
0
637 -
638 case Outline: -
639 borderValue(decl, &borders[LeftEdge], &styles[LeftEdge], &colors[LeftEdge]);
never executed (the execution status of this line is deduced): borderValue(decl, &borders[LeftEdge], &styles[LeftEdge], &colors[LeftEdge]);
-
640 borders[TopEdge] = borders[RightEdge] = borders[BottomEdge] = borders[LeftEdge];
never executed (the execution status of this line is deduced): borders[TopEdge] = borders[RightEdge] = borders[BottomEdge] = borders[LeftEdge];
-
641 styles[TopEdge] = styles[RightEdge] = styles[BottomEdge] = styles[LeftEdge];
never executed (the execution status of this line is deduced): styles[TopEdge] = styles[RightEdge] = styles[BottomEdge] = styles[LeftEdge];
-
642 colors[TopEdge] = colors[RightEdge] = colors[BottomEdge] = colors[LeftEdge];
never executed (the execution status of this line is deduced): colors[TopEdge] = colors[RightEdge] = colors[BottomEdge] = colors[LeftEdge];
-
643 break;
never executed: break;
0
644 -
645 default: continue;
executed: continue;
Execution Count:2915
2915
646 } -
647 hit = true;
never executed (the execution status of this line is deduced): hit = true;
-
648 }
never executed: }
0
649 -
650 return hit;
executed: return hit;
Execution Count:3726
3726
651} -
652 -
653static Qt::Alignment parseAlignment(const QCss::Value *values, int count) -
654{ -
655 Qt::Alignment a[2] = { 0, 0 };
never executed (the execution status of this line is deduced): Qt::Alignment a[2] = { 0, 0 };
-
656 for (int i = 0; i < qMin(2, count); i++) {
never evaluated: i < qMin(2, count)
0
657 if (values[i].type != Value::KnownIdentifier)
never evaluated: values[i].type != Value::KnownIdentifier
0
658 break;
never executed: break;
0
659 switch (values[i].variant.toInt()) { -
660 case Value_Left: a[i] = Qt::AlignLeft; break;
never executed: break;
0
661 case Value_Right: a[i] = Qt::AlignRight; break;
never executed: break;
0
662 case Value_Top: a[i] = Qt::AlignTop; break;
never executed: break;
0
663 case Value_Bottom: a[i] = Qt::AlignBottom; break;
never executed: break;
0
664 case Value_Center: a[i] = Qt::AlignCenter; break;
never executed: break;
0
665 default: break;
never executed: break;
0
666 } -
667 }
never executed: }
0
668 -
669 if (a[0] == Qt::AlignCenter && a[1] != 0 && a[1] != Qt::AlignCenter)
never evaluated: a[0] == Qt::AlignCenter
never evaluated: a[1] != 0
never evaluated: a[1] != Qt::AlignCenter
0
670 a[0] = (a[1] == Qt::AlignLeft || a[1] == Qt::AlignRight) ? Qt::AlignVCenter : Qt::AlignHCenter;
never executed: a[0] = (a[1] == Qt::AlignLeft || a[1] == Qt::AlignRight) ? Qt::AlignVCenter : Qt::AlignHCenter;
never evaluated: a[1] == Qt::AlignLeft
never evaluated: a[1] == Qt::AlignRight
0
671 if ((a[1] == 0 || a[1] == Qt::AlignCenter) && a[0] != Qt::AlignCenter)
never evaluated: a[1] == 0
never evaluated: a[1] == Qt::AlignCenter
never evaluated: a[0] != Qt::AlignCenter
0
672 a[1] = (a[0] == Qt::AlignLeft || a[0] == Qt::AlignRight) ? Qt::AlignVCenter : Qt::AlignHCenter;
never executed: a[1] = (a[0] == Qt::AlignLeft || a[0] == Qt::AlignRight) ? Qt::AlignVCenter : Qt::AlignHCenter;
never evaluated: a[0] == Qt::AlignLeft
never evaluated: a[0] == Qt::AlignRight
0
673 return a[0] | a[1];
never executed: return a[0] | a[1];
0
674} -
675 -
676static ColorData parseColorValue(QCss::Value v) -
677{ -
678 if (v.type == Value::Identifier || v.type == Value::String) {
evaluated: v.type == Value::Identifier
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:16
partially evaluated: v.type == Value::String
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-48
679 v.variant.convert(QVariant::Color);
executed (the execution status of this line is deduced): v.variant.convert(QVariant::Color);
-
680 v.type = Value::Color;
executed (the execution status of this line is deduced): v.type = Value::Color;
-
681 }
executed: }
Execution Count:48
48
682 -
683 if (v.type == Value::Color)
evaluated: v.type == Value::Color
TRUEFALSE
yes
Evaluation Count:63
yes
Evaluation Count:1
1-63
684 return qvariant_cast<QColor>(v.variant);
executed: return qvariant_cast<QColor>(v.variant);
Execution Count:63
63
685 -
686 if (v.type == Value::KnownIdentifier && v.variant.toInt() == Value_Transparent)
partially evaluated: v.type == Value::KnownIdentifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: v.variant.toInt() == Value_Transparent
0-1
687 return QColor(Qt::transparent);
never executed: return QColor(Qt::transparent);
0
688 -
689 if (v.type != Value::Function)
partially evaluated: v.type != Value::Function
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
690 return ColorData();
never executed: return ColorData();
0
691 -
692 QStringList lst = v.variant.toStringList();
executed (the execution status of this line is deduced): QStringList lst = v.variant.toStringList();
-
693 if (lst.count() != 2)
partially evaluated: lst.count() != 2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
694 return ColorData();
never executed: return ColorData();
0
695 -
696 if ((lst.at(0).compare(QLatin1String("palette"), Qt::CaseInsensitive)) == 0) {
partially evaluated: (lst.at(0).compare(QLatin1String("palette"), Qt::CaseInsensitive)) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
697 int role = findKnownValue(lst.at(1).trimmed(), values, NumKnownValues);
never executed (the execution status of this line is deduced): int role = findKnownValue(lst.at(1).trimmed(), values, NumKnownValues);
-
698 if (role >= Value_FirstColorRole && role <= Value_LastColorRole)
never evaluated: role >= Value_FirstColorRole
never evaluated: role <= Value_LastColorRole
0
699 return (QPalette::ColorRole)(role-Value_FirstColorRole);
never executed: return (QPalette::ColorRole)(role-Value_FirstColorRole);
0
700 -
701 return ColorData();
never executed: return ColorData();
0
702 } -
703 -
704 bool rgb = lst.at(0).startsWith(QLatin1String("rgb"));
executed (the execution status of this line is deduced): bool rgb = lst.at(0).startsWith(QLatin1String("rgb"));
-
705 bool rgba = lst.at(0).startsWith(QLatin1String("rgba"));
executed (the execution status of this line is deduced): bool rgba = lst.at(0).startsWith(QLatin1String("rgba"));
-
706 -
707 Parser p(lst.at(1));
executed (the execution status of this line is deduced): Parser p(lst.at(1));
-
708 if (!p.testExpr())
partially evaluated: !p.testExpr()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
709 return ColorData();
never executed: return ColorData();
0
710 -
711 QVector<QCss::Value> colorDigits;
executed (the execution status of this line is deduced): QVector<QCss::Value> colorDigits;
-
712 if (!p.parseExpr(&colorDigits))
partially evaluated: !p.parseExpr(&colorDigits)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
713 return ColorData();
never executed: return ColorData();
0
714 -
715 for (int i = 0; i < qMin(colorDigits.count(), 7); i += 2) {
evaluated: i < qMin(colorDigits.count(), 7)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
716 if (colorDigits.at(i).type == Value::Percentage) {
partially evaluated: colorDigits.at(i).type == Value::Percentage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
717 colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.);
never executed (the execution status of this line is deduced): colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.);
-
718 colorDigits[i].type = Value::Number;
never executed (the execution status of this line is deduced): colorDigits[i].type = Value::Number;
-
719 } else if (colorDigits.at(i).type != Value::Number) {
never executed: }
partially evaluated: colorDigits.at(i).type != Value::Number
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
720 return ColorData();
never executed: return ColorData();
0
721 } -
722 } -
723 -
724 int v1 = colorDigits.at(0).variant.toInt();
executed (the execution status of this line is deduced): int v1 = colorDigits.at(0).variant.toInt();
-
725 int v2 = colorDigits.at(2).variant.toInt();
executed (the execution status of this line is deduced): int v2 = colorDigits.at(2).variant.toInt();
-
726 int v3 = colorDigits.at(4).variant.toInt();
executed (the execution status of this line is deduced): int v3 = colorDigits.at(4).variant.toInt();
-
727 int alpha = 255;
executed (the execution status of this line is deduced): int alpha = 255;
-
728 if (colorDigits.count() >= 7) {
partially evaluated: colorDigits.count() >= 7
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
729 int alphaValue = colorDigits.at(6).variant.toInt();
never executed (the execution status of this line is deduced): int alphaValue = colorDigits.at(6).variant.toInt();
-
730 if (rgba && alphaValue <= 1)
never evaluated: rgba
never evaluated: alphaValue <= 1
0
731 alpha = colorDigits.at(6).variant.toReal() * 255.;
never executed: alpha = colorDigits.at(6).variant.toReal() * 255.;
0
732 else -
733 alpha = alphaValue;
never executed: alpha = alphaValue;
0
734 } -
735 -
736 return rgb ? QColor::fromRgb(v1, v2, v3, alpha)
executed: return rgb ? QColor::fromRgb(v1, v2, v3, alpha) : QColor::fromHsv(v1, v2, v3, alpha);
Execution Count:1
1
737 : QColor::fromHsv(v1, v2, v3, alpha);
executed: return rgb ? QColor::fromRgb(v1, v2, v3, alpha) : QColor::fromHsv(v1, v2, v3, alpha);
Execution Count:1
1
738} -
739 -
740static QColor colorFromData(const ColorData& c, const QPalette &pal) -
741{ -
742 if (c.type == ColorData::Color) {
never evaluated: c.type == ColorData::Color
0
743 return c.color;
never executed: return c.color;
0
744 } else if (c.type == ColorData::Role) {
never evaluated: c.type == ColorData::Role
0
745 return pal.color(c.role);
never executed: return pal.color(c.role);
0
746 } -
747 return QColor();
never executed: return QColor();
0
748} -
749 -
750static BrushData parseBrushValue(const QCss::Value &v, const QPalette &pal) -
751{ -
752 ColorData c = parseColorValue(v);
never executed (the execution status of this line is deduced): ColorData c = parseColorValue(v);
-
753 if (c.type == ColorData::Color) {
partially evaluated: c.type == ColorData::Color
TRUEFALSE
yes
Evaluation Count:50
no
Evaluation Count:0
0-50
754 return QBrush(c.color);
executed: return QBrush(c.color);
Execution Count:50
50
755 } else if (c.type == ColorData::Role) {
never evaluated: c.type == ColorData::Role
0
756 return c.role;
never executed: return c.role;
0
757 } -
758 -
759 if (v.type != Value::Function)
never evaluated: v.type != Value::Function
0
760 return BrushData();
never executed: return BrushData();
0
761 -
762 QStringList lst = v.variant.toStringList();
never executed (the execution status of this line is deduced): QStringList lst = v.variant.toStringList();
-
763 if (lst.count() != 2)
never evaluated: lst.count() != 2
0
764 return BrushData();
never executed: return BrushData();
0
765 -
766 QStringList gradFuncs;
never executed (the execution status of this line is deduced): QStringList gradFuncs;
-
767 gradFuncs << QLatin1String("qlineargradient") << QLatin1String("qradialgradient") << QLatin1String("qconicalgradient") << QLatin1String("qgradient");
never executed (the execution status of this line is deduced): gradFuncs << QLatin1String("qlineargradient") << QLatin1String("qradialgradient") << QLatin1String("qconicalgradient") << QLatin1String("qgradient");
-
768 int gradType = -1;
never executed (the execution status of this line is deduced): int gradType = -1;
-
769 -
770 if ((gradType = gradFuncs.indexOf(lst.at(0).toLower())) == -1)
never evaluated: (gradType = gradFuncs.indexOf(lst.at(0).toLower())) == -1
0
771 return BrushData();
never executed: return BrushData();
0
772 -
773 QHash<QString, qreal> vars;
never executed (the execution status of this line is deduced): QHash<QString, qreal> vars;
-
774 QVector<QGradientStop> stops;
never executed (the execution status of this line is deduced): QVector<QGradientStop> stops;
-
775 -
776 int spread = -1;
never executed (the execution status of this line is deduced): int spread = -1;
-
777 QStringList spreads;
never executed (the execution status of this line is deduced): QStringList spreads;
-
778 spreads << QLatin1String("pad") << QLatin1String("reflect") << QLatin1String("repeat");
never executed (the execution status of this line is deduced): spreads << QLatin1String("pad") << QLatin1String("reflect") << QLatin1String("repeat");
-
779 -
780 bool dependsOnThePalette = false;
never executed (the execution status of this line is deduced): bool dependsOnThePalette = false;
-
781 Parser parser(lst.at(1));
never executed (the execution status of this line is deduced): Parser parser(lst.at(1));
-
782 while (parser.hasNext()) {
never evaluated: parser.hasNext()
0
783 parser.skipSpace();
never executed (the execution status of this line is deduced): parser.skipSpace();
-
784 if (!parser.test(IDENT))
never evaluated: !parser.test(IDENT)
0
785 return BrushData();
never executed: return BrushData();
0
786 QString attr = parser.lexem();
never executed (the execution status of this line is deduced): QString attr = parser.lexem();
-
787 parser.skipSpace();
never executed (the execution status of this line is deduced): parser.skipSpace();
-
788 if (!parser.test(COLON))
never evaluated: !parser.test(COLON)
0
789 return BrushData();
never executed: return BrushData();
0
790 parser.skipSpace();
never executed (the execution status of this line is deduced): parser.skipSpace();
-
791 if (attr.compare(QLatin1String("stop"), Qt::CaseInsensitive) == 0) {
never evaluated: attr.compare(QLatin1String("stop"), Qt::CaseInsensitive) == 0
0
792 QCss::Value stop, color;
never executed (the execution status of this line is deduced): QCss::Value stop, color;
-
793 parser.next();
never executed (the execution status of this line is deduced): parser.next();
-
794 if (!parser.parseTerm(&stop)) return BrushData();
never executed: return BrushData();
never evaluated: !parser.parseTerm(&stop)
0
795 parser.skipSpace();
never executed (the execution status of this line is deduced): parser.skipSpace();
-
796 parser.next();
never executed (the execution status of this line is deduced): parser.next();
-
797 if (!parser.parseTerm(&color)) return BrushData();
never executed: return BrushData();
never evaluated: !parser.parseTerm(&color)
0
798 ColorData cd = parseColorValue(color);
never executed (the execution status of this line is deduced): ColorData cd = parseColorValue(color);
-
799 if(cd.type == ColorData::Role)
never evaluated: cd.type == ColorData::Role
0
800 dependsOnThePalette = true;
never executed: dependsOnThePalette = true;
0
801 stops.append(QGradientStop(stop.variant.toReal(), colorFromData(cd, pal)));
never executed (the execution status of this line is deduced): stops.append(QGradientStop(stop.variant.toReal(), colorFromData(cd, pal)));
-
802 } else {
never executed: }
0
803 parser.next();
never executed (the execution status of this line is deduced): parser.next();
-
804 QCss::Value value;
never executed (the execution status of this line is deduced): QCss::Value value;
-
805 (void)parser.parseTerm(&value);
never executed (the execution status of this line is deduced): (void)parser.parseTerm(&value);
-
806 if (attr.compare(QLatin1String("spread"), Qt::CaseInsensitive) == 0) {
never evaluated: attr.compare(QLatin1String("spread"), Qt::CaseInsensitive) == 0
0
807 spread = spreads.indexOf(value.variant.toString());
never executed (the execution status of this line is deduced): spread = spreads.indexOf(value.variant.toString());
-
808 } else {
never executed: }
0
809 vars[attr] = value.variant.toReal();
never executed (the execution status of this line is deduced): vars[attr] = value.variant.toReal();
-
810 }
never executed: }
0
811 } -
812 parser.skipSpace();
never executed (the execution status of this line is deduced): parser.skipSpace();
-
813 (void)parser.test(COMMA);
never executed (the execution status of this line is deduced): (void)parser.test(COMMA);
-
814 }
never executed: }
0
815 -
816 if (gradType == 0) {
never evaluated: gradType == 0
0
817 QLinearGradient lg(vars.value(QLatin1String("x1")), vars.value(QLatin1String("y1")),
never executed (the execution status of this line is deduced): QLinearGradient lg(vars.value(QLatin1String("x1")), vars.value(QLatin1String("y1")),
-
818 vars.value(QLatin1String("x2")), vars.value(QLatin1String("y2")));
never executed (the execution status of this line is deduced): vars.value(QLatin1String("x2")), vars.value(QLatin1String("y2")));
-
819 lg.setCoordinateMode(QGradient::ObjectBoundingMode);
never executed (the execution status of this line is deduced): lg.setCoordinateMode(QGradient::ObjectBoundingMode);
-
820 lg.setStops(stops);
never executed (the execution status of this line is deduced): lg.setStops(stops);
-
821 if (spread != -1)
never evaluated: spread != -1
0
822 lg.setSpread(QGradient::Spread(spread));
never executed: lg.setSpread(QGradient::Spread(spread));
0
823 BrushData bd = QBrush(lg);
never executed (the execution status of this line is deduced): BrushData bd = QBrush(lg);
-
824 if (dependsOnThePalette)
never evaluated: dependsOnThePalette
0
825 bd.type = BrushData::DependsOnThePalette;
never executed: bd.type = BrushData::DependsOnThePalette;
0
826 return bd;
never executed: return bd;
0
827 } -
828 -
829 if (gradType == 1) {
never evaluated: gradType == 1
0
830 QRadialGradient rg(vars.value(QLatin1String("cx")), vars.value(QLatin1String("cy")),
never executed (the execution status of this line is deduced): QRadialGradient rg(vars.value(QLatin1String("cx")), vars.value(QLatin1String("cy")),
-
831 vars.value(QLatin1String("radius")), vars.value(QLatin1String("fx")),
never executed (the execution status of this line is deduced): vars.value(QLatin1String("radius")), vars.value(QLatin1String("fx")),
-
832 vars.value(QLatin1String("fy")));
never executed (the execution status of this line is deduced): vars.value(QLatin1String("fy")));
-
833 rg.setCoordinateMode(QGradient::ObjectBoundingMode);
never executed (the execution status of this line is deduced): rg.setCoordinateMode(QGradient::ObjectBoundingMode);
-
834 rg.setStops(stops);
never executed (the execution status of this line is deduced): rg.setStops(stops);
-
835 if (spread != -1)
never evaluated: spread != -1
0
836 rg.setSpread(QGradient::Spread(spread));
never executed: rg.setSpread(QGradient::Spread(spread));
0
837 BrushData bd = QBrush(rg);
never executed (the execution status of this line is deduced): BrushData bd = QBrush(rg);
-
838 if (dependsOnThePalette)
never evaluated: dependsOnThePalette
0
839 bd.type = BrushData::DependsOnThePalette;
never executed: bd.type = BrushData::DependsOnThePalette;
0
840 return bd;
never executed: return bd;
0
841 } -
842 -
843 if (gradType == 2) {
never evaluated: gradType == 2
0
844 QConicalGradient cg(vars.value(QLatin1String("cx")), vars.value(QLatin1String("cy")),
never executed (the execution status of this line is deduced): QConicalGradient cg(vars.value(QLatin1String("cx")), vars.value(QLatin1String("cy")),
-
845 vars.value(QLatin1String("angle")));
never executed (the execution status of this line is deduced): vars.value(QLatin1String("angle")));
-
846 cg.setCoordinateMode(QGradient::ObjectBoundingMode);
never executed (the execution status of this line is deduced): cg.setCoordinateMode(QGradient::ObjectBoundingMode);
-
847 cg.setStops(stops);
never executed (the execution status of this line is deduced): cg.setStops(stops);
-
848 if (spread != -1)
never evaluated: spread != -1
0
849 cg.setSpread(QGradient::Spread(spread));
never executed: cg.setSpread(QGradient::Spread(spread));
0
850 BrushData bd = QBrush(cg);
never executed (the execution status of this line is deduced): BrushData bd = QBrush(cg);
-
851 if (dependsOnThePalette)
never evaluated: dependsOnThePalette
0
852 bd.type = BrushData::DependsOnThePalette;
never executed: bd.type = BrushData::DependsOnThePalette;
0
853 return bd;
never executed: return bd;
0
854 } -
855 -
856 return BrushData();
never executed: return BrushData();
0
857} -
858 -
859static QBrush brushFromData(const BrushData& c, const QPalette &pal) -
860{ -
861 if (c.type == BrushData::Role) {
partially evaluated: c.type == BrushData::Role
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
862 return pal.color(c.role);
never executed: return pal.color(c.role);
0
863 } else { -
864 return c.brush;
executed: return c.brush;
Execution Count:8
8
865 } -
866} -
867 -
868static BorderStyle parseStyleValue(QCss::Value v) -
869{ -
870 if (v.type == Value::KnownIdentifier) {
partially evaluated: v.type == Value::KnownIdentifier
TRUEFALSE
yes
Evaluation Count:416
no
Evaluation Count:0
0-416
871 switch (v.variant.toInt()) { -
872 case Value_None: -
873 return BorderStyle_None;
executed: return BorderStyle_None;
Execution Count:1
1
874 case Value_Dotted: -
875 return BorderStyle_Dotted;
never executed: return BorderStyle_Dotted;
0
876 case Value_Dashed: -
877 return BorderStyle_Dashed;
never executed: return BorderStyle_Dashed;
0
878 case Value_Solid: -
879 return BorderStyle_Solid;
executed: return BorderStyle_Solid;
Execution Count:4
4
880 case Value_Double: -
881 return BorderStyle_Double;
never executed: return BorderStyle_Double;
0
882 case Value_DotDash: -
883 return BorderStyle_DotDash;
never executed: return BorderStyle_DotDash;
0
884 case Value_DotDotDash: -
885 return BorderStyle_DotDotDash;
never executed: return BorderStyle_DotDotDash;
0
886 case Value_Groove: -
887 return BorderStyle_Groove;
never executed: return BorderStyle_Groove;
0
888 case Value_Ridge: -
889 return BorderStyle_Ridge;
never executed: return BorderStyle_Ridge;
0
890 case Value_Inset: -
891 return BorderStyle_Inset;
never executed: return BorderStyle_Inset;
0
892 case Value_Outset: -
893 return BorderStyle_Outset;
never executed: return BorderStyle_Outset;
0
894 case Value_Native: -
895 return BorderStyle_Native;
executed: return BorderStyle_Native;
Execution Count:411
411
896 default: -
897 break;
never executed: break;
0
898 } -
899 }
never executed: }
0
900 -
901 return BorderStyle_Unknown;
never executed: return BorderStyle_Unknown;
0
902} -
903 -
904void ValueExtractor::borderValue(const Declaration &decl, int *width, QCss::BorderStyle *style, QBrush *color) -
905{ -
906 if (decl.d->parsed.isValid()) {
evaluated: decl.d->parsed.isValid()
TRUEFALSE
yes
Evaluation Count:824
yes
Evaluation Count:392
392-824
907 BorderData data = qvariant_cast<BorderData>(decl.d->parsed);
executed (the execution status of this line is deduced): BorderData data = qvariant_cast<BorderData>(decl.d->parsed);
-
908 *width = lengthValueFromData(data.width, f);
executed (the execution status of this line is deduced): *width = lengthValueFromData(data.width, f);
-
909 *style = data.style;
executed (the execution status of this line is deduced): *style = data.style;
-
910 *color = data.color.type != BrushData::Invalid ? brushFromData(data.color, pal) : QBrush(QColor());
partially evaluated: data.color.type != BrushData::Invalid
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:824
0-824
911 return;
executed: return;
Execution Count:824
824
912 } -
913 -
914 *width = 0;
executed (the execution status of this line is deduced): *width = 0;
-
915 *style = BorderStyle_None;
executed (the execution status of this line is deduced): *style = BorderStyle_None;
-
916 *color = QColor();
executed (the execution status of this line is deduced): *color = QColor();
-
917 -
918 if (decl.d->values.isEmpty())
partially evaluated: decl.d->values.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:392
0-392
919 return;
never executed: return;
0
920 -
921 BorderData data;
executed (the execution status of this line is deduced): BorderData data;
-
922 data.width.number = 0;
executed (the execution status of this line is deduced): data.width.number = 0;
-
923 data.width.unit = LengthData::None;
executed (the execution status of this line is deduced): data.width.unit = LengthData::None;
-
924 data.style = BorderStyle_None;
executed (the execution status of this line is deduced): data.style = BorderStyle_None;
-
925 -
926 int i = 0;
executed (the execution status of this line is deduced): int i = 0;
-
927 if (decl.d->values.at(i).type == Value::Length || decl.d->values.at(i).type == Value::Number) {
evaluated: decl.d->values.at(i).type == Value::Length
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:391
partially evaluated: decl.d->values.at(i).type == Value::Number
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:391
0-391
928 data.width = lengthValue(decl.d->values.at(i));
executed (the execution status of this line is deduced): data.width = lengthValue(decl.d->values.at(i));
-
929 *width = lengthValueFromData(data.width, f);
executed (the execution status of this line is deduced): *width = lengthValueFromData(data.width, f);
-
930 if (++i >= decl.d->values.count()) {
partially evaluated: ++i >= decl.d->values.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
931 decl.d->parsed = QVariant::fromValue<BorderData>(data);
never executed (the execution status of this line is deduced): decl.d->parsed = QVariant::fromValue<BorderData>(data);
-
932 return;
never executed: return;
0
933 } -
934 }
executed: }
Execution Count:1
1
935 -
936 data.style = parseStyleValue(decl.d->values.at(i));
executed (the execution status of this line is deduced): data.style = parseStyleValue(decl.d->values.at(i));
-
937 if (data.style != BorderStyle_Unknown) {
partially evaluated: data.style != BorderStyle_Unknown
TRUEFALSE
yes
Evaluation Count:392
no
Evaluation Count:0
0-392
938 *style = data.style;
executed (the execution status of this line is deduced): *style = data.style;
-
939 if (++i >= decl.d->values.count()) {
partially evaluated: ++i >= decl.d->values.count()
TRUEFALSE
yes
Evaluation Count:392
no
Evaluation Count:0
0-392
940 decl.d->parsed = QVariant::fromValue<BorderData>(data);
executed (the execution status of this line is deduced): decl.d->parsed = QVariant::fromValue<BorderData>(data);
-
941 return;
executed: return;
Execution Count:392
392
942 } -
943 } else {
never executed: }
0
944 data.style = BorderStyle_None;
never executed (the execution status of this line is deduced): data.style = BorderStyle_None;
-
945 }
never executed: }
0
946 -
947 data.color = parseBrushValue(decl.d->values.at(i), pal);
never executed (the execution status of this line is deduced): data.color = parseBrushValue(decl.d->values.at(i), pal);
-
948 *color = brushFromData(data.color, pal);
never executed (the execution status of this line is deduced): *color = brushFromData(data.color, pal);
-
949 if (data.color.type != BrushData::DependsOnThePalette)
never evaluated: data.color.type != BrushData::DependsOnThePalette
0
950 decl.d->parsed = QVariant::fromValue<BorderData>(data);
never executed: decl.d->parsed = QVariant::fromValue<BorderData>(data);
0
951}
never executed: }
0
952 -
953static void parseShorthandBackgroundProperty(const QVector<QCss::Value> &values, BrushData *brush, QString *image, Repeat *repeat, Qt::Alignment *alignment, const QPalette &pal) -
954{ -
955 *brush = BrushData();
executed (the execution status of this line is deduced): *brush = BrushData();
-
956 *image = QString();
executed (the execution status of this line is deduced): *image = QString();
-
957 *repeat = Repeat_XY;
executed (the execution status of this line is deduced): *repeat = Repeat_XY;
-
958 *alignment = Qt::AlignTop | Qt::AlignLeft;
executed (the execution status of this line is deduced): *alignment = Qt::AlignTop | Qt::AlignLeft;
-
959 -
960 for (int i = 0; i < values.count(); ++i) {
evaluated: i < values.count()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
961 const QCss::Value &v = values.at(i);
executed (the execution status of this line is deduced): const QCss::Value &v = values.at(i);
-
962 if (v.type == Value::Uri) {
partially evaluated: v.type == Value::Uri
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
963 *image = v.variant.toString();
never executed (the execution status of this line is deduced): *image = v.variant.toString();
-
964 continue;
never executed: continue;
0
965 } else if (v.type == Value::KnownIdentifier && v.variant.toInt() == Value_None) {
partially evaluated: v.type == Value::KnownIdentifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
never evaluated: v.variant.toInt() == Value_None
0-4
966 *image = QString();
never executed (the execution status of this line is deduced): *image = QString();
-
967 continue;
never executed: continue;
0
968 } else if (v.type == Value::KnownIdentifier && v.variant.toInt() == Value_Transparent) {
partially evaluated: v.type == Value::KnownIdentifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
never evaluated: v.variant.toInt() == Value_Transparent
0-4
969 *brush = QBrush(Qt::transparent);
never executed (the execution status of this line is deduced): *brush = QBrush(Qt::transparent);
-
970 }
never executed: }
0
971 -
972 Repeat repeatAttempt = static_cast<Repeat>(findKnownValue(v.variant.toString(),
executed (the execution status of this line is deduced): Repeat repeatAttempt = static_cast<Repeat>(findKnownValue(v.variant.toString(),
-
973 repeats, NumKnownRepeats));
executed (the execution status of this line is deduced): repeats, NumKnownRepeats));
-
974 if (repeatAttempt != Repeat_Unknown) {
partially evaluated: repeatAttempt != Repeat_Unknown
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
975 *repeat = repeatAttempt;
never executed (the execution status of this line is deduced): *repeat = repeatAttempt;
-
976 continue;
never executed: continue;
0
977 } -
978 -
979 if (v.type == Value::KnownIdentifier) {
partially evaluated: v.type == Value::KnownIdentifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
980 const int start = i;
never executed (the execution status of this line is deduced): const int start = i;
-
981 int count = 1;
never executed (the execution status of this line is deduced): int count = 1;
-
982 if (i < values.count() - 1
never evaluated: i < values.count() - 1
0
983 && values.at(i + 1).type == Value::KnownIdentifier) {
never evaluated: values.at(i + 1).type == Value::KnownIdentifier
0
984 ++i;
never executed (the execution status of this line is deduced): ++i;
-
985 ++count;
never executed (the execution status of this line is deduced): ++count;
-
986 }
never executed: }
0
987 Qt::Alignment a = parseAlignment(values.constData() + start, count);
never executed (the execution status of this line is deduced): Qt::Alignment a = parseAlignment(values.constData() + start, count);
-
988 if (int(a) != 0) {
never evaluated: int(a) != 0
0
989 *alignment = a;
never executed (the execution status of this line is deduced): *alignment = a;
-
990 continue;
never executed: continue;
0
991 } -
992 i -= count - 1;
never executed (the execution status of this line is deduced): i -= count - 1;
-
993 }
never executed: }
0
994 -
995 *brush = parseBrushValue(v, pal);
executed (the execution status of this line is deduced): *brush = parseBrushValue(v, pal);
-
996 }
executed: }
Execution Count:4
4
997}
executed: }
Execution Count:4
4
998 -
999bool ValueExtractor::extractBackground(QBrush *brush, QString *image, Repeat *repeat, -
1000 Qt::Alignment *alignment, Origin *origin, Attachment *attachment, -
1001 Origin *clip) -
1002{ -
1003 bool hit = false;
executed (the execution status of this line is deduced): bool hit = false;
-
1004 for (int i = 0; i < declarations.count(); ++i) {
evaluated: i < declarations.count()
TRUEFALSE
yes
Evaluation Count:3448
yes
Evaluation Count:5492
3448-5492
1005 const Declaration &decl = declarations.at(i);
executed (the execution status of this line is deduced): const Declaration &decl = declarations.at(i);
-
1006 if (decl.d->values.isEmpty())
partially evaluated: decl.d->values.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3448
0-3448
1007 continue;
never executed: continue;
0
1008 const QCss::Value &val = decl.d->values.at(0);
executed (the execution status of this line is deduced): const QCss::Value &val = decl.d->values.at(0);
-
1009 switch (decl.d->propertyId) { -
1010 case BackgroundColor: -
1011 *brush = decl.brushValue();
executed (the execution status of this line is deduced): *brush = decl.brushValue();
-
1012 break;
executed: break;
Execution Count:87
87
1013 case BackgroundImage: -
1014 if (val.type == Value::Uri)
partially evaluated: val.type == Value::Uri
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1015 *image = val.variant.toString();
executed: *image = val.variant.toString();
Execution Count:3
3
1016 break;
executed: break;
Execution Count:3
3
1017 case BackgroundRepeat: -
1018 if (decl.d->parsed.isValid()) {
never evaluated: decl.d->parsed.isValid()
0
1019 *repeat = static_cast<Repeat>(decl.d->parsed.toInt());
never executed (the execution status of this line is deduced): *repeat = static_cast<Repeat>(decl.d->parsed.toInt());
-
1020 } else {
never executed: }
0
1021 *repeat = static_cast<Repeat>(findKnownValue(val.variant.toString(),
never executed (the execution status of this line is deduced): *repeat = static_cast<Repeat>(findKnownValue(val.variant.toString(),
-
1022 repeats, NumKnownRepeats));
never executed (the execution status of this line is deduced): repeats, NumKnownRepeats));
-
1023 decl.d->parsed = *repeat;
never executed (the execution status of this line is deduced): decl.d->parsed = *repeat;
-
1024 }
never executed: }
0
1025 break;
never executed: break;
0
1026 case BackgroundPosition: -
1027 *alignment = decl.alignmentValue();
never executed (the execution status of this line is deduced): *alignment = decl.alignmentValue();
-
1028 break;
never executed: break;
0
1029 case BackgroundOrigin: -
1030 *origin = decl.originValue();
never executed (the execution status of this line is deduced): *origin = decl.originValue();
-
1031 break;
never executed: break;
0
1032 case BackgroundClip: -
1033 *clip = decl.originValue();
never executed (the execution status of this line is deduced): *clip = decl.originValue();
-
1034 break;
never executed: break;
0
1035 case Background: -
1036 if (decl.d->parsed.isValid()) {
evaluated: decl.d->parsed.isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
1037 BackgroundData data = qvariant_cast<BackgroundData>(decl.d->parsed);
executed (the execution status of this line is deduced): BackgroundData data = qvariant_cast<BackgroundData>(decl.d->parsed);
-
1038 *brush = brushFromData(data.brush, pal);
executed (the execution status of this line is deduced): *brush = brushFromData(data.brush, pal);
-
1039 *image = data.image;
executed (the execution status of this line is deduced): *image = data.image;
-
1040 *repeat = data.repeat;
executed (the execution status of this line is deduced): *repeat = data.repeat;
-
1041 *alignment = data.alignment;
executed (the execution status of this line is deduced): *alignment = data.alignment;
-
1042 } else {
executed: }
Execution Count:4
4
1043 BrushData brushData;
executed (the execution status of this line is deduced): BrushData brushData;
-
1044 parseShorthandBackgroundProperty(decl.d->values, &brushData, image, repeat, alignment, pal);
executed (the execution status of this line is deduced): parseShorthandBackgroundProperty(decl.d->values, &brushData, image, repeat, alignment, pal);
-
1045 *brush = brushFromData(brushData, pal);
executed (the execution status of this line is deduced): *brush = brushFromData(brushData, pal);
-
1046 if (brushData.type != BrushData::DependsOnThePalette) {
partially evaluated: brushData.type != BrushData::DependsOnThePalette
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
1047 BackgroundData data = { brushData, *image, *repeat, *alignment };
executed (the execution status of this line is deduced): BackgroundData data = { brushData, *image, *repeat, *alignment };
-
1048 decl.d->parsed = QVariant::fromValue<BackgroundData>(data);
executed (the execution status of this line is deduced): decl.d->parsed = QVariant::fromValue<BackgroundData>(data);
-
1049 }
executed: }
Execution Count:4
4
1050 }
executed: }
Execution Count:4
4
1051 break;
executed: break;
Execution Count:8
8
1052 case BackgroundAttachment: -
1053 *attachment = decl.attachmentValue();
never executed (the execution status of this line is deduced): *attachment = decl.attachmentValue();
-
1054 break;
never executed: break;
0
1055 default: continue;
executed: continue;
Execution Count:3350
3350
1056 } -
1057 hit = true;
executed (the execution status of this line is deduced): hit = true;
-
1058 }
executed: }
Execution Count:98
98
1059 return hit;
executed: return hit;
Execution Count:5492
5492
1060} -
1061 -
1062static bool setFontSizeFromValue(QCss::Value value, QFont *font, int *fontSizeAdjustment) -
1063{ -
1064 if (value.type == Value::KnownIdentifier) {
evaluated: value.type == Value::KnownIdentifier
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:23
1-23
1065 bool valid = true;
executed (the execution status of this line is deduced): bool valid = true;
-
1066 switch (value.variant.toInt()) { -
1067 case Value_Small: *fontSizeAdjustment = -1; break;
never executed: break;
0
1068 case Value_Medium: *fontSizeAdjustment = 0; break;
never executed: break;
0
1069 case Value_Large: *fontSizeAdjustment = 1; break;
executed: break;
Execution Count:1
1
1070 case Value_XLarge: *fontSizeAdjustment = 2; break;
never executed: break;
0
1071 case Value_XXLarge: *fontSizeAdjustment = 3; break;
never executed: break;
0
1072 default: valid = false; break;
never executed: break;
0
1073 } -
1074 return valid;
executed: return valid;
Execution Count:1
1
1075 } -
1076 if (value.type != Value::Length)
partially evaluated: value.type != Value::Length
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23
0-23
1077 return false;
never executed: return false;
0
1078 -
1079 bool valid = false;
executed (the execution status of this line is deduced): bool valid = false;
-
1080 QString s = value.variant.toString();
executed (the execution status of this line is deduced): QString s = value.variant.toString();
-
1081 if (s.endsWith(QLatin1String("pt"), Qt::CaseInsensitive)) {
evaluated: s.endsWith(QLatin1String("pt"), Qt::CaseInsensitive)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:9
9-14
1082 s.chop(2);
executed (the execution status of this line is deduced): s.chop(2);
-
1083 value.variant = s;
executed (the execution status of this line is deduced): value.variant = s;
-
1084 if (value.variant.convert((QVariant::Type)qMetaTypeId<qreal>())) {
partially evaluated: value.variant.convert((QVariant::Type)qMetaTypeId<qreal>())
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1085 font->setPointSizeF(value.variant.toReal());
executed (the execution status of this line is deduced): font->setPointSizeF(value.variant.toReal());
-
1086 valid = true;
executed (the execution status of this line is deduced): valid = true;
-
1087 }
executed: }
Execution Count:14
14
1088 } else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) {
executed: }
Execution Count:14
partially evaluated: s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-14
1089 s.chop(2);
executed (the execution status of this line is deduced): s.chop(2);
-
1090 value.variant = s;
executed (the execution status of this line is deduced): value.variant = s;
-
1091 if (value.variant.convert(QVariant::Int)) {
partially evaluated: value.variant.convert(QVariant::Int)
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
1092 font->setPixelSize(value.variant.toInt());
executed (the execution status of this line is deduced): font->setPixelSize(value.variant.toInt());
-
1093 valid = true;
executed (the execution status of this line is deduced): valid = true;
-
1094 }
executed: }
Execution Count:9
9
1095 }
executed: }
Execution Count:9
9
1096 return valid;
executed: return valid;
Execution Count:23
23
1097} -
1098 -
1099static bool setFontStyleFromValue(const QCss::Value &value, QFont *font) -
1100{ -
1101 if (value.type != Value::KnownIdentifier)
evaluated: value.type != Value::KnownIdentifier
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:13
6-13
1102 return false ;
executed: return false ;
Execution Count:6
6
1103 switch (value.variant.toInt()) { -
1104 case Value_Normal: font->setStyle(QFont::StyleNormal); return true;
executed: return true;
Execution Count:8
8
1105 case Value_Italic: font->setStyle(QFont::StyleItalic); return true;
executed: return true;
Execution Count:2
2
1106 case Value_Oblique: font->setStyle(QFont::StyleOblique); return true;
never executed: return true;
0
1107 default: break;
executed: break;
Execution Count:3
3
1108 } -
1109 return false;
executed: return false;
Execution Count:3
3
1110} -
1111 -
1112static bool setFontWeightFromValue(const QCss::Value &value, QFont *font) -
1113{ -
1114 if (value.type == Value::KnownIdentifier) {
evaluated: value.type == Value::KnownIdentifier
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:13
5-13
1115 switch (value.variant.toInt()) { -
1116 case Value_Normal: font->setWeight(QFont::Normal); return true;
never executed: return true;
0
1117 case Value_Bold: font->setWeight(QFont::Bold); return true;
executed: return true;
Execution Count:5
5
1118 default: break;
never executed: break;
0
1119 } -
1120 return false;
never executed: return false;
0
1121 } -
1122 if (value.type != Value::Number)
evaluated: value.type != Value::Number
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:7
6-7
1123 return false;
executed: return false;
Execution Count:6
6
1124 font->setWeight(qMin(value.variant.toInt() / 8, 99));
executed (the execution status of this line is deduced): font->setWeight(qMin(value.variant.toInt() / 8, 99));
-
1125 return true;
executed: return true;
Execution Count:7
7
1126} -
1127 -
1128/** \internal -
1129 * parse the font family from the values (starting from index \a start) -
1130 * and set it the \a font -
1131 * The function returns true if a family was extracted. -
1132 */ -
1133static bool setFontFamilyFromValues(const QVector<QCss::Value> &values, QFont *font, int start = 0) -
1134{ -
1135 QString family;
executed (the execution status of this line is deduced): QString family;
-
1136 bool shouldAddSpace = false;
executed (the execution status of this line is deduced): bool shouldAddSpace = false;
-
1137 for (int i = start; i < values.count(); ++i) {
evaluated: i < values.count()
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:17
17-23
1138 const QCss::Value &v = values.at(i);
executed (the execution status of this line is deduced): const QCss::Value &v = values.at(i);
-
1139 if (v.type == Value::TermOperatorComma) {
evaluated: v.type == Value::TermOperatorComma
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:21
2-21
1140 family += QLatin1Char(',');
executed (the execution status of this line is deduced): family += QLatin1Char(',');
-
1141 shouldAddSpace = false;
executed (the execution status of this line is deduced): shouldAddSpace = false;
-
1142 continue;
executed: continue;
Execution Count:2
2
1143 } -
1144 const QString str = v.variant.toString();
executed (the execution status of this line is deduced): const QString str = v.variant.toString();
-
1145 if (str.isEmpty())
partially evaluated: str.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
1146 break;
never executed: break;
0
1147 if (shouldAddSpace)
evaluated: shouldAddSpace
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:19
2-19
1148 family += QLatin1Char(' ');
executed: family += QLatin1Char(' ');
Execution Count:2
2
1149 family += str;
executed (the execution status of this line is deduced): family += str;
-
1150 shouldAddSpace = true;
executed (the execution status of this line is deduced): shouldAddSpace = true;
-
1151 }
executed: }
Execution Count:21
21
1152 if (family.isEmpty())
partially evaluated: family.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
1153 return false;
never executed: return false;
0
1154 font->setFamily(family);
executed (the execution status of this line is deduced): font->setFamily(family);
-
1155 return true;
executed: return true;
Execution Count:17
17
1156} -
1157 -
1158static void setTextDecorationFromValues(const QVector<QCss::Value> &values, QFont *font) -
1159{ -
1160 for (int i = 0; i < values.count(); ++i) {
evaluated: i < values.count()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:5
5-7
1161 if (values.at(i).type != Value::KnownIdentifier)
partially evaluated: values.at(i).type != Value::KnownIdentifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
1162 continue;
never executed: continue;
0
1163 switch (values.at(i).variant.toInt()) { -
1164 case Value_Underline: font->setUnderline(true); break;
executed: break;
Execution Count:1
1
1165 case Value_Overline: font->setOverline(true); break;
executed: break;
Execution Count:3
3
1166 case Value_LineThrough: font->setStrikeOut(true); break;
executed: break;
Execution Count:1
1
1167 case Value_None: -
1168 font->setUnderline(false);
executed (the execution status of this line is deduced): font->setUnderline(false);
-
1169 font->setOverline(false);
executed (the execution status of this line is deduced): font->setOverline(false);
-
1170 font->setStrikeOut(false);
executed (the execution status of this line is deduced): font->setStrikeOut(false);
-
1171 break;
executed: break;
Execution Count:2
2
1172 default: break;
never executed: break;
0
1173 } -
1174 }
executed: }
Execution Count:7
7
1175}
executed: }
Execution Count:5
5
1176 -
1177static void parseShorthandFontProperty(const QVector<QCss::Value> &values, QFont *font, int *fontSizeAdjustment) -
1178{ -
1179 font->setStyle(QFont::StyleNormal);
executed (the execution status of this line is deduced): font->setStyle(QFont::StyleNormal);
-
1180 font->setWeight(QFont::Normal);
executed (the execution status of this line is deduced): font->setWeight(QFont::Normal);
-
1181 *fontSizeAdjustment = -255;
executed (the execution status of this line is deduced): *fontSizeAdjustment = -255;
-
1182 -
1183 int i = 0;
executed (the execution status of this line is deduced): int i = 0;
-
1184 while (i < values.count()) {
partially evaluated: i < values.count()
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-11
1185 if (setFontStyleFromValue(values.at(i), font)
evaluated: setFontStyleFromValue(values.at(i), font)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:9
2-9
1186 || setFontWeightFromValue(values.at(i), font))
evaluated: setFontWeightFromValue(values.at(i), font)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:6
3-6
1187 ++i;
executed: ++i;
Execution Count:5
5
1188 else -
1189 break;
executed: break;
Execution Count:6
6
1190 } -
1191 -
1192 if (i < values.count()) {
partially evaluated: i < values.count()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
1193 setFontSizeFromValue(values.at(i), font, fontSizeAdjustment);
executed (the execution status of this line is deduced): setFontSizeFromValue(values.at(i), font, fontSizeAdjustment);
-
1194 ++i;
executed (the execution status of this line is deduced): ++i;
-
1195 }
executed: }
Execution Count:6
6
1196 -
1197 if (i < values.count()) {
evaluated: i < values.count()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
1198 setFontFamilyFromValues(values, font, i);
executed (the execution status of this line is deduced): setFontFamilyFromValues(values, font, i);
-
1199 }
executed: }
Execution Count:4
4
1200}
executed: }
Execution Count:6
6
1201 -
1202static void setFontVariantFromValue(const QCss::Value &value, QFont *font) -
1203{ -
1204 if (value.type == Value::KnownIdentifier) {
partially evaluated: value.type == Value::KnownIdentifier
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1205 switch (value.variant.toInt()) { -
1206 case Value_Normal: font->setCapitalization(QFont::MixedCase); break;
never executed: break;
0
1207 case Value_SmallCaps: font->setCapitalization(QFont::SmallCaps); break;
executed: break;
Execution Count:1
1
1208 default: break;
never executed: break;
0
1209 } -
1210 }
executed: }
Execution Count:1
1
1211}
executed: }
Execution Count:1
1
1212 -
1213static void setTextTransformFromValue(const QCss::Value &value, QFont *font) -
1214{ -
1215 if (value.type == Value::KnownIdentifier) {
partially evaluated: value.type == Value::KnownIdentifier
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1216 switch (value.variant.toInt()) { -
1217 case Value_None: font->setCapitalization(QFont::MixedCase); break;
never executed: break;
0
1218 case Value_Uppercase: font->setCapitalization(QFont::AllUppercase); break;
executed: break;
Execution Count:1
1
1219 case Value_Lowercase: font->setCapitalization(QFont::AllLowercase); break;
executed: break;
Execution Count:1
1
1220 default: break;
never executed: break;
0
1221 } -
1222 }
executed: }
Execution Count:2
2
1223}
executed: }
Execution Count:2
2
1224 -
1225bool ValueExtractor::extractFont(QFont *font, int *fontSizeAdjustment) -
1226{ -
1227 if (fontExtracted) {
evaluated: fontExtracted
TRUEFALSE
yes
Evaluation Count:5492
yes
Evaluation Count:5492
5492
1228 *font = f;
executed (the execution status of this line is deduced): *font = f;
-
1229 *fontSizeAdjustment = adjustment;
executed (the execution status of this line is deduced): *fontSizeAdjustment = adjustment;
-
1230 return fontExtracted == 1;
executed: return fontExtracted == 1;
Execution Count:5492
5492
1231 } -
1232 -
1233 bool hit = false;
executed (the execution status of this line is deduced): bool hit = false;
-
1234 for (int i = 0; i < declarations.count(); ++i) {
evaluated: i < declarations.count()
TRUEFALSE
yes
Evaluation Count:3448
yes
Evaluation Count:5492
3448-5492
1235 const Declaration &decl = declarations.at(i);
executed (the execution status of this line is deduced): const Declaration &decl = declarations.at(i);
-
1236 if (decl.d->values.isEmpty())
partially evaluated: decl.d->values.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3448
0-3448
1237 continue;
never executed: continue;
0
1238 const QCss::Value &val = decl.d->values.at(0);
executed (the execution status of this line is deduced): const QCss::Value &val = decl.d->values.at(0);
-
1239 switch (decl.d->propertyId) { -
1240 case FontSize: setFontSizeFromValue(val, font, fontSizeAdjustment); break;
executed: break;
Execution Count:18
18
1241 case FontStyle: setFontStyleFromValue(val, font); break;
executed: break;
Execution Count:8
8
1242 case FontWeight: setFontWeightFromValue(val, font); break;
executed: break;
Execution Count:9
9
1243 case FontFamily: setFontFamilyFromValues(decl.d->values, font); break;
executed: break;
Execution Count:13
13
1244 case TextDecoration: setTextDecorationFromValues(decl.d->values, font); break;
executed: break;
Execution Count:5
5
1245 case Font: parseShorthandFontProperty(decl.d->values, font, fontSizeAdjustment); break;
executed: break;
Execution Count:6
6
1246 case FontVariant: setFontVariantFromValue(val, font); break;
executed: break;
Execution Count:1
1
1247 case TextTransform: setTextTransformFromValue(val, font); break;
executed: break;
Execution Count:2
2
1248 default: continue;
executed: continue;
Execution Count:3386
3386
1249 } -
1250 hit = true;
executed (the execution status of this line is deduced): hit = true;
-
1251 }
executed: }
Execution Count:62
62
1252 -
1253 f = *font;
executed (the execution status of this line is deduced): f = *font;
-
1254 adjustment = *fontSizeAdjustment;
executed (the execution status of this line is deduced): adjustment = *fontSizeAdjustment;
-
1255 fontExtracted = hit ? 1 : 2;
evaluated: hit
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:5450
42-5450
1256 return hit;
executed: return hit;
Execution Count:5492
5492
1257} -
1258 -
1259bool ValueExtractor::extractPalette(QBrush *fg, QBrush *sfg, QBrush *sbg, QBrush *abg) -
1260{ -
1261 bool hit = false;
executed (the execution status of this line is deduced): bool hit = false;
-
1262 for (int i = 0; i < declarations.count(); ++i) {
evaluated: i < declarations.count()
TRUEFALSE
yes
Evaluation Count:2915
yes
Evaluation Count:3726
2915-3726
1263 const Declaration &decl = declarations.at(i);
executed (the execution status of this line is deduced): const Declaration &decl = declarations.at(i);
-
1264 switch (decl.d->propertyId) { -
1265 case Color: *fg = decl.brushValue(pal); break;
never executed: break;
0
1266 case QtSelectionForeground: *sfg = decl.brushValue(pal); break;
never executed: break;
0
1267 case QtSelectionBackground: *sbg = decl.brushValue(pal); break;
never executed: break;
0
1268 case QtAlternateBackground: *abg = decl.brushValue(pal); break;
never executed: break;
0
1269 default: continue;
executed: continue;
Execution Count:2915
2915
1270 } -
1271 hit = true;
never executed (the execution status of this line is deduced): hit = true;
-
1272 }
never executed: }
0
1273 return hit;
executed: return hit;
Execution Count:3726
3726
1274} -
1275 -
1276void ValueExtractor::extractFont() -
1277{ -
1278 if (fontExtracted)
evaluated: fontExtracted
TRUEFALSE
yes
Evaluation Count:14904
yes
Evaluation Count:5492
5492-14904
1279 return;
executed: return;
Execution Count:14904
14904
1280 int dummy = -255;
executed (the execution status of this line is deduced): int dummy = -255;
-
1281 extractFont(&f, &dummy);
executed (the execution status of this line is deduced): extractFont(&f, &dummy);
-
1282}
executed: }
Execution Count:5492
5492
1283 -
1284bool ValueExtractor::extractImage(QIcon *icon, Qt::Alignment *a, QSize *size) -
1285{ -
1286 bool hit = false;
executed (the execution status of this line is deduced): bool hit = false;
-
1287 for (int i = 0; i < declarations.count(); ++i) {
evaluated: i < declarations.count()
TRUEFALSE
yes
Evaluation Count:2915
yes
Evaluation Count:3726
2915-3726
1288 const Declaration &decl = declarations.at(i);
executed (the execution status of this line is deduced): const Declaration &decl = declarations.at(i);
-
1289 switch (decl.d->propertyId) { -
1290 case QtImage: -
1291 *icon = decl.iconValue();
never executed (the execution status of this line is deduced): *icon = decl.iconValue();
-
1292 if (decl.d->values.count() > 0 && decl.d->values.at(0).type == Value::Uri) {
never evaluated: decl.d->values.count() > 0
never evaluated: decl.d->values.at(0).type == Value::Uri
0
1293 // try to pull just the size from the image... -
1294 QImageReader imageReader(decl.d->values.at(0).variant.toString());
never executed (the execution status of this line is deduced): QImageReader imageReader(decl.d->values.at(0).variant.toString());
-
1295 if ((*size = imageReader.size()).isNull()) {
never evaluated: (*size = imageReader.size()).isNull()
0
1296 // but we'll have to load the whole image if the -
1297 // format doesn't support just reading the size -
1298 *size = imageReader.read().size();
never executed (the execution status of this line is deduced): *size = imageReader.read().size();
-
1299 }
never executed: }
0
1300 }
never executed: }
0
1301 break;
never executed: break;
0
1302 case QtImageAlignment: *a = decl.alignmentValue(); break;
never executed: break;
0
1303 default: continue;
executed: continue;
Execution Count:2915
2915
1304 } -
1305 hit = true;
never executed (the execution status of this line is deduced): hit = true;
-
1306 }
never executed: }
0
1307 return hit;
executed: return hit;
Execution Count:3726
3726
1308} -
1309 -
1310/////////////////////////////////////////////////////////////////////////////// -
1311// Declaration -
1312QColor Declaration::colorValue(const QPalette &pal) const -
1313{ -
1314 if (d->values.count() != 1)
partially evaluated: d->values.count() != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
1315 return QColor();
never executed: return QColor();
0
1316 -
1317 if (d->parsed.isValid()) {
partially evaluated: d->parsed.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
1318 if (d->parsed.type() == QVariant::Color)
never evaluated: d->parsed.type() == QVariant::Color
0
1319 return qvariant_cast<QColor>(d->parsed);
never executed: return qvariant_cast<QColor>(d->parsed);
0
1320 if (d->parsed.type() == QVariant::Int)
never evaluated: d->parsed.type() == QVariant::Int
0
1321 return pal.color((QPalette::ColorRole)(d->parsed.toInt()));
never executed: return pal.color((QPalette::ColorRole)(d->parsed.toInt()));
0
1322 }
never executed: }
0
1323 -
1324 ColorData color = parseColorValue(d->values.at(0));
executed (the execution status of this line is deduced): ColorData color = parseColorValue(d->values.at(0));
-
1325 if(color.type == ColorData::Role) {
partially evaluated: color.type == ColorData::Role
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
1326 d->parsed = QVariant::fromValue<int>(color.role);
never executed (the execution status of this line is deduced): d->parsed = QVariant::fromValue<int>(color.role);
-
1327 return pal.color((QPalette::ColorRole)(color.role));
never executed: return pal.color((QPalette::ColorRole)(color.role));
0
1328 } else { -
1329 d->parsed = QVariant::fromValue<QColor>(color.color);
executed (the execution status of this line is deduced): d->parsed = QVariant::fromValue<QColor>(color.color);
-
1330 return color.color;
executed: return color.color;
Execution Count:14
14
1331 } -
1332} -
1333 -
1334QBrush Declaration::brushValue(const QPalette &pal) const -
1335{ -
1336 if (d->values.count() != 1)
partially evaluated: d->values.count() != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:87
0-87
1337 return QBrush();
never executed: return QBrush();
0
1338 -
1339 if (d->parsed.isValid()) {
evaluated: d->parsed.isValid()
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:46
41-46
1340 if (d->parsed.type() == QVariant::Brush)
partially evaluated: d->parsed.type() == QVariant::Brush
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
0-41
1341 return qvariant_cast<QBrush>(d->parsed);
executed: return qvariant_cast<QBrush>(d->parsed);
Execution Count:41
41
1342 if (d->parsed.type() == QVariant::Int)
never evaluated: d->parsed.type() == QVariant::Int
0
1343 return pal.color((QPalette::ColorRole)(d->parsed.toInt()));
never executed: return pal.color((QPalette::ColorRole)(d->parsed.toInt()));
0
1344 }
never executed: }
0
1345 -
1346 BrushData data = parseBrushValue(d->values.at(0), pal);
executed (the execution status of this line is deduced): BrushData data = parseBrushValue(d->values.at(0), pal);
-
1347 -
1348 if(data.type == BrushData::Role) {
partially evaluated: data.type == BrushData::Role
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
0-46
1349 d->parsed = QVariant::fromValue<int>(data.role);
never executed (the execution status of this line is deduced): d->parsed = QVariant::fromValue<int>(data.role);
-
1350 return pal.color((QPalette::ColorRole)(data.role));
never executed: return pal.color((QPalette::ColorRole)(data.role));
0
1351 } else { -
1352 if (data.type != BrushData::DependsOnThePalette)
partially evaluated: data.type != BrushData::DependsOnThePalette
TRUEFALSE
yes
Evaluation Count:46
no
Evaluation Count:0
0-46
1353 d->parsed = QVariant::fromValue<QBrush>(data.brush);
executed: d->parsed = QVariant::fromValue<QBrush>(data.brush);
Execution Count:46
46
1354 return data.brush;
executed: return data.brush;
Execution Count:46
46
1355 } -
1356} -
1357 -
1358void Declaration::brushValues(QBrush *c, const QPalette &pal) const -
1359{ -
1360 int needParse = 0x1f; // bits 0..3 say if we should parse the corresponding value.
never executed (the execution status of this line is deduced): int needParse = 0x1f;
-
1361 // the bit 4 say we need to update d->parsed -
1362 int i = 0;
never executed (the execution status of this line is deduced): int i = 0;
-
1363 if (d->parsed.isValid()) {
never evaluated: d->parsed.isValid()
0
1364 needParse = 0;
never executed (the execution status of this line is deduced): needParse = 0;
-
1365 QList<QVariant> v = d->parsed.toList();
never executed (the execution status of this line is deduced): QList<QVariant> v = d->parsed.toList();
-
1366 for (i = 0; i < qMin(v.count(), 4); i++) {
never evaluated: i < qMin(v.count(), 4)
0
1367 if (v.at(i).type() == QVariant::Brush) {
never evaluated: v.at(i).type() == QVariant::Brush
0
1368 c[i] = qvariant_cast<QBrush>(v.at(i));
never executed (the execution status of this line is deduced): c[i] = qvariant_cast<QBrush>(v.at(i));
-
1369 } else if (v.at(i).type() == QVariant::Int) {
never executed: }
never evaluated: v.at(i).type() == QVariant::Int
0
1370 c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt()));
never executed (the execution status of this line is deduced): c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt()));
-
1371 } else {
never executed: }
0
1372 needParse |= (1<<i);
never executed (the execution status of this line is deduced): needParse |= (1<<i);
-
1373 }
never executed: }
0
1374 } -
1375 }
never executed: }
0
1376 if (needParse != 0) {
never evaluated: needParse != 0
0
1377 QList<QVariant> v;
never executed (the execution status of this line is deduced): QList<QVariant> v;
-
1378 for (i = 0; i < qMin(d->values.count(), 4); i++) {
never evaluated: i < qMin(d->values.count(), 4)
0
1379 if (!(needParse & (1<<i)))
never evaluated: !(needParse & (1<<i))
0
1380 continue;
never executed: continue;
0
1381 BrushData data = parseBrushValue(d->values.at(i), pal);
never executed (the execution status of this line is deduced): BrushData data = parseBrushValue(d->values.at(i), pal);
-
1382 if(data.type == BrushData::Role) {
never evaluated: data.type == BrushData::Role
0
1383 v += QVariant::fromValue<int>(data.role);
never executed (the execution status of this line is deduced): v += QVariant::fromValue<int>(data.role);
-
1384 c[i] = pal.color((QPalette::ColorRole)(data.role));
never executed (the execution status of this line is deduced): c[i] = pal.color((QPalette::ColorRole)(data.role));
-
1385 } else {
never executed: }
0
1386 if (data.type != BrushData::DependsOnThePalette) {
never evaluated: data.type != BrushData::DependsOnThePalette
0
1387 v += QVariant::fromValue<QBrush>(data.brush);
never executed (the execution status of this line is deduced): v += QVariant::fromValue<QBrush>(data.brush);
-
1388 } else {
never executed: }
0
1389 v += QVariant();
never executed (the execution status of this line is deduced): v += QVariant();
-
1390 }
never executed: }
0
1391 c[i] = data.brush;
never executed (the execution status of this line is deduced): c[i] = data.brush;
-
1392 }
never executed: }
0
1393 } -
1394 if (needParse & 0x10)
never evaluated: needParse & 0x10
0
1395 d->parsed = v;
never executed: d->parsed = v;
0
1396 }
never executed: }
0
1397 if (i == 0) c[0] = c[1] = c[2] = c[3] = QBrush();
never executed: c[0] = c[1] = c[2] = c[3] = QBrush();
never evaluated: i == 0
0
1398 else if (i == 1) c[3] = c[2] = c[1] = c[0];
never executed: c[3] = c[2] = c[1] = c[0];
never evaluated: i == 1
0
1399 else if (i == 2) c[2] = c[0], c[3] = c[1];
never executed: c[2] = c[0], c[3] = c[1];
never evaluated: i == 2
0
1400 else if (i == 3) c[3] = c[1];
never executed: c[3] = c[1];
never evaluated: i == 3
0
1401} -
1402 -
1403bool Declaration::realValue(qreal *real, const char *unit) const -
1404{ -
1405 if (d->values.count() != 1)
partially evaluated: d->values.count() != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
0-41
1406 return false;
never executed: return false;
0
1407 const Value &v = d->values.at(0);
executed (the execution status of this line is deduced): const Value &v = d->values.at(0);
-
1408 if (unit && v.type != Value::Length)
partially evaluated: unit
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
partially evaluated: v.type != Value::Length
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
0-41
1409 return false;
never executed: return false;
0
1410 QString s = v.variant.toString();
executed (the execution status of this line is deduced): QString s = v.variant.toString();
-
1411 if (unit) {
partially evaluated: unit
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
0-41
1412 if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive))
partially evaluated: !s.endsWith(QLatin1String(unit), Qt::CaseInsensitive)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
0-41
1413 return false;
never executed: return false;
0
1414 s.chop(qstrlen(unit));
executed (the execution status of this line is deduced): s.chop(qstrlen(unit));
-
1415 }
executed: }
Execution Count:41
41
1416 bool ok = false;
executed (the execution status of this line is deduced): bool ok = false;
-
1417 qreal val = s.toDouble(&ok);
executed (the execution status of this line is deduced): qreal val = s.toDouble(&ok);
-
1418 if (ok)
partially evaluated: ok
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
0-41
1419 *real = val;
executed: *real = val;
Execution Count:41
41
1420 return ok;
executed: return ok;
Execution Count:41
41
1421} -
1422 -
1423static bool intValueHelper(const QCss::Value &v, int *i, const char *unit) -
1424{ -
1425 if (unit && v.type != Value::Length)
partially evaluated: unit
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: v.type != Value::Length
0-2
1426 return false;
never executed: return false;
0
1427 QString s = v.variant.toString();
executed (the execution status of this line is deduced): QString s = v.variant.toString();
-
1428 if (unit) {
partially evaluated: unit
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1429 if (!s.endsWith(QLatin1String(unit), Qt::CaseInsensitive))
never evaluated: !s.endsWith(QLatin1String(unit), Qt::CaseInsensitive)
0
1430 return false;
never executed: return false;
0
1431 s.chop(qstrlen(unit));
never executed (the execution status of this line is deduced): s.chop(qstrlen(unit));
-
1432 }
never executed: }
0
1433 bool ok = false;
executed (the execution status of this line is deduced): bool ok = false;
-
1434 int val = s.toInt(&ok);
executed (the execution status of this line is deduced): int val = s.toInt(&ok);
-
1435 if (ok)
partially evaluated: ok
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1436 *i = val;
executed: *i = val;
Execution Count:2
2
1437 return ok;
executed: return ok;
Execution Count:2
2
1438} -
1439 -
1440bool Declaration::intValue(int *i, const char *unit) const -
1441{ -
1442 if (d->values.count() != 1)
partially evaluated: d->values.count() != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1443 return false;
never executed: return false;
0
1444 return intValueHelper(d->values.at(0), i, unit);
executed: return intValueHelper(d->values.at(0), i, unit);
Execution Count:2
2
1445} -
1446 -
1447QSize Declaration::sizeValue() const -
1448{ -
1449 if (d->parsed.isValid())
never evaluated: d->parsed.isValid()
0
1450 return qvariant_cast<QSize>(d->parsed);
never executed: return qvariant_cast<QSize>(d->parsed);
0
1451 -
1452 int x[2] = { 0, 0 };
never executed (the execution status of this line is deduced): int x[2] = { 0, 0 };
-
1453 if (d->values.count() > 0)
never evaluated: d->values.count() > 0
0
1454 intValueHelper(d->values.at(0), &x[0], "px");
never executed: intValueHelper(d->values.at(0), &x[0], "px");
0
1455 if (d->values.count() > 1)
never evaluated: d->values.count() > 1
0
1456 intValueHelper(d->values.at(1), &x[1], "px");
never executed: intValueHelper(d->values.at(1), &x[1], "px");
0
1457 else -
1458 x[1] = x[0];
never executed: x[1] = x[0];
0
1459 QSize size(x[0], x[1]);
never executed (the execution status of this line is deduced): QSize size(x[0], x[1]);
-
1460 d->parsed = QVariant::fromValue<QSize>(size);
never executed (the execution status of this line is deduced): d->parsed = QVariant::fromValue<QSize>(size);
-
1461 return size;
never executed: return size;
0
1462} -
1463 -
1464QRect Declaration::rectValue() const -
1465{ -
1466 if (d->values.count() != 1)
never evaluated: d->values.count() != 1
0
1467 return QRect();
never executed: return QRect();
0
1468 -
1469 if (d->parsed.isValid())
never evaluated: d->parsed.isValid()
0
1470 return qvariant_cast<QRect>(d->parsed);
never executed: return qvariant_cast<QRect>(d->parsed);
0
1471 -
1472 const QCss::Value &v = d->values.at(0);
never executed (the execution status of this line is deduced): const QCss::Value &v = d->values.at(0);
-
1473 if (v.type != Value::Function)
never evaluated: v.type != Value::Function
0
1474 return QRect();
never executed: return QRect();
0
1475 QStringList func = v.variant.toStringList();
never executed (the execution status of this line is deduced): QStringList func = v.variant.toStringList();
-
1476 if (func.count() != 2 || func.at(0).compare(QLatin1String("rect")) != 0)
never evaluated: func.count() != 2
never evaluated: func.at(0).compare(QLatin1String("rect")) != 0
0
1477 return QRect();
never executed: return QRect();
0
1478 QStringList args = func[1].split(QLatin1Char(' '), QString::SkipEmptyParts);
never executed (the execution status of this line is deduced): QStringList args = func[1].split(QLatin1Char(' '), QString::SkipEmptyParts);
-
1479 if (args.count() != 4)
never evaluated: args.count() != 4
0
1480 return QRect();
never executed: return QRect();
0
1481 QRect rect(args[0].toInt(), args[1].toInt(), args[2].toInt(), args[3].toInt());
never executed (the execution status of this line is deduced): QRect rect(args[0].toInt(), args[1].toInt(), args[2].toInt(), args[3].toInt());
-
1482 d->parsed = QVariant::fromValue<QRect>(rect);
never executed (the execution status of this line is deduced): d->parsed = QVariant::fromValue<QRect>(rect);
-
1483 return rect;
never executed: return rect;
0
1484} -
1485 -
1486void Declaration::colorValues(QColor *c, const QPalette &pal) const -
1487{ -
1488 int i;
never executed (the execution status of this line is deduced): int i;
-
1489 if (d->parsed.isValid()) {
never evaluated: d->parsed.isValid()
0
1490 QList<QVariant> v = d->parsed.toList();
never executed (the execution status of this line is deduced): QList<QVariant> v = d->parsed.toList();
-
1491 for (i = 0; i < qMin(d->values.count(), 4); i++) {
never evaluated: i < qMin(d->values.count(), 4)
0
1492 if (v.at(i).type() == QVariant::Color) {
never evaluated: v.at(i).type() == QVariant::Color
0
1493 c[i] = qvariant_cast<QColor>(v.at(i));
never executed (the execution status of this line is deduced): c[i] = qvariant_cast<QColor>(v.at(i));
-
1494 } else {
never executed: }
0
1495 c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt()));
never executed (the execution status of this line is deduced): c[i] = pal.color((QPalette::ColorRole)(v.at(i).toInt()));
-
1496 }
never executed: }
0
1497 } -
1498 } else {
never executed: }
0
1499 QList<QVariant> v;
never executed (the execution status of this line is deduced): QList<QVariant> v;
-
1500 for (i = 0; i < qMin(d->values.count(), 4); i++) {
never evaluated: i < qMin(d->values.count(), 4)
0
1501 ColorData color = parseColorValue(d->values.at(i));
never executed (the execution status of this line is deduced): ColorData color = parseColorValue(d->values.at(i));
-
1502 if(color.type == ColorData::Role) {
never evaluated: color.type == ColorData::Role
0
1503 v += QVariant::fromValue<int>(color.role);
never executed (the execution status of this line is deduced): v += QVariant::fromValue<int>(color.role);
-
1504 c[i] = pal.color((QPalette::ColorRole)(color.role));
never executed (the execution status of this line is deduced): c[i] = pal.color((QPalette::ColorRole)(color.role));
-
1505 } else {
never executed: }
0
1506 v += QVariant::fromValue<QColor>(color.color);
never executed (the execution status of this line is deduced): v += QVariant::fromValue<QColor>(color.color);
-
1507 c[i] = color.color;
never executed (the execution status of this line is deduced): c[i] = color.color;
-
1508 }
never executed: }
0
1509 } -
1510 d->parsed = v;
never executed (the execution status of this line is deduced): d->parsed = v;
-
1511 }
never executed: }
0
1512 -
1513 if (i == 0) c[0] = c[1] = c[2] = c[3] = QColor();
never executed: c[0] = c[1] = c[2] = c[3] = QColor();
never evaluated: i == 0
0
1514 else if (i == 1) c[3] = c[2] = c[1] = c[0];
never executed: c[3] = c[2] = c[1] = c[0];
never evaluated: i == 1
0
1515 else if (i == 2) c[2] = c[0], c[3] = c[1];
never executed: c[2] = c[0], c[3] = c[1];
never evaluated: i == 2
0
1516 else if (i == 3) c[3] = c[1];
never executed: c[3] = c[1];
never evaluated: i == 3
0
1517} -
1518 -
1519BorderStyle Declaration::styleValue() const -
1520{ -
1521 if (d->values.count() != 1)
partially evaluated: d->values.count() != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1522 return BorderStyle_None;
never executed: return BorderStyle_None;
0
1523 return parseStyleValue(d->values.at(0));
executed: return parseStyleValue(d->values.at(0));
Execution Count:3
3
1524} -
1525 -
1526void Declaration::styleValues(BorderStyle *s) const -
1527{ -
1528 int i;
executed (the execution status of this line is deduced): int i;
-
1529 for (i = 0; i < qMin(d->values.count(), 4); i++)
evaluated: i < qMin(d->values.count(), 4)
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:21
21
1530 s[i] = parseStyleValue(d->values.at(i));
executed: s[i] = parseStyleValue(d->values.at(i));
Execution Count:21
21
1531 if (i == 0) s[0] = s[1] = s[2] = s[3] = BorderStyle_None;
never executed: s[0] = s[1] = s[2] = s[3] = BorderStyle_None;
partially evaluated: i == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
1532 else if (i == 1) s[3] = s[2] = s[1] = s[0];
executed: s[3] = s[2] = s[1] = s[0];
Execution Count:21
partially evaluated: i == 1
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
1533 else if (i == 2) s[2] = s[0], s[3] = s[1];
never executed: s[2] = s[0], s[3] = s[1];
never evaluated: i == 2
0
1534 else if (i == 3) s[3] = s[1];
never executed: s[3] = s[1];
never evaluated: i == 3
0
1535} -
1536 -
1537Repeat Declaration::repeatValue() const -
1538{ -
1539 if (d->parsed.isValid())
never evaluated: d->parsed.isValid()
0
1540 return static_cast<Repeat>(d->parsed.toInt());
never executed: return static_cast<Repeat>(d->parsed.toInt());
0
1541 if (d->values.count() != 1)
never evaluated: d->values.count() != 1
0
1542 return Repeat_Unknown;
never executed: return Repeat_Unknown;
0
1543 int v = findKnownValue(d->values.at(0).variant.toString(),
never executed (the execution status of this line is deduced): int v = findKnownValue(d->values.at(0).variant.toString(),
-
1544 repeats, NumKnownRepeats);
never executed (the execution status of this line is deduced): repeats, NumKnownRepeats);
-
1545 d->parsed = v;
never executed (the execution status of this line is deduced): d->parsed = v;
-
1546 return static_cast<Repeat>(v);
never executed: return static_cast<Repeat>(v);
0
1547} -
1548 -
1549Origin Declaration::originValue() const -
1550{ -
1551 if (d->parsed.isValid())
never evaluated: d->parsed.isValid()
0
1552 return static_cast<Origin>(d->parsed.toInt());
never executed: return static_cast<Origin>(d->parsed.toInt());
0
1553 if (d->values.count() != 1)
never evaluated: d->values.count() != 1
0
1554 return Origin_Unknown;
never executed: return Origin_Unknown;
0
1555 int v = findKnownValue(d->values.at(0).variant.toString(),
never executed (the execution status of this line is deduced): int v = findKnownValue(d->values.at(0).variant.toString(),
-
1556 origins, NumKnownOrigins);
never executed (the execution status of this line is deduced): origins, NumKnownOrigins);
-
1557 d->parsed = v;
never executed (the execution status of this line is deduced): d->parsed = v;
-
1558 return static_cast<Origin>(v);
never executed: return static_cast<Origin>(v);
0
1559} -
1560 -
1561PositionMode Declaration::positionValue() const -
1562{ -
1563 if (d->parsed.isValid())
never evaluated: d->parsed.isValid()
0
1564 return static_cast<PositionMode>(d->parsed.toInt());
never executed: return static_cast<PositionMode>(d->parsed.toInt());
0
1565 if (d->values.count() != 1)
never evaluated: d->values.count() != 1
0
1566 return PositionMode_Unknown;
never executed: return PositionMode_Unknown;
0
1567 int v = findKnownValue(d->values.at(0).variant.toString(),
never executed (the execution status of this line is deduced): int v = findKnownValue(d->values.at(0).variant.toString(),
-
1568 positions, NumKnownPositionModes);
never executed (the execution status of this line is deduced): positions, NumKnownPositionModes);
-
1569 d->parsed = v;
never executed (the execution status of this line is deduced): d->parsed = v;
-
1570 return static_cast<PositionMode>(v);
never executed: return static_cast<PositionMode>(v);
0
1571} -
1572 -
1573Attachment Declaration::attachmentValue() const -
1574{ -
1575 if (d->parsed.isValid())
never evaluated: d->parsed.isValid()
0
1576 return static_cast<Attachment>(d->parsed.toInt());
never executed: return static_cast<Attachment>(d->parsed.toInt());
0
1577 if (d->values.count() != 1)
never evaluated: d->values.count() != 1
0
1578 return Attachment_Unknown;
never executed: return Attachment_Unknown;
0
1579 int v = findKnownValue(d->values.at(0).variant.toString(),
never executed (the execution status of this line is deduced): int v = findKnownValue(d->values.at(0).variant.toString(),
-
1580 attachments, NumKnownAttachments);
never executed (the execution status of this line is deduced): attachments, NumKnownAttachments);
-
1581 d->parsed = v;
never executed (the execution status of this line is deduced): d->parsed = v;
-
1582 return static_cast<Attachment>(v);
never executed: return static_cast<Attachment>(v);
0
1583} -
1584 -
1585int Declaration::styleFeaturesValue() const -
1586{ -
1587 Q_ASSERT(d->propertyId == QtStyleFeatures);
executed (the execution status of this line is deduced): qt_noop();
-
1588 if (d->parsed.isValid())
evaluated: d->parsed.isValid()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:14
14-15
1589 return d->parsed.toInt();
executed: return d->parsed.toInt();
Execution Count:15
15
1590 int features = StyleFeature_None;
executed (the execution status of this line is deduced): int features = StyleFeature_None;
-
1591 for (int i = 0; i < d->values.count(); i++) {
evaluated: i < d->values.count()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:14
14
1592 features |= static_cast<int>(findKnownValue(d->values.value(i).variant.toString(),
executed (the execution status of this line is deduced): features |= static_cast<int>(findKnownValue(d->values.value(i).variant.toString(),
-
1593 styleFeatures, NumKnownStyleFeatures));
executed (the execution status of this line is deduced): styleFeatures, NumKnownStyleFeatures));
-
1594 }
executed: }
Execution Count:14
14
1595 d->parsed = features;
executed (the execution status of this line is deduced): d->parsed = features;
-
1596 return features;
executed: return features;
Execution Count:14
14
1597} -
1598 -
1599QString Declaration::uriValue() const -
1600{ -
1601 if (d->values.isEmpty() || d->values.at(0).type != Value::Uri)
never evaluated: d->values.isEmpty()
never evaluated: d->values.at(0).type != Value::Uri
0
1602 return QString();
never executed: return QString();
0
1603 return d->values.at(0).variant.toString();
never executed: return d->values.at(0).variant.toString();
0
1604} -
1605 -
1606Qt::Alignment Declaration::alignmentValue() const -
1607{ -
1608 if (d->parsed.isValid())
never evaluated: d->parsed.isValid()
0
1609 return Qt::Alignment(d->parsed.toInt());
never executed: return Qt::Alignment(d->parsed.toInt());
0
1610 if (d->values.isEmpty() || d->values.count() > 2)
never evaluated: d->values.isEmpty()
never evaluated: d->values.count() > 2
0
1611 return Qt::AlignLeft | Qt::AlignTop;
never executed: return Qt::AlignLeft | Qt::AlignTop;
0
1612 -
1613 Qt::Alignment v = parseAlignment(d->values.constData(), d->values.count());
never executed (the execution status of this line is deduced): Qt::Alignment v = parseAlignment(d->values.constData(), d->values.count());
-
1614 d->parsed = int(v);
never executed (the execution status of this line is deduced): d->parsed = int(v);
-
1615 return v;
never executed: return v;
0
1616} -
1617 -
1618void Declaration::borderImageValue(QString *image, int *cuts, -
1619 TileMode *h, TileMode *v) const -
1620{ -
1621 *image = uriValue();
never executed (the execution status of this line is deduced): *image = uriValue();
-
1622 for (int i = 0; i < 4; i++)
never evaluated: i < 4
0
1623 cuts[i] = -1;
never executed: cuts[i] = -1;
0
1624 *h = *v = TileMode_Stretch;
never executed (the execution status of this line is deduced): *h = *v = TileMode_Stretch;
-
1625 -
1626 if (d->values.count() < 2)
never evaluated: d->values.count() < 2
0
1627 return;
never executed: return;
0
1628 -
1629 if (d->values.at(1).type == Value::Number) { // cuts!
never evaluated: d->values.at(1).type == Value::Number
0
1630 int i;
never executed (the execution status of this line is deduced): int i;
-
1631 for (i = 0; i < qMin(d->values.count()-1, 4); i++) {
never evaluated: i < qMin(d->values.count()-1, 4)
0
1632 const Value& v = d->values.at(i+1);
never executed (the execution status of this line is deduced): const Value& v = d->values.at(i+1);
-
1633 if (v.type != Value::Number)
never evaluated: v.type != Value::Number
0
1634 break;
never executed: break;
0
1635 cuts[i] = v.variant.toString().toInt();
never executed (the execution status of this line is deduced): cuts[i] = v.variant.toString().toInt();
-
1636 }
never executed: }
0
1637 if (i == 0) cuts[0] = cuts[1] = cuts[2] = cuts[3] = 0;
never executed: cuts[0] = cuts[1] = cuts[2] = cuts[3] = 0;
never evaluated: i == 0
0
1638 else if (i == 1) cuts[3] = cuts[2] = cuts[1] = cuts[0];
never executed: cuts[3] = cuts[2] = cuts[1] = cuts[0];
never evaluated: i == 1
0
1639 else if (i == 2) cuts[2] = cuts[0], cuts[3] = cuts[1];
never executed: cuts[2] = cuts[0], cuts[3] = cuts[1];
never evaluated: i == 2
0
1640 else if (i == 3) cuts[3] = cuts[1];
never executed: cuts[3] = cuts[1];
never evaluated: i == 3
0
1641 } -
1642 -
1643 if (d->values.last().type == Value::Identifier) {
never evaluated: d->values.last().type == Value::Identifier
0
1644 *v = static_cast<TileMode>(findKnownValue(d->values.last().variant.toString(),
never executed (the execution status of this line is deduced): *v = static_cast<TileMode>(findKnownValue(d->values.last().variant.toString(),
-
1645 tileModes, NumKnownTileModes));
never executed (the execution status of this line is deduced): tileModes, NumKnownTileModes));
-
1646 }
never executed: }
0
1647 if (d->values[d->values.count() - 2].type == Value::Identifier) {
never evaluated: d->values[d->values.count() - 2].type == Value::Identifier
0
1648 *h = static_cast<TileMode>
never executed (the execution status of this line is deduced): *h = static_cast<TileMode>
-
1649 (findKnownValue(d->values[d->values.count()-2].variant.toString(),
never executed (the execution status of this line is deduced): (findKnownValue(d->values[d->values.count()-2].variant.toString(),
-
1650 tileModes, NumKnownTileModes));
never executed (the execution status of this line is deduced): tileModes, NumKnownTileModes));
-
1651 } else
never executed: }
0
1652 *h = *v;
never executed: *h = *v;
0
1653} -
1654 -
1655QIcon Declaration::iconValue() const -
1656{ -
1657 if (d->parsed.isValid())
never evaluated: d->parsed.isValid()
0
1658 return qvariant_cast<QIcon>(d->parsed);
never executed: return qvariant_cast<QIcon>(d->parsed);
0
1659 -
1660 QIcon icon;
never executed (the execution status of this line is deduced): QIcon icon;
-
1661 for (int i = 0; i < d->values.count();) {
never evaluated: i < d->values.count()
0
1662 const Value &value = d->values.at(i++);
never executed (the execution status of this line is deduced): const Value &value = d->values.at(i++);
-
1663 if (value.type != Value::Uri)
never evaluated: value.type != Value::Uri
0
1664 break;
never executed: break;
0
1665 QString uri = value.variant.toString();
never executed (the execution status of this line is deduced): QString uri = value.variant.toString();
-
1666 QIcon::Mode mode = QIcon::Normal;
never executed (the execution status of this line is deduced): QIcon::Mode mode = QIcon::Normal;
-
1667 QIcon::State state = QIcon::Off;
never executed (the execution status of this line is deduced): QIcon::State state = QIcon::Off;
-
1668 for (int j = 0; j < 2; j++) {
never evaluated: j < 2
0
1669 if (i != d->values.count() && d->values.at(i).type == Value::KnownIdentifier) {
never evaluated: i != d->values.count()
never evaluated: d->values.at(i).type == Value::KnownIdentifier
0
1670 switch (d->values.at(i).variant.toInt()) { -
1671 case Value_Disabled: mode = QIcon::Disabled; break;
never executed: break;
0
1672 case Value_Active: mode = QIcon::Active; break;
never executed: break;
0
1673 case Value_Selected: mode = QIcon::Selected; break;
never executed: break;
0
1674 case Value_Normal: mode = QIcon::Normal; break;
never executed: break;
0
1675 case Value_On: state = QIcon::On; break;
never executed: break;
0
1676 case Value_Off: state = QIcon::Off; break;
never executed: break;
0
1677 default: break;
never executed: break;
0
1678 } -
1679 ++i;
never executed (the execution status of this line is deduced): ++i;
-
1680 } else {
never executed: }
0
1681 break;
never executed: break;
0
1682 } -
1683 } -
1684 -
1685 // QIcon is soo broken -
1686 if (icon.isNull())
never evaluated: icon.isNull()
0
1687 icon = QIcon(uri);
never executed: icon = QIcon(uri);
0
1688 else -
1689 icon.addPixmap(uri, mode, state);
never executed: icon.addPixmap(uri, mode, state);
0
1690 -
1691 if (i == d->values.count())
never evaluated: i == d->values.count()
0
1692 break;
never executed: break;
0
1693 -
1694 if (d->values.at(i).type == Value::TermOperatorComma)
never evaluated: d->values.at(i).type == Value::TermOperatorComma
0
1695 i++;
never executed: i++;
0
1696 }
never executed: }
0
1697 -
1698 d->parsed = QVariant::fromValue<QIcon>(icon);
never executed (the execution status of this line is deduced): d->parsed = QVariant::fromValue<QIcon>(icon);
-
1699 return icon;
never executed: return icon;
0
1700} -
1701 -
1702/////////////////////////////////////////////////////////////////////////////// -
1703// Selector -
1704int Selector::specificity() const -
1705{ -
1706 int val = 0;
executed (the execution status of this line is deduced): int val = 0;
-
1707 for (int i = 0; i < basicSelectors.count(); ++i) {
evaluated: i < basicSelectors.count()
TRUEFALSE
yes
Evaluation Count:1763
yes
Evaluation Count:1763
1763
1708 const BasicSelector &sel = basicSelectors.at(i);
executed (the execution status of this line is deduced): const BasicSelector &sel = basicSelectors.at(i);
-
1709 if (!sel.elementName.isEmpty())
evaluated: !sel.elementName.isEmpty()
TRUEFALSE
yes
Evaluation Count:1724
yes
Evaluation Count:39
39-1724
1710 val += 1;
executed: val += 1;
Execution Count:1724
1724
1711 -
1712 val += (sel.pseudos.count() + sel.attributeSelectors.count()) * 0x10;
executed (the execution status of this line is deduced): val += (sel.pseudos.count() + sel.attributeSelectors.count()) * 0x10;
-
1713 val += sel.ids.count() * 0x100;
executed (the execution status of this line is deduced): val += sel.ids.count() * 0x100;
-
1714 }
executed: }
Execution Count:1763
1763
1715 return val;
executed: return val;
Execution Count:1763
1763
1716} -
1717 -
1718QString Selector::pseudoElement() const -
1719{ -
1720 const BasicSelector& bs = basicSelectors.last();
executed (the execution status of this line is deduced): const BasicSelector& bs = basicSelectors.last();
-
1721 if (!bs.pseudos.isEmpty() && bs.pseudos.at(0).type == PseudoClass_Unknown)
evaluated: !bs.pseudos.isEmpty()
TRUEFALSE
yes
Evaluation Count:110
yes
Evaluation Count:5109
evaluated: bs.pseudos.at(0).type == PseudoClass_Unknown
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:38
38-5109
1722 return bs.pseudos.at(0).name;
executed: return bs.pseudos.at(0).name;
Execution Count:72
72
1723 return QString();
executed: return QString();
Execution Count:5147
5147
1724} -
1725 -
1726quint64 Selector::pseudoClass(quint64 *negated) const -
1727{ -
1728 const BasicSelector& bs = basicSelectors.last();
executed (the execution status of this line is deduced): const BasicSelector& bs = basicSelectors.last();
-
1729 if (bs.pseudos.isEmpty())
evaluated: bs.pseudos.isEmpty()
TRUEFALSE
yes
Evaluation Count:16114
yes
Evaluation Count:77
77-16114
1730 return PseudoClass_Unspecified;
executed: return PseudoClass_Unspecified;
Execution Count:16114
16114
1731 quint64 pc = PseudoClass_Unknown;
executed (the execution status of this line is deduced): quint64 pc = PseudoClass_Unknown;
-
1732 for (int i = !pseudoElement().isEmpty(); i < bs.pseudos.count(); i++) {
evaluated: i < bs.pseudos.count()
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:77
30-77
1733 const Pseudo &pseudo = bs.pseudos.at(i);
executed (the execution status of this line is deduced): const Pseudo &pseudo = bs.pseudos.at(i);
-
1734 if (pseudo.type == PseudoClass_Unknown)
partially evaluated: pseudo.type == PseudoClass_Unknown
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30
0-30
1735 return PseudoClass_Unknown;
never executed: return PseudoClass_Unknown;
0
1736 if (!pseudo.negated)
partially evaluated: !pseudo.negated
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
1737 pc |= pseudo.type;
executed: pc |= pseudo.type;
Execution Count:30
30
1738 else if (negated)
never evaluated: negated
0
1739 *negated |= pseudo.type;
never executed: *negated |= pseudo.type;
0
1740 } -
1741 return pc;
executed: return pc;
Execution Count:77
77
1742} -
1743 -
1744/////////////////////////////////////////////////////////////////////////////// -
1745// StyleSheet -
1746void StyleSheet::buildIndexes(Qt::CaseSensitivity nameCaseSensitivity) -
1747{ -
1748 QVector<StyleRule> universals;
executed (the execution status of this line is deduced): QVector<StyleRule> universals;
-
1749 for (int i = 0; i < styleRules.count(); ++i) {
evaluated: i < styleRules.count()
TRUEFALSE
yes
Evaluation Count:6846
yes
Evaluation Count:1020
1020-6846
1750 const StyleRule &rule = styleRules.at(i);
executed (the execution status of this line is deduced): const StyleRule &rule = styleRules.at(i);
-
1751 QVector<Selector> universalsSelectors;
executed (the execution status of this line is deduced): QVector<Selector> universalsSelectors;
-
1752 for (int j = 0; j < rule.selectors.count(); ++j) {
evaluated: j < rule.selectors.count()
TRUEFALSE
yes
Evaluation Count:8058
yes
Evaluation Count:6846
6846-8058
1753 const Selector& selector = rule.selectors.at(j);
executed (the execution status of this line is deduced): const Selector& selector = rule.selectors.at(j);
-
1754 -
1755 if (selector.basicSelectors.isEmpty())
partially evaluated: selector.basicSelectors.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8058
0-8058
1756 continue;
never executed: continue;
0
1757 -
1758 if (selector.basicSelectors.at(0).relationToNext == BasicSelector::NoRelation) {
evaluated: selector.basicSelectors.at(0).relationToNext == BasicSelector::NoRelation
TRUEFALSE
yes
Evaluation Count:8057
yes
Evaluation Count:1
1-8057
1759 if (selector.basicSelectors.count() != 1)
partially evaluated: selector.basicSelectors.count() != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8057
0-8057
1760 continue;
never executed: continue;
0
1761 } else if (selector.basicSelectors.count() <= 1) {
executed: }
Execution Count:8057
partially evaluated: selector.basicSelectors.count() <= 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-8057
1762 continue;
never executed: continue;
0
1763 } -
1764 -
1765 const BasicSelector &sel = selector.basicSelectors.at(selector.basicSelectors.count() - 1);
executed (the execution status of this line is deduced): const BasicSelector &sel = selector.basicSelectors.at(selector.basicSelectors.count() - 1);
-
1766 -
1767 if (!sel.ids.isEmpty()) {
partially evaluated: !sel.ids.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8058
0-8058
1768 StyleRule nr;
never executed (the execution status of this line is deduced): StyleRule nr;
-
1769 nr.selectors += selector;
never executed (the execution status of this line is deduced): nr.selectors += selector;
-
1770 nr.declarations = rule.declarations;
never executed (the execution status of this line is deduced): nr.declarations = rule.declarations;
-
1771 nr.order = i;
never executed (the execution status of this line is deduced): nr.order = i;
-
1772 idIndex.insert(sel.ids.at(0), nr);
never executed (the execution status of this line is deduced): idIndex.insert(sel.ids.at(0), nr);
-
1773 } else if (!sel.elementName.isEmpty()) {
never executed: }
evaluated: !sel.elementName.isEmpty()
TRUEFALSE
yes
Evaluation Count:7872
yes
Evaluation Count:186
0-7872
1774 StyleRule nr;
executed (the execution status of this line is deduced): StyleRule nr;
-
1775 nr.selectors += selector;
executed (the execution status of this line is deduced): nr.selectors += selector;
-
1776 nr.declarations = rule.declarations;
executed (the execution status of this line is deduced): nr.declarations = rule.declarations;
-
1777 nr.order = i;
executed (the execution status of this line is deduced): nr.order = i;
-
1778 QString name = sel.elementName;
executed (the execution status of this line is deduced): QString name = sel.elementName;
-
1779 if (nameCaseSensitivity == Qt::CaseInsensitive)
evaluated: nameCaseSensitivity == Qt::CaseInsensitive
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:7823
49-7823
1780 name=name.toLower();
executed: name=name.toLower();
Execution Count:49
49
1781 nameIndex.insert(name, nr);
executed (the execution status of this line is deduced): nameIndex.insert(name, nr);
-
1782 } else {
executed: }
Execution Count:7872
7872
1783 universalsSelectors += selector;
executed (the execution status of this line is deduced): universalsSelectors += selector;
-
1784 }
executed: }
Execution Count:186
186
1785 } -
1786 if (!universalsSelectors.isEmpty()) {
evaluated: !universalsSelectors.isEmpty()
TRUEFALSE
yes
Evaluation Count:185
yes
Evaluation Count:6661
185-6661
1787 StyleRule nr;
executed (the execution status of this line is deduced): StyleRule nr;
-
1788 nr.selectors = universalsSelectors;
executed (the execution status of this line is deduced): nr.selectors = universalsSelectors;
-
1789 nr.declarations = rule.declarations;
executed (the execution status of this line is deduced): nr.declarations = rule.declarations;
-
1790 nr.order = i;
executed (the execution status of this line is deduced): nr.order = i;
-
1791 universals << nr;
executed (the execution status of this line is deduced): universals << nr;
-
1792 }
executed: }
Execution Count:185
185
1793 }
executed: }
Execution Count:6846
6846
1794 styleRules = universals;
executed (the execution status of this line is deduced): styleRules = universals;
-
1795}
executed: }
Execution Count:1020
1020
1796 -
1797/////////////////////////////////////////////////////////////////////////////// -
1798// StyleSelector -
1799StyleSelector::~StyleSelector() -
1800{ -
1801} -
1802 -
1803bool StyleSelector::nodeNameEquals(NodePtr node, const QString& nodeName) const -
1804{ -
1805 return nodeNames(node).contains(nodeName, nameCaseSensitivity);
executed: return nodeNames(node).contains(nodeName, nameCaseSensitivity);
Execution Count:74
74
1806} -
1807 -
1808QStringList StyleSelector::nodeIds(NodePtr node) const -
1809{ -
1810 return QStringList(attribute(node, QLatin1String("id")));
never executed: return QStringList(attribute(node, QLatin1String("id")));
0
1811} -
1812 -
1813bool StyleSelector::selectorMatches(const Selector &selector, NodePtr node) -
1814{ -
1815 if (selector.basicSelectors.isEmpty())
partially evaluated: selector.basicSelectors.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1776
0-1776
1816 return false;
never executed: return false;
0
1817 -
1818 if (selector.basicSelectors.at(0).relationToNext == BasicSelector::NoRelation) {
evaluated: selector.basicSelectors.at(0).relationToNext == BasicSelector::NoRelation
TRUEFALSE
yes
Evaluation Count:1772
yes
Evaluation Count:4
4-1772
1819 if (selector.basicSelectors.count() != 1)
partially evaluated: selector.basicSelectors.count() != 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1772
0-1772
1820 return false;
never executed: return false;
0
1821 return basicSelectorMatches(selector.basicSelectors.at(0), node);
executed: return basicSelectorMatches(selector.basicSelectors.at(0), node);
Execution Count:1772
1772
1822 } -
1823 if (selector.basicSelectors.count() <= 1)
partially evaluated: selector.basicSelectors.count() <= 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1824 return false;
never executed: return false;
0
1825 -
1826 int i = selector.basicSelectors.count() - 1;
executed (the execution status of this line is deduced): int i = selector.basicSelectors.count() - 1;
-
1827 node = duplicateNode(node);
executed (the execution status of this line is deduced): node = duplicateNode(node);
-
1828 bool match = true;
executed (the execution status of this line is deduced): bool match = true;
-
1829 -
1830 BasicSelector sel = selector.basicSelectors.at(i);
executed (the execution status of this line is deduced): BasicSelector sel = selector.basicSelectors.at(i);
-
1831 do { -
1832 match = basicSelectorMatches(sel, node);
executed (the execution status of this line is deduced): match = basicSelectorMatches(sel, node);
-
1833 if (!match) {
partially evaluated: !match
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
1834 if (sel.relationToNext == BasicSelector::MatchNextSelectorIfParent
partially evaluated: sel.relationToNext == BasicSelector::MatchNextSelectorIfParent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1835 || i == selector.basicSelectors.count() - 1) // first element must always match!
partially evaluated: i == selector.basicSelectors.count() - 1
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
1836 break;
executed: break;
Execution Count:4
4
1837 }
never executed: }
0
1838 -
1839 if (match || sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor)
never evaluated: match
never evaluated: sel.relationToNext != BasicSelector::MatchNextSelectorIfAncestor
0
1840 --i;
never executed: --i;
0
1841 -
1842 if (i < 0)
never evaluated: i < 0
0
1843 break;
never executed: break;
0
1844 -
1845 sel = selector.basicSelectors.at(i);
never executed (the execution status of this line is deduced): sel = selector.basicSelectors.at(i);
-
1846 if (sel.relationToNext == BasicSelector::MatchNextSelectorIfAncestor
never evaluated: sel.relationToNext == BasicSelector::MatchNextSelectorIfAncestor
0
1847 || sel.relationToNext == BasicSelector::MatchNextSelectorIfParent) {
never evaluated: sel.relationToNext == BasicSelector::MatchNextSelectorIfParent
0
1848 -
1849 NodePtr nextParent = parentNode(node);
never executed (the execution status of this line is deduced): NodePtr nextParent = parentNode(node);
-
1850 freeNode(node);
never executed (the execution status of this line is deduced): freeNode(node);
-
1851 node = nextParent;
never executed (the execution status of this line is deduced): node = nextParent;
-
1852 } else if (sel.relationToNext == BasicSelector::MatchNextSelectorIfPreceeds) {
never executed: }
never evaluated: sel.relationToNext == BasicSelector::MatchNextSelectorIfPreceeds
0
1853 NodePtr previousSibling = previousSiblingNode(node);
never executed (the execution status of this line is deduced): NodePtr previousSibling = previousSiblingNode(node);
-
1854 freeNode(node);
never executed (the execution status of this line is deduced): freeNode(node);
-
1855 node = previousSibling;
never executed (the execution status of this line is deduced): node = previousSibling;
-
1856 }
never executed: }
0
1857 if (isNullNode(node)) {
never evaluated: isNullNode(node)
0
1858 match = false;
never executed (the execution status of this line is deduced): match = false;
-
1859 break;
never executed: break;
0
1860 } -
1861 } while (i >= 0 && (match || sel.relationToNext == BasicSelector::MatchNextSelectorIfAncestor));
never executed: }
never evaluated: i >= 0
never evaluated: match
never evaluated: sel.relationToNext == BasicSelector::MatchNextSelectorIfAncestor
0
1862 -
1863 freeNode(node);
executed (the execution status of this line is deduced): freeNode(node);
-
1864 -
1865 return match;
executed: return match;
Execution Count:4
4
1866} -
1867 -
1868bool StyleSelector::basicSelectorMatches(const BasicSelector &sel, NodePtr node) -
1869{ -
1870 if (!sel.attributeSelectors.isEmpty()) {
evaluated: !sel.attributeSelectors.isEmpty()
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:1754
22-1754
1871 if (!hasAttributes(node))
partially evaluated: !hasAttributes(node)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
0-22
1872 return false;
never executed: return false;
0
1873 -
1874 for (int i = 0; i < sel.attributeSelectors.count(); ++i) {
evaluated: i < sel.attributeSelectors.count()
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:9
9-22
1875 const QCss::AttributeSelector &a = sel.attributeSelectors.at(i);
executed (the execution status of this line is deduced): const QCss::AttributeSelector &a = sel.attributeSelectors.at(i);
-
1876 -
1877 const QString attrValue = attribute(node, a.name);
executed (the execution status of this line is deduced): const QString attrValue = attribute(node, a.name);
-
1878 if (attrValue.isNull())
evaluated: attrValue.isNull()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:17
5-17
1879 return false;
executed: return false;
Execution Count:5
5
1880 -
1881 if (a.valueMatchCriterium == QCss::AttributeSelector::MatchContains) {
evaluated: a.valueMatchCriterium == QCss::AttributeSelector::MatchContains
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:12
5-12
1882 -
1883 QStringList lst = attrValue.split(QLatin1Char(' '));
executed (the execution status of this line is deduced): QStringList lst = attrValue.split(QLatin1Char(' '));
-
1884 if (!lst.contains(a.value))
evaluated: !lst.contains(a.value)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
1885 return false;
executed: return false;
Execution Count:2
2
1886 } else if (
executed: }
Execution Count:3
3
1887 (a.valueMatchCriterium == QCss::AttributeSelector::MatchEqual
evaluated: a.valueMatchCriterium == QCss::AttributeSelector::MatchEqual
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3
3-9
1888 && attrValue != a.value)
evaluated: attrValue != a.value
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-5
1889 ||
executed (the execution status of this line is deduced): ||
-
1890 (a.valueMatchCriterium == QCss::AttributeSelector::MatchBeginsWith
evaluated: a.valueMatchCriterium == QCss::AttributeSelector::MatchBeginsWith
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
2-5
1891 && !attrValue.startsWith(a.value))
evaluated: !attrValue.startsWith(a.value)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
1892 ) -
1893 return false;
executed: return false;
Execution Count:6
6
1894 } -
1895 }
executed: }
Execution Count:9
9
1896 -
1897 if (!sel.elementName.isEmpty()
evaluated: !sel.elementName.isEmpty()
TRUEFALSE
yes
Evaluation Count:1724
yes
Evaluation Count:39
39-1724
1898 && !nodeNameEquals(node, sel.elementName))
partially evaluated: !nodeNameEquals(node, sel.elementName)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1724
0-1724
1899 return false;
never executed: return false;
0
1900 -
1901 if (!sel.ids.isEmpty()
partially evaluated: !sel.ids.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1763
0-1763
1902 && sel.ids != nodeIds(node))
never evaluated: sel.ids != nodeIds(node)
0
1903 return false;
never executed: return false;
0
1904 -
1905 return true;
executed: return true;
Execution Count:1763
1763
1906} -
1907 -
1908void StyleSelector::matchRule(NodePtr node, const StyleRule &rule, StyleSheetOrigin origin, -
1909 int depth, QMap<uint, StyleRule> *weightedRules) -
1910{ -
1911 for (int j = 0; j < rule.selectors.count(); ++j) {
evaluated: j < rule.selectors.count()
TRUEFALSE
yes
Evaluation Count:1776
yes
Evaluation Count:1775
1775-1776
1912 const Selector& selector = rule.selectors.at(j);
executed (the execution status of this line is deduced): const Selector& selector = rule.selectors.at(j);
-
1913 if (selectorMatches(selector, node)) {
evaluated: selectorMatches(selector, node)
TRUEFALSE
yes
Evaluation Count:1763
yes
Evaluation Count:13
13-1763
1914 uint weight = rule.order
executed (the execution status of this line is deduced): uint weight = rule.order
-
1915 + selector.specificity() *0x100
executed (the execution status of this line is deduced): + selector.specificity() *0x100
-
1916 + (uint(origin) + depth)*0x100000;
executed (the execution status of this line is deduced): + (uint(origin) + depth)*0x100000;
-
1917 StyleRule newRule = rule;
executed (the execution status of this line is deduced): StyleRule newRule = rule;
-
1918 if(rule.selectors.count() > 1) {
partially evaluated: rule.selectors.count() > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1763
0-1763
1919 newRule.selectors.resize(1);
never executed (the execution status of this line is deduced): newRule.selectors.resize(1);
-
1920 newRule.selectors[0] = selector;
never executed (the execution status of this line is deduced): newRule.selectors[0] = selector;
-
1921 }
never executed: }
0
1922 //We might have rules with the same weight if they came from a rule with several selectors -
1923 weightedRules->insertMulti(weight, newRule);
executed (the execution status of this line is deduced): weightedRules->insertMulti(weight, newRule);
-
1924 }
executed: }
Execution Count:1763
1763
1925 }
executed: }
Execution Count:1776
1776
1926}
executed: }
Execution Count:1775
1775
1927 -
1928// Returns style rules that are in ascending order of specificity -
1929// Each of the StyleRule returned will contain exactly one Selector -
1930QVector<StyleRule> StyleSelector::styleRulesForNode(NodePtr node) -
1931{ -
1932 QVector<StyleRule> rules;
executed (the execution status of this line is deduced): QVector<StyleRule> rules;
-
1933 if (styleSheets.isEmpty())
partially evaluated: styleSheets.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3985
0-3985
1934 return rules;
never executed: return rules;
0
1935 -
1936 QMap<uint, StyleRule> weightedRules; // (spec, rule) that will be sorted below
executed (the execution status of this line is deduced): QMap<uint, StyleRule> weightedRules;
-
1937 -
1938 //prune using indexed stylesheet -
1939 for (int sheetIdx = 0; sheetIdx < styleSheets.count(); ++sheetIdx) {
evaluated: sheetIdx < styleSheets.count()
TRUEFALSE
yes
Evaluation Count:6502
yes
Evaluation Count:3985
3985-6502
1940 const StyleSheet &styleSheet = styleSheets.at(sheetIdx);
executed (the execution status of this line is deduced): const StyleSheet &styleSheet = styleSheets.at(sheetIdx);
-
1941 for (int i = 0; i < styleSheet.styleRules.count(); ++i) {
evaluated: i < styleSheet.styleRules.count()
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:6502
46-6502
1942 matchRule(node, styleSheet.styleRules.at(i), styleSheet.origin, styleSheet.depth, &weightedRules);
executed (the execution status of this line is deduced): matchRule(node, styleSheet.styleRules.at(i), styleSheet.origin, styleSheet.depth, &weightedRules);
-
1943 }
executed: }
Execution Count:46
46
1944 -
1945 if (!styleSheet.idIndex.isEmpty()) {
partially evaluated: !styleSheet.idIndex.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6502
0-6502
1946 QStringList ids = nodeIds(node);
never executed (the execution status of this line is deduced): QStringList ids = nodeIds(node);
-
1947 for (int i = 0; i < ids.count(); i++) {
never evaluated: i < ids.count()
0
1948 const QString &key = ids.at(i);
never executed (the execution status of this line is deduced): const QString &key = ids.at(i);
-
1949 QMultiHash<QString, StyleRule>::const_iterator it = styleSheet.idIndex.constFind(key);
never executed (the execution status of this line is deduced): QMultiHash<QString, StyleRule>::const_iterator it = styleSheet.idIndex.constFind(key);
-
1950 while (it != styleSheet.idIndex.constEnd() && it.key() == key) {
never evaluated: it != styleSheet.idIndex.constEnd()
never evaluated: it.key() == key
0
1951 matchRule(node, it.value(), styleSheet.origin, styleSheet.depth, &weightedRules);
never executed (the execution status of this line is deduced): matchRule(node, it.value(), styleSheet.origin, styleSheet.depth, &weightedRules);
-
1952 ++it;
never executed (the execution status of this line is deduced): ++it;
-
1953 }
never executed: }
0
1954 }
never executed: }
0
1955 }
never executed: }
0
1956 if (!styleSheet.nameIndex.isEmpty()) {
evaluated: !styleSheet.nameIndex.isEmpty()
TRUEFALSE
yes
Evaluation Count:2539
yes
Evaluation Count:3963
2539-3963
1957 QStringList names = nodeNames(node);
executed (the execution status of this line is deduced): QStringList names = nodeNames(node);
-
1958 for (int i = 0; i < names.count(); i++) {
evaluated: i < names.count()
TRUEFALSE
yes
Evaluation Count:9008
yes
Evaluation Count:2539
2539-9008
1959 QString name = names.at(i);
executed (the execution status of this line is deduced): QString name = names.at(i);
-
1960 if (nameCaseSensitivity == Qt::CaseInsensitive)
evaluated: nameCaseSensitivity == Qt::CaseInsensitive
TRUEFALSE
yes
Evaluation Count:116
yes
Evaluation Count:8892
116-8892
1961 name = name.toLower();
executed: name = name.toLower();
Execution Count:116
116
1962 QMultiHash<QString, StyleRule>::const_iterator it = styleSheet.nameIndex.constFind(name);
executed (the execution status of this line is deduced): QMultiHash<QString, StyleRule>::const_iterator it = styleSheet.nameIndex.constFind(name);
-
1963 while (it != styleSheet.nameIndex.constEnd() && it.key() == name) {
evaluated: it != styleSheet.nameIndex.constEnd()
TRUEFALSE
yes
Evaluation Count:3373
yes
Evaluation Count:7362
evaluated: it.key() == name
TRUEFALSE
yes
Evaluation Count:1727
yes
Evaluation Count:1646
1646-7362
1964 matchRule(node, it.value(), styleSheet.origin, styleSheet.depth, &weightedRules);
executed (the execution status of this line is deduced): matchRule(node, it.value(), styleSheet.origin, styleSheet.depth, &weightedRules);
-
1965 ++it;
executed (the execution status of this line is deduced): ++it;
-
1966 }
executed: }
Execution Count:1727
1727
1967 }
executed: }
Execution Count:9008
9008
1968 }
executed: }
Execution Count:2539
2539
1969 if (!medium.isEmpty()) {
evaluated: !medium.isEmpty()
TRUEFALSE
yes
Evaluation Count:1718
yes
Evaluation Count:4784
1718-4784
1970 for (int i = 0; i < styleSheet.mediaRules.count(); ++i) {
evaluated: i < styleSheet.mediaRules.count()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1718
3-1718
1971 if (styleSheet.mediaRules.at(i).media.contains(medium, Qt::CaseInsensitive)) {
evaluated: styleSheet.mediaRules.at(i).media.contains(medium, Qt::CaseInsensitive)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1972 for (int j = 0; j < styleSheet.mediaRules.at(i).styleRules.count(); ++j) {
evaluated: j < styleSheet.mediaRules.at(i).styleRules.count()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
1973 matchRule(node, styleSheet.mediaRules.at(i).styleRules.at(j), styleSheet.origin,
executed (the execution status of this line is deduced): matchRule(node, styleSheet.mediaRules.at(i).styleRules.at(j), styleSheet.origin,
-
1974 styleSheet.depth, &weightedRules);
executed (the execution status of this line is deduced): styleSheet.depth, &weightedRules);
-
1975 }
executed: }
Execution Count:2
2
1976 }
executed: }
Execution Count:2
2
1977 }
executed: }
Execution Count:3
3
1978 }
executed: }
Execution Count:1718
1718
1979 }
executed: }
Execution Count:6502
6502
1980 -
1981 rules.reserve(weightedRules.count());
executed (the execution status of this line is deduced): rules.reserve(weightedRules.count());
-
1982 QMap<uint, StyleRule>::const_iterator it = weightedRules.constBegin();
executed (the execution status of this line is deduced): QMap<uint, StyleRule>::const_iterator it = weightedRules.constBegin();
-
1983 for ( ; it != weightedRules.constEnd() ; ++it)
evaluated: it != weightedRules.constEnd()
TRUEFALSE
yes
Evaluation Count:1763
yes
Evaluation Count:3985
1763-3985
1984 rules += *it;
executed: rules += *it;
Execution Count:1763
1763
1985 -
1986 return rules;
executed: return rules;
Execution Count:3985
3985
1987} -
1988 -
1989// for qtexthtmlparser which requires just the declarations with Enabled state -
1990// and without pseudo elements -
1991QVector<Declaration> StyleSelector::declarationsForNode(NodePtr node, const char *extraPseudo) -
1992{ -
1993 QVector<Declaration> decls;
executed (the execution status of this line is deduced): QVector<Declaration> decls;
-
1994 QVector<StyleRule> rules = styleRulesForNode(node);
executed (the execution status of this line is deduced): QVector<StyleRule> rules = styleRulesForNode(node);
-
1995 for (int i = 0; i < rules.count(); i++) {
evaluated: i < rules.count()
TRUEFALSE
yes
Evaluation Count:78
yes
Evaluation Count:1593
78-1593
1996 const Selector& selector = rules.at(i).selectors.at(0);
executed (the execution status of this line is deduced): const Selector& selector = rules.at(i).selectors.at(0);
-
1997 const QString pseudoElement = selector.pseudoElement();
executed (the execution status of this line is deduced): const QString pseudoElement = selector.pseudoElement();
-
1998 -
1999 if (extraPseudo && pseudoElement == QLatin1String(extraPseudo)) {
evaluated: extraPseudo
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:76
evaluated: pseudoElement == QLatin1String(extraPseudo)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1-76
2000 decls += rules.at(i).declarations;
executed (the execution status of this line is deduced): decls += rules.at(i).declarations;
-
2001 continue;
executed: continue;
Execution Count:1
1
2002 } -
2003 -
2004 if (!pseudoElement.isEmpty()) // skip rules with pseudo elements
partially evaluated: !pseudoElement.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:77
0-77
2005 continue;
never executed: continue;
0
2006 quint64 pseudoClass = selector.pseudoClass();
executed (the execution status of this line is deduced): quint64 pseudoClass = selector.pseudoClass();
-
2007 if (pseudoClass == PseudoClass_Enabled || pseudoClass == PseudoClass_Unspecified)
partially evaluated: pseudoClass == PseudoClass_Enabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:77
partially evaluated: pseudoClass == PseudoClass_Unspecified
TRUEFALSE
yes
Evaluation Count:77
no
Evaluation Count:0
0-77
2008 decls += rules.at(i).declarations;
executed: decls += rules.at(i).declarations;
Execution Count:77
77
2009 }
executed: }
Execution Count:77
77
2010 return decls;
executed: return decls;
Execution Count:1593
1593
2011} -
2012 -
2013static inline bool isHexDigit(const char c) -
2014{ -
2015 return (c >= '0' && c <= '9')
executed: return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') ;
Execution Count:3
3
2016 || (c >= 'a' && c <= 'f')
executed: return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') ;
Execution Count:3
3
2017 || (c >= 'A' && c <= 'F')
executed: return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') ;
Execution Count:3
3
2018 ;
executed: return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') ;
Execution Count:3
3
2019} -
2020 -
2021QString Scanner::preprocess(const QString &input, bool *hasEscapeSequences) -
2022{ -
2023 QString output = input;
executed (the execution status of this line is deduced): QString output = input;
-
2024 -
2025 if (hasEscapeSequences)
partially evaluated: hasEscapeSequences
TRUEFALSE
yes
Evaluation Count:627
no
Evaluation Count:0
0-627
2026 *hasEscapeSequences = false;
executed: *hasEscapeSequences = false;
Execution Count:627
627
2027 -
2028 int i = 0;
executed (the execution status of this line is deduced): int i = 0;
-
2029 while (i < output.size()) {
evaluated: i < output.size()
TRUEFALSE
yes
Evaluation Count:12232
yes
Evaluation Count:627
627-12232
2030 if (output.at(i) == QLatin1Char('\\')) {
evaluated: output.at(i) == QLatin1Char('\\')
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:12231
1-12231
2031 -
2032 ++i;
executed (the execution status of this line is deduced): ++i;
-
2033 // test for unicode hex escape -
2034 int hexCount = 0;
executed (the execution status of this line is deduced): int hexCount = 0;
-
2035 const int hexStart = i;
executed (the execution status of this line is deduced): const int hexStart = i;
-
2036 while (i < output.size()
partially evaluated: i < output.size()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2037 && isHexDigit(output.at(i).toLatin1())
evaluated: isHexDigit(output.at(i).toLatin1())
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2038 && hexCount < 7) {
partially evaluated: hexCount < 7
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2039 ++hexCount;
executed (the execution status of this line is deduced): ++hexCount;
-
2040 ++i;
executed (the execution status of this line is deduced): ++i;
-
2041 }
executed: }
Execution Count:2
2
2042 if (hexCount == 0) {
partially evaluated: hexCount == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2043 if (hasEscapeSequences)
never evaluated: hasEscapeSequences
0
2044 *hasEscapeSequences = true;
never executed: *hasEscapeSequences = true;
0
2045 continue;
never executed: continue;
0
2046 } -
2047 -
2048 hexCount = qMin(hexCount, 6);
executed (the execution status of this line is deduced): hexCount = qMin(hexCount, 6);
-
2049 bool ok = false;
executed (the execution status of this line is deduced): bool ok = false;
-
2050 ushort code = output.mid(hexStart, hexCount).toUShort(&ok, 16);
executed (the execution status of this line is deduced): ushort code = output.mid(hexStart, hexCount).toUShort(&ok, 16);
-
2051 if (ok) {
partially evaluated: ok
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2052 output.replace(hexStart - 1, hexCount + 1, QChar(code));
executed (the execution status of this line is deduced): output.replace(hexStart - 1, hexCount + 1, QChar(code));
-
2053 i = hexStart;
executed (the execution status of this line is deduced): i = hexStart;
-
2054 } else {
executed: }
Execution Count:1
1
2055 i = hexStart;
never executed (the execution status of this line is deduced): i = hexStart;
-
2056 }
never executed: }
0
2057 } else { -
2058 ++i;
executed (the execution status of this line is deduced): ++i;
-
2059 }
executed: }
Execution Count:12231
12231
2060 } -
2061 return output;
executed: return output;
Execution Count:627
627
2062} -
2063 -
2064int QCssScanner_Generated::handleCommentStart() -
2065{ -
2066 while (pos < input.size() - 1) {
partially evaluated: pos < input.size() - 1
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2067 if (input.at(pos) == QLatin1Char('*')
evaluated: input.at(pos) == QLatin1Char('*')
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
2068 && input.at(pos + 1) == QLatin1Char('/')) {
partially evaluated: input.at(pos + 1) == QLatin1Char('/')
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2069 pos += 2;
executed (the execution status of this line is deduced): pos += 2;
-
2070 break;
executed: break;
Execution Count:1
1
2071 } -
2072 ++pos;
executed (the execution status of this line is deduced): ++pos;
-
2073 }
executed: }
Execution Count:2
2
2074 return S;
executed: return S;
Execution Count:1
1
2075} -
2076 -
2077void Scanner::scan(const QString &preprocessedInput, QVector<Symbol> *symbols) -
2078{ -
2079 QCssScanner_Generated scanner(preprocessedInput);
executed (the execution status of this line is deduced): QCssScanner_Generated scanner(preprocessedInput);
-
2080 Symbol sym;
executed (the execution status of this line is deduced): Symbol sym;
-
2081 int tok = scanner.lex();
executed (the execution status of this line is deduced): int tok = scanner.lex();
-
2082 while (tok != -1) {
evaluated: tok != -1
TRUEFALSE
yes
Evaluation Count:3930
yes
Evaluation Count:627
627-3930
2083 sym.token = static_cast<QCss::TokenType>(tok);
executed (the execution status of this line is deduced): sym.token = static_cast<QCss::TokenType>(tok);
-
2084 sym.text = scanner.input;
executed (the execution status of this line is deduced): sym.text = scanner.input;
-
2085 sym.start = scanner.lexemStart;
executed (the execution status of this line is deduced): sym.start = scanner.lexemStart;
-
2086 sym.len = scanner.lexemLength;
executed (the execution status of this line is deduced): sym.len = scanner.lexemLength;
-
2087 symbols->append(sym);
executed (the execution status of this line is deduced): symbols->append(sym);
-
2088 tok = scanner.lex();
executed (the execution status of this line is deduced): tok = scanner.lex();
-
2089 }
executed: }
Execution Count:3930
3930
2090}
executed: }
Execution Count:627
627
2091 -
2092QString Symbol::lexem() const -
2093{ -
2094 QString result;
executed (the execution status of this line is deduced): QString result;
-
2095 if (len > 0)
partially evaluated: len > 0
TRUEFALSE
yes
Evaluation Count:1232
no
Evaluation Count:0
0-1232
2096 result.reserve(len);
executed: result.reserve(len);
Execution Count:1232
1232
2097 for (int i = 0; i < len; ++i) {
evaluated: i < len
TRUEFALSE
yes
Evaluation Count:9399
yes
Evaluation Count:1232
1232-9399
2098 if (text.at(start + i) == QLatin1Char('\\') && i < len - 1)
partially evaluated: text.at(start + i) == QLatin1Char('\\')
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9399
never evaluated: i < len - 1
0-9399
2099 ++i;
never executed: ++i;
0
2100 result += text.at(start + i);
executed (the execution status of this line is deduced): result += text.at(start + i);
-
2101 }
executed: }
Execution Count:9399
9399
2102 return result;
executed: return result;
Execution Count:1232
1232
2103} -
2104 -
2105Parser::Parser(const QString &css, bool isFile) -
2106{ -
2107 init(css, isFile);
executed (the execution status of this line is deduced): init(css, isFile);
-
2108}
executed: }
Execution Count:221
221
2109 -
2110Parser::Parser() -
2111{ -
2112 index = 0;
executed (the execution status of this line is deduced): index = 0;
-
2113 errorIndex = -1;
executed (the execution status of this line is deduced): errorIndex = -1;
-
2114 hasEscapeSequences = false;
executed (the execution status of this line is deduced): hasEscapeSequences = false;
-
2115}
executed: }
Execution Count:402
402
2116 -
2117void Parser::init(const QString &css, bool isFile) -
2118{ -
2119 QString styleSheet = css;
executed (the execution status of this line is deduced): QString styleSheet = css;
-
2120 if (isFile) {
partially evaluated: isFile
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:627
0-627
2121 QFile file(css);
never executed (the execution status of this line is deduced): QFile file(css);
-
2122 if (file.open(QFile::ReadOnly)) {
never evaluated: file.open(QFile::ReadOnly)
0
2123 sourcePath = QFileInfo(styleSheet).absolutePath() + QLatin1Char('/');
never executed (the execution status of this line is deduced): sourcePath = QFileInfo(styleSheet).absolutePath() + QLatin1Char('/');
-
2124 QTextStream stream(&file);
never executed (the execution status of this line is deduced): QTextStream stream(&file);
-
2125 styleSheet = stream.readAll();
never executed (the execution status of this line is deduced): styleSheet = stream.readAll();
-
2126 } else {
never executed: }
0
2127 qWarning() << "QCss::Parser - Failed to load file " << css;
never executed (the execution status of this line is deduced): QMessageLogger("text/qcssparser.cpp", 2127, __PRETTY_FUNCTION__).warning() << "QCss::Parser - Failed to load file " << css;
-
2128 styleSheet.clear();
never executed (the execution status of this line is deduced): styleSheet.clear();
-
2129 }
never executed: }
0
2130 } else { -
2131 sourcePath.clear();
executed (the execution status of this line is deduced): sourcePath.clear();
-
2132 }
executed: }
Execution Count:627
627
2133 -
2134 hasEscapeSequences = false;
executed (the execution status of this line is deduced): hasEscapeSequences = false;
-
2135 symbols.resize(0);
executed (the execution status of this line is deduced): symbols.resize(0);
-
2136 symbols.reserve(8);
executed (the execution status of this line is deduced): symbols.reserve(8);
-
2137 Scanner::scan(Scanner::preprocess(styleSheet, &hasEscapeSequences), &symbols);
executed (the execution status of this line is deduced): Scanner::scan(Scanner::preprocess(styleSheet, &hasEscapeSequences), &symbols);
-
2138 index = 0;
executed (the execution status of this line is deduced): index = 0;
-
2139 errorIndex = -1;
executed (the execution status of this line is deduced): errorIndex = -1;
-
2140}
executed: }
Execution Count:627
627
2141 -
2142bool Parser::parse(StyleSheet *styleSheet, Qt::CaseSensitivity nameCaseSensitivity) -
2143{ -
2144 if (testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("charset"))) {
partially evaluated: testTokenAndEndsWith(ATKEYWORD_SYM, QLatin1String("charset"))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:626
0-626
2145 if (!next(STRING)) return false;
never executed: return false;
never evaluated: !next(STRING)
0
2146 if (!next(SEMICOLON)) return false;
never executed: return false;
never evaluated: !next(SEMICOLON)
0
2147 }
never executed: }
0
2148 -
2149 while (test(S) || test(CDO) || test(CDC)) {}
executed: }
Execution Count:406
evaluated: test(S)
TRUEFALSE
yes
Evaluation Count:406
yes
Evaluation Count:626
partially evaluated: test(CDO)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:626
partially evaluated: test(CDC)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:626
0-626
2150 -
2151 while (testImport()) {
evaluated: testImport()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:626
5-626
2152 ImportRule rule;
executed (the execution status of this line is deduced): ImportRule rule;
-
2153 if (!parseImport(&rule)) return false;
never executed: return false;
partially evaluated: !parseImport(&rule)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2154 styleSheet->importRules.append(rule);
executed (the execution status of this line is deduced): styleSheet->importRules.append(rule);
-
2155 while (test(S) || test(CDO) || test(CDC)) {}
never executed: }
partially evaluated: test(S)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: test(CDO)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: test(CDC)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2156 }
executed: }
Execution Count:5
5
2157 -
2158 do { -
2159 if (testMedia()) {
evaluated: testMedia()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:635
3-635
2160 MediaRule rule;
executed (the execution status of this line is deduced): MediaRule rule;
-
2161 if (!parseMedia(&rule)) return false;
never executed: return false;
partially evaluated: !parseMedia(&rule)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2162 styleSheet->mediaRules.append(rule);
executed (the execution status of this line is deduced): styleSheet->mediaRules.append(rule);
-
2163 } else if (testPage()) {
executed: }
Execution Count:3
partially evaluated: testPage()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:635
0-635
2164 PageRule rule;
never executed (the execution status of this line is deduced): PageRule rule;
-
2165 if (!parsePage(&rule)) return false;
never executed: return false;
never evaluated: !parsePage(&rule)
0
2166 styleSheet->pageRules.append(rule);
never executed (the execution status of this line is deduced): styleSheet->pageRules.append(rule);
-
2167 } else if (testRuleset()) {
never executed: }
evaluated: testRuleset()
TRUEFALSE
yes
Evaluation Count:244
yes
Evaluation Count:391
0-391
2168 StyleRule rule;
executed (the execution status of this line is deduced): StyleRule rule;
-
2169 if (!parseRuleset(&rule)) return false;
executed: return false;
Execution Count:6
evaluated: !parseRuleset(&rule)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:238
6-238
2170 styleSheet->styleRules.append(rule);
executed (the execution status of this line is deduced): styleSheet->styleRules.append(rule);
-
2171 } else if (test(ATKEYWORD_SYM)) {
executed: }
Execution Count:238
partially evaluated: test(ATKEYWORD_SYM)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:391
0-391
2172 if (!until(RBRACE)) return false;
never executed: return false;
never evaluated: !until(RBRACE)
0
2173 } else if (hasNext()) {
never executed: }
evaluated: hasNext()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:390
0-390
2174 return false;
executed: return false;
Execution Count:1
1
2175 } -
2176 while (test(S) || test(CDO) || test(CDC)) {}
never executed: }
partially evaluated: test(S)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:631
partially evaluated: test(CDO)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:631
partially evaluated: test(CDC)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:631
0-631
2177 } while (hasNext());
executed: }
Execution Count:631
evaluated: hasNext()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:619
12-631
2178 styleSheet->buildIndexes(nameCaseSensitivity);
executed (the execution status of this line is deduced): styleSheet->buildIndexes(nameCaseSensitivity);
-
2179 return true;
executed: return true;
Execution Count:619
619
2180} -
2181 -
2182Symbol Parser::errorSymbol() -
2183{ -
2184 if (errorIndex == -1) return Symbol();
never executed: return Symbol();
never evaluated: errorIndex == -1
0
2185 return symbols.at(errorIndex);
never executed: return symbols.at(errorIndex);
0
2186} -
2187 -
2188static inline void removeOptionalQuotes(QString *str) -
2189{ -
2190 if (!str->startsWith(QLatin1Char('\''))
evaluated: !str->startsWith(QLatin1Char('\''))
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
2191 && !str->startsWith(QLatin1Char('\"')))
evaluated: !str->startsWith(QLatin1Char('\"'))
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-5
2192 return;
executed: return;
Execution Count:3
3
2193 str->remove(0, 1);
executed (the execution status of this line is deduced): str->remove(0, 1);
-
2194 str->chop(1);
executed (the execution status of this line is deduced): str->chop(1);
-
2195}
executed: }
Execution Count:7
7
2196 -
2197bool Parser::parseImport(ImportRule *importRule) -
2198{ -
2199 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2200 -
2201 if (test(STRING)) {
evaluated: test(STRING)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
2202 importRule->href = lexem();
executed (the execution status of this line is deduced): importRule->href = lexem();
-
2203 } else {
executed: }
Execution Count:3
3
2204 if (!testAndParseUri(&importRule->href)) return false;
never executed: return false;
partially evaluated: !testAndParseUri(&importRule->href)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2205 }
executed: }
Execution Count:2
2
2206 removeOptionalQuotes(&importRule->href);
executed (the execution status of this line is deduced): removeOptionalQuotes(&importRule->href);
-
2207 -
2208 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2209 -
2210 if (testMedium()) {
evaluated: testMedium()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
2211 if (!parseMedium(&importRule->media)) return false;
never executed: return false;
partially evaluated: !parseMedium(&importRule->media)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2212 -
2213 while (test(COMMA)) {
partially evaluated: test(COMMA)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2214 skipSpace();
never executed (the execution status of this line is deduced): skipSpace();
-
2215 if (!parseNextMedium(&importRule->media)) return false;
never executed: return false;
never evaluated: !parseNextMedium(&importRule->media)
0
2216 }
never executed: }
0
2217 }
executed: }
Execution Count:1
1
2218 -
2219 if (!next(SEMICOLON)) return false;
never executed: return false;
partially evaluated: !next(SEMICOLON)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2220 -
2221 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2222 return true;
executed: return true;
Execution Count:5
5
2223} -
2224 -
2225bool Parser::parseMedia(MediaRule *mediaRule) -
2226{ -
2227 do { -
2228 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2229 if (!parseNextMedium(&mediaRule->media)) return false;
never executed: return false;
partially evaluated: !parseNextMedium(&mediaRule->media)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2230 } while (test(COMMA));
executed: }
Execution Count:3
partially evaluated: test(COMMA)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2231 -
2232 if (!next(LBRACE)) return false;
never executed: return false;
partially evaluated: !next(LBRACE)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2233 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2234 -
2235 while (testRuleset()) {
evaluated: testRuleset()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
2236 StyleRule rule;
executed (the execution status of this line is deduced): StyleRule rule;
-
2237 if (!parseRuleset(&rule)) return false;
never executed: return false;
partially evaluated: !parseRuleset(&rule)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2238 mediaRule->styleRules.append(rule);
executed (the execution status of this line is deduced): mediaRule->styleRules.append(rule);
-
2239 }
executed: }
Execution Count:3
3
2240 -
2241 if (!next(RBRACE)) return false;
never executed: return false;
partially evaluated: !next(RBRACE)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2242 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2243 return true;
executed: return true;
Execution Count:3
3
2244} -
2245 -
2246bool Parser::parseMedium(QStringList *media) -
2247{ -
2248 media->append(lexem());
executed (the execution status of this line is deduced): media->append(lexem());
-
2249 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2250 return true;
executed: return true;
Execution Count:4
4
2251} -
2252 -
2253bool Parser::parsePage(PageRule *pageRule) -
2254{ -
2255 skipSpace();
never executed (the execution status of this line is deduced): skipSpace();
-
2256 -
2257 if (testPseudoPage())
never evaluated: testPseudoPage()
0
2258 if (!parsePseudoPage(&pageRule->selector)) return false;
never executed: return false;
never evaluated: !parsePseudoPage(&pageRule->selector)
0
2259 -
2260 skipSpace();
never executed (the execution status of this line is deduced): skipSpace();
-
2261 if (!next(LBRACE)) return false;
never executed: return false;
never evaluated: !next(LBRACE)
0
2262 -
2263 do { -
2264 skipSpace();
never executed (the execution status of this line is deduced): skipSpace();
-
2265 Declaration decl;
never executed (the execution status of this line is deduced): Declaration decl;
-
2266 if (!parseNextDeclaration(&decl)) return false;
never executed: return false;
never evaluated: !parseNextDeclaration(&decl)
0
2267 if (!decl.isEmpty())
never evaluated: !decl.isEmpty()
0
2268 pageRule->declarations.append(decl);
never executed: pageRule->declarations.append(decl);
0
2269 } while (test(SEMICOLON));
never executed: }
never evaluated: test(SEMICOLON)
0
2270 -
2271 if (!next(RBRACE)) return false;
never executed: return false;
never evaluated: !next(RBRACE)
0
2272 skipSpace();
never executed (the execution status of this line is deduced): skipSpace();
-
2273 return true;
never executed: return true;
0
2274} -
2275 -
2276bool Parser::parsePseudoPage(QString *selector) -
2277{ -
2278 if (!next(IDENT)) return false;
never executed: return false;
never evaluated: !next(IDENT)
0
2279 *selector = lexem();
never executed (the execution status of this line is deduced): *selector = lexem();
-
2280 return true;
never executed: return true;
0
2281} -
2282 -
2283bool Parser::parseNextOperator(Value *value) -
2284{ -
2285 if (!hasNext()) return true;
executed: return true;
Execution Count:1
evaluated: !hasNext()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:542
1-542
2286 switch (next()) { -
2287 case SLASH: value->type = Value::TermOperatorSlash; skipSpace(); break;
never executed: break;
0
2288 case COMMA: value->type = Value::TermOperatorComma; skipSpace(); break;
executed: break;
Execution Count:4
4
2289 default: prev(); break;
executed: break;
Execution Count:538
538
2290 } -
2291 return true;
executed: return true;
Execution Count:542
542
2292} -
2293 -
2294bool Parser::parseCombinator(BasicSelector::Relation *relation) -
2295{ -
2296 *relation = BasicSelector::NoRelation;
executed (the execution status of this line is deduced): *relation = BasicSelector::NoRelation;
-
2297 if (lookup() == S) {
partially evaluated: lookup() == S
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2298 *relation = BasicSelector::MatchNextSelectorIfAncestor;
executed (the execution status of this line is deduced): *relation = BasicSelector::MatchNextSelectorIfAncestor;
-
2299 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2300 } else {
executed: }
Execution Count:3
3
2301 prev();
never executed (the execution status of this line is deduced): prev();
-
2302 }
never executed: }
0
2303 if (test(PLUS)) {
partially evaluated: test(PLUS)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2304 *relation = BasicSelector::MatchNextSelectorIfPreceeds;
never executed (the execution status of this line is deduced): *relation = BasicSelector::MatchNextSelectorIfPreceeds;
-
2305 } else if (test(GREATER)) {
never executed: }
partially evaluated: test(GREATER)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2306 *relation = BasicSelector::MatchNextSelectorIfParent;
never executed (the execution status of this line is deduced): *relation = BasicSelector::MatchNextSelectorIfParent;
-
2307 }
never executed: }
0
2308 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2309 return true;
executed: return true;
Execution Count:3
3
2310} -
2311 -
2312bool Parser::parseProperty(Declaration *decl) -
2313{ -
2314 decl->d->property = lexem();
executed (the execution status of this line is deduced): decl->d->property = lexem();
-
2315 decl->d->propertyId = static_cast<Property>(findKnownValue(decl->d->property, properties, NumProperties));
executed (the execution status of this line is deduced): decl->d->propertyId = static_cast<Property>(findKnownValue(decl->d->property, properties, NumProperties));
-
2316 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2317 return true;
executed: return true;
Execution Count:523
523
2318} -
2319 -
2320bool Parser::parseRuleset(StyleRule *styleRule) -
2321{ -
2322 Selector sel;
executed (the execution status of this line is deduced): Selector sel;
-
2323 if (!parseSelector(&sel)) return false;
executed: return false;
Execution Count:5
evaluated: !parseSelector(&sel)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:242
5-242
2324 styleRule->selectors.append(sel);
executed (the execution status of this line is deduced): styleRule->selectors.append(sel);
-
2325 -
2326 while (test(COMMA)) {
evaluated: test(COMMA)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:242
9-242
2327 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2328 Selector sel;
executed (the execution status of this line is deduced): Selector sel;
-
2329 if (!parseNextSelector(&sel)) return false;
never executed: return false;
partially evaluated: !parseNextSelector(&sel)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
2330 styleRule->selectors.append(sel);
executed (the execution status of this line is deduced): styleRule->selectors.append(sel);
-
2331 }
executed: }
Execution Count:9
9
2332 -
2333 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2334 if (!next(LBRACE)) return false;
executed: return false;
Execution Count:1
evaluated: !next(LBRACE)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:241
1-241
2335 const int declarationStart = index;
executed (the execution status of this line is deduced): const int declarationStart = index;
-
2336 -
2337 do { -
2338 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2339 Declaration decl;
executed (the execution status of this line is deduced): Declaration decl;
-
2340 const int rewind = index;
executed (the execution status of this line is deduced): const int rewind = index;
-
2341 if (!parseNextDeclaration(&decl)) {
partially evaluated: !parseNextDeclaration(&decl)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:642
0-642
2342 index = rewind;
never executed (the execution status of this line is deduced): index = rewind;
-
2343 const bool foundSemicolon = until(SEMICOLON);
never executed (the execution status of this line is deduced): const bool foundSemicolon = until(SEMICOLON);
-
2344 const int semicolonIndex = index;
never executed (the execution status of this line is deduced): const int semicolonIndex = index;
-
2345 -
2346 index = declarationStart;
never executed (the execution status of this line is deduced): index = declarationStart;
-
2347 const bool foundRBrace = until(RBRACE);
never executed (the execution status of this line is deduced): const bool foundRBrace = until(RBRACE);
-
2348 -
2349 if (foundSemicolon && semicolonIndex < index) {
never evaluated: foundSemicolon
never evaluated: semicolonIndex < index
0
2350 decl = Declaration();
never executed (the execution status of this line is deduced): decl = Declaration();
-
2351 index = semicolonIndex - 1;
never executed (the execution status of this line is deduced): index = semicolonIndex - 1;
-
2352 } else {
never executed: }
0
2353 skipSpace();
never executed (the execution status of this line is deduced): skipSpace();
-
2354 return foundRBrace;
never executed: return foundRBrace;
0
2355 } -
2356 } -
2357 if (!decl.isEmpty())
evaluated: !decl.isEmpty()
TRUEFALSE
yes
Evaluation Count:523
yes
Evaluation Count:119
119-523
2358 styleRule->declarations.append(decl);
executed: styleRule->declarations.append(decl);
Execution Count:523
523
2359 } while (test(SEMICOLON));
executed: }
Execution Count:642
evaluated: test(SEMICOLON)
TRUEFALSE
yes
Evaluation Count:401
yes
Evaluation Count:241
241-642
2360 -
2361 if (!next(RBRACE)) return false;
never executed: return false;
partially evaluated: !next(RBRACE)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:241
0-241
2362 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2363 return true;
executed: return true;
Execution Count:241
241
2364} -
2365 -
2366bool Parser::parseSelector(Selector *sel) -
2367{ -
2368 BasicSelector basicSel;
executed (the execution status of this line is deduced): BasicSelector basicSel;
-
2369 if (!parseSimpleSelector(&basicSel)) return false;
executed: return false;
Execution Count:4
evaluated: !parseSimpleSelector(&basicSel)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:252
4-252
2370 while (testCombinator()) {
evaluated: testCombinator()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:251
3-251
2371 if (!parseCombinator(&basicSel.relationToNext)) return false;
never executed: return false;
partially evaluated: !parseCombinator(&basicSel.relationToNext)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2372 -
2373 if (!testSimpleSelector()) break;
never executed: break;
partially evaluated: !testSimpleSelector()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2374 sel->basicSelectors.append(basicSel);
executed (the execution status of this line is deduced): sel->basicSelectors.append(basicSel);
-
2375 -
2376 basicSel = BasicSelector();
executed (the execution status of this line is deduced): basicSel = BasicSelector();
-
2377 if (!parseSimpleSelector(&basicSel)) return false;
executed: return false;
Execution Count:1
evaluated: !parseSimpleSelector(&basicSel)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
2378 }
executed: }
Execution Count:2
2
2379 sel->basicSelectors.append(basicSel);
executed (the execution status of this line is deduced): sel->basicSelectors.append(basicSel);
-
2380 return true;
executed: return true;
Execution Count:251
251
2381} -
2382 -
2383bool Parser::parseSimpleSelector(BasicSelector *basicSel) -
2384{ -
2385 int minCount = 0;
executed (the execution status of this line is deduced): int minCount = 0;
-
2386 if (lookupElementName()) {
evaluated: lookupElementName()
TRUEFALSE
yes
Evaluation Count:253
yes
Evaluation Count:6
6-253
2387 if (!parseElementName(&basicSel->elementName)) return false;
never executed: return false;
partially evaluated: !parseElementName(&basicSel->elementName)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:253
0-253
2388 } else {
executed: }
Execution Count:253
253
2389 prev();
executed (the execution status of this line is deduced): prev();
-
2390 minCount = 1;
executed (the execution status of this line is deduced): minCount = 1;
-
2391 }
executed: }
Execution Count:6
6
2392 bool onceMore;
executed (the execution status of this line is deduced): bool onceMore;
-
2393 int count = 0;
executed (the execution status of this line is deduced): int count = 0;
-
2394 do { -
2395 onceMore = false;
executed (the execution status of this line is deduced): onceMore = false;
-
2396 if (test(HASH)) {
partially evaluated: test(HASH)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:279
0-279
2397 QString theid = lexem();
never executed (the execution status of this line is deduced): QString theid = lexem();
-
2398 // chop off leading # -
2399 theid.remove(0, 1);
never executed (the execution status of this line is deduced): theid.remove(0, 1);
-
2400 basicSel->ids.append(theid);
never executed (the execution status of this line is deduced): basicSel->ids.append(theid);
-
2401 onceMore = true;
never executed (the execution status of this line is deduced): onceMore = true;
-
2402 } else if (testClass()) {
never executed: }
evaluated: testClass()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:275
0-275
2403 onceMore = true;
executed (the execution status of this line is deduced): onceMore = true;
-
2404 AttributeSelector a;
executed (the execution status of this line is deduced): AttributeSelector a;
-
2405 a.name = QLatin1String("class");
executed (the execution status of this line is deduced): a.name = QLatin1String("class");
-
2406 a.valueMatchCriterium = AttributeSelector::MatchContains;
executed (the execution status of this line is deduced): a.valueMatchCriterium = AttributeSelector::MatchContains;
-
2407 if (!parseClass(&a.value)) return false;
executed: return false;
Execution Count:1
evaluated: !parseClass(&a.value)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
2408 basicSel->attributeSelectors.append(a);
executed (the execution status of this line is deduced): basicSel->attributeSelectors.append(a);
-
2409 } else if (testAttrib()) {
executed: }
Execution Count:3
evaluated: testAttrib()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:259
3-259
2410 onceMore = true;
executed (the execution status of this line is deduced): onceMore = true;
-
2411 AttributeSelector a;
executed (the execution status of this line is deduced): AttributeSelector a;
-
2412 if (!parseAttrib(&a)) return false;
never executed: return false;
partially evaluated: !parseAttrib(&a)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
2413 basicSel->attributeSelectors.append(a);
executed (the execution status of this line is deduced): basicSel->attributeSelectors.append(a);
-
2414 } else if (testPseudo()) {
executed: }
Execution Count:16
evaluated: testPseudo()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:254
5-254
2415 onceMore = true;
executed (the execution status of this line is deduced): onceMore = true;
-
2416 Pseudo ps;
executed (the execution status of this line is deduced): Pseudo ps;
-
2417 if (!parsePseudo(&ps)) return false;
executed: return false;
Execution Count:4
evaluated: !parsePseudo(&ps)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
2418 basicSel->pseudos.append(ps);
executed (the execution status of this line is deduced): basicSel->pseudos.append(ps);
-
2419 }
executed: }
Execution Count:1
1
2420 if (onceMore) ++count;
executed: ++count;
Execution Count:20
evaluated: onceMore
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:254
20-254
2421 } while (onceMore);
executed: }
Execution Count:274
evaluated: onceMore
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:254
20-274
2422 return count >= minCount;
executed: return count >= minCount;
Execution Count:254
254
2423} -
2424 -
2425bool Parser::parseClass(QString *name) -
2426{ -
2427 if (!next(IDENT)) return false;
executed: return false;
Execution Count:1
evaluated: !next(IDENT)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
2428 *name = lexem();
executed (the execution status of this line is deduced): *name = lexem();
-
2429 return true;
executed: return true;
Execution Count:3
3
2430} -
2431 -
2432bool Parser::parseElementName(QString *name) -
2433{ -
2434 switch (lookup()) { -
2435 case STAR: name->clear(); break;
executed: break;
Execution Count:180
180
2436 case IDENT: *name = lexem(); break;
executed: break;
Execution Count:73
73
2437 default: return false;
never executed: return false;
0
2438 } -
2439 return true;
executed: return true;
Execution Count:253
253
2440} -
2441 -
2442bool Parser::parseAttrib(AttributeSelector *attr) -
2443{ -
2444 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2445 if (!next(IDENT)) return false;
never executed: return false;
partially evaluated: !next(IDENT)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
2446 attr->name = lexem();
executed (the execution status of this line is deduced): attr->name = lexem();
-
2447 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2448 -
2449 if (test(EQUAL)) {
evaluated: test(EQUAL)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:6
6-10
2450 attr->valueMatchCriterium = AttributeSelector::MatchEqual;
executed (the execution status of this line is deduced): attr->valueMatchCriterium = AttributeSelector::MatchEqual;
-
2451 } else if (test(INCLUDES)) {
executed: }
Execution Count:10
evaluated: test(INCLUDES)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
2-10
2452 attr->valueMatchCriterium = AttributeSelector::MatchContains;
executed (the execution status of this line is deduced): attr->valueMatchCriterium = AttributeSelector::MatchContains;
-
2453 } else if (test(DASHMATCH)) {
executed: }
Execution Count:2
evaluated: test(DASHMATCH)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
2454 attr->valueMatchCriterium = AttributeSelector::MatchBeginsWith;
executed (the execution status of this line is deduced): attr->valueMatchCriterium = AttributeSelector::MatchBeginsWith;
-
2455 } else {
executed: }
Execution Count:2
2
2456 return next(RBRACKET);
executed: return next(RBRACKET);
Execution Count:2
2
2457 } -
2458 -
2459 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2460 -
2461 if (!test(IDENT) && !test(STRING)) return false;
never executed: return false;
evaluated: !test(IDENT)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:11
partially evaluated: !test(STRING)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-11
2462 attr->value = unquotedLexem();
executed (the execution status of this line is deduced): attr->value = unquotedLexem();
-
2463 -
2464 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2465 return next(RBRACKET);
executed: return next(RBRACKET);
Execution Count:14
14
2466} -
2467 -
2468bool Parser::parsePseudo(Pseudo *pseudo) -
2469{ -
2470 (void)test(COLON);
executed (the execution status of this line is deduced): (void)test(COLON);
-
2471 pseudo->negated = test(EXCLAMATION_SYM);
executed (the execution status of this line is deduced): pseudo->negated = test(EXCLAMATION_SYM);
-
2472 if (test(IDENT)) {
evaluated: test(IDENT)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
2473 pseudo->name = lexem();
executed (the execution status of this line is deduced): pseudo->name = lexem();
-
2474 pseudo->type = static_cast<quint64>(findKnownValue(pseudo->name, pseudos, NumPseudos));
executed (the execution status of this line is deduced): pseudo->type = static_cast<quint64>(findKnownValue(pseudo->name, pseudos, NumPseudos));
-
2475 return true;
executed: return true;
Execution Count:1
1
2476 } -
2477 if (!next(FUNCTION)) return false;
executed: return false;
Execution Count:4
partially evaluated: !next(FUNCTION)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
2478 pseudo->function = lexem();
never executed (the execution status of this line is deduced): pseudo->function = lexem();
-
2479 // chop off trailing parenthesis -
2480 pseudo->function.chop(1);
never executed (the execution status of this line is deduced): pseudo->function.chop(1);
-
2481 skipSpace();
never executed (the execution status of this line is deduced): skipSpace();
-
2482 if (!test(IDENT)) return false;
never executed: return false;
never evaluated: !test(IDENT)
0
2483 pseudo->name = lexem();
never executed (the execution status of this line is deduced): pseudo->name = lexem();
-
2484 skipSpace();
never executed (the execution status of this line is deduced): skipSpace();
-
2485 return next(RPAREN);
never executed: return next(RPAREN);
0
2486} -
2487 -
2488bool Parser::parseNextDeclaration(Declaration *decl) -
2489{ -
2490 if (!testProperty())
evaluated: !testProperty()
TRUEFALSE
yes
Evaluation Count:119
yes
Evaluation Count:523
119-523
2491 return true; // not an error!
executed: return true;
Execution Count:119
119
2492 if (!parseProperty(decl)) return false;
never executed: return false;
partially evaluated: !parseProperty(decl)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:523
0-523
2493 if (!next(COLON)) return false;
never executed: return false;
partially evaluated: !next(COLON)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:523
0-523
2494 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2495 if (!parseNextExpr(&decl->d->values)) return false;
never executed: return false;
partially evaluated: !parseNextExpr(&decl->d->values)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:523
0-523
2496 if (testPrio())
partially evaluated: testPrio()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:523
0-523
2497 if (!parsePrio(decl)) return false;
never executed: return false;
never evaluated: !parsePrio(decl)
0
2498 return true;
executed: return true;
Execution Count:523
523
2499} -
2500 -
2501bool Parser::testPrio() -
2502{ -
2503 const int rewind = index;
executed (the execution status of this line is deduced): const int rewind = index;
-
2504 if (!test(EXCLAMATION_SYM)) return false;
executed: return false;
Execution Count:523
partially evaluated: !test(EXCLAMATION_SYM)
TRUEFALSE
yes
Evaluation Count:523
no
Evaluation Count:0
0-523
2505 skipSpace();
never executed (the execution status of this line is deduced): skipSpace();
-
2506 if (!test(IDENT)) {
never evaluated: !test(IDENT)
0
2507 index = rewind;
never executed (the execution status of this line is deduced): index = rewind;
-
2508 return false;
never executed: return false;
0
2509 } -
2510 if (lexem().compare(QLatin1String("important"), Qt::CaseInsensitive) != 0) {
never evaluated: lexem().compare(QLatin1String("important"), Qt::CaseInsensitive) != 0
0
2511 index = rewind;
never executed (the execution status of this line is deduced): index = rewind;
-
2512 return false;
never executed: return false;
0
2513 } -
2514 return true;
never executed: return true;
0
2515} -
2516 -
2517bool Parser::parsePrio(Declaration *declaration) -
2518{ -
2519 declaration->d->important = true;
never executed (the execution status of this line is deduced): declaration->d->important = true;
-
2520 skipSpace();
never executed (the execution status of this line is deduced): skipSpace();
-
2521 return true;
never executed: return true;
0
2522} -
2523 -
2524bool Parser::parseExpr(QVector<Value> *values) -
2525{ -
2526 Value val;
executed (the execution status of this line is deduced): Value val;
-
2527 if (!parseTerm(&val)) return false;
never executed: return false;
partially evaluated: !parseTerm(&val)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:524
0-524
2528 values->append(val);
executed (the execution status of this line is deduced): values->append(val);
-
2529 bool onceMore;
executed (the execution status of this line is deduced): bool onceMore;
-
2530 do { -
2531 onceMore = false;
executed (the execution status of this line is deduced): onceMore = false;
-
2532 val = Value();
executed (the execution status of this line is deduced): val = Value();
-
2533 if (!parseNextOperator(&val)) return false;
never executed: return false;
partially evaluated: !parseNextOperator(&val)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:543
0-543
2534 if (val.type != QCss::Value::Unknown)
evaluated: val.type != QCss::Value::Unknown
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:539
4-539
2535 values->append(val);
executed: values->append(val);
Execution Count:4
4
2536 if (testTerm()) {
evaluated: testTerm()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:524
19-524
2537 onceMore = true;
executed (the execution status of this line is deduced): onceMore = true;
-
2538 val = Value();
executed (the execution status of this line is deduced): val = Value();
-
2539 if (!parseTerm(&val)) return false;
never executed: return false;
partially evaluated: !parseTerm(&val)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
2540 values->append(val);
executed (the execution status of this line is deduced): values->append(val);
-
2541 }
executed: }
Execution Count:19
19
2542 } while (onceMore);
executed: }
Execution Count:543
evaluated: onceMore
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:524
19-543
2543 return true;
executed: return true;
Execution Count:524
524
2544} -
2545 -
2546bool Parser::testTerm() -
2547{ -
2548 return test(PLUS) || test(MINUS)
executed: return test(PLUS) || test(MINUS) || test(NUMBER) || test(PERCENTAGE) || test(LENGTH) || test(STRING) || test(IDENT) || testHexColor() || testFunction();
Execution Count:1067
1067
2549 || test(NUMBER)
executed: return test(PLUS) || test(MINUS) || test(NUMBER) || test(PERCENTAGE) || test(LENGTH) || test(STRING) || test(IDENT) || testHexColor() || testFunction();
Execution Count:1067
1067
2550 || test(PERCENTAGE)
executed: return test(PLUS) || test(MINUS) || test(NUMBER) || test(PERCENTAGE) || test(LENGTH) || test(STRING) || test(IDENT) || testHexColor() || testFunction();
Execution Count:1067
1067
2551 || test(LENGTH)
executed: return test(PLUS) || test(MINUS) || test(NUMBER) || test(PERCENTAGE) || test(LENGTH) || test(STRING) || test(IDENT) || testHexColor() || testFunction();
Execution Count:1067
1067
2552 || test(STRING)
executed: return test(PLUS) || test(MINUS) || test(NUMBER) || test(PERCENTAGE) || test(LENGTH) || test(STRING) || test(IDENT) || testHexColor() || testFunction();
Execution Count:1067
1067
2553 || test(IDENT)
executed: return test(PLUS) || test(MINUS) || test(NUMBER) || test(PERCENTAGE) || test(LENGTH) || test(STRING) || test(IDENT) || testHexColor() || testFunction();
Execution Count:1067
1067
2554 || testHexColor()
executed: return test(PLUS) || test(MINUS) || test(NUMBER) || test(PERCENTAGE) || test(LENGTH) || test(STRING) || test(IDENT) || testHexColor() || testFunction();
Execution Count:1067
1067
2555 || testFunction();
executed: return test(PLUS) || test(MINUS) || test(NUMBER) || test(PERCENTAGE) || test(LENGTH) || test(STRING) || test(IDENT) || testHexColor() || testFunction();
Execution Count:1067
1067
2556} -
2557 -
2558bool Parser::parseTerm(Value *value) -
2559{ -
2560 QString str = lexem();
executed (the execution status of this line is deduced): QString str = lexem();
-
2561 bool haveUnary = false;
executed (the execution status of this line is deduced): bool haveUnary = false;
-
2562 if (lookup() == PLUS || lookup() == MINUS) {
partially evaluated: lookup() == PLUS
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:543
partially evaluated: lookup() == MINUS
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:543
0-543
2563 haveUnary = true;
never executed (the execution status of this line is deduced): haveUnary = true;
-
2564 if (!hasNext()) return false;
never executed: return false;
never evaluated: !hasNext()
0
2565 next();
never executed (the execution status of this line is deduced): next();
-
2566 str += lexem();
never executed (the execution status of this line is deduced): str += lexem();
-
2567 }
never executed: }
0
2568 -
2569 value->variant = str;
executed (the execution status of this line is deduced): value->variant = str;
-
2570 value->type = QCss::Value::String;
executed (the execution status of this line is deduced): value->type = QCss::Value::String;
-
2571 switch (lookup()) { -
2572 case NUMBER: -
2573 value->type = Value::Number;
executed (the execution status of this line is deduced): value->type = Value::Number;
-
2574 value->variant.convert(QVariant::Double);
executed (the execution status of this line is deduced): value->variant.convert(QVariant::Double);
-
2575 break;
executed: break;
Execution Count:62
62
2576 case PERCENTAGE: -
2577 value->type = Value::Percentage;
never executed (the execution status of this line is deduced): value->type = Value::Percentage;
-
2578 str.chop(1); // strip off %
never executed (the execution status of this line is deduced): str.chop(1);
-
2579 value->variant = str;
never executed (the execution status of this line is deduced): value->variant = str;
-
2580 break;
never executed: break;
0
2581 case LENGTH: -
2582 value->type = Value::Length;
executed (the execution status of this line is deduced): value->type = Value::Length;
-
2583 break;
executed: break;
Execution Count:267
267
2584 -
2585 case STRING: -
2586 if (haveUnary) return false;
never executed: return false;
partially evaluated: haveUnary
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
2587 value->type = Value::String;
executed (the execution status of this line is deduced): value->type = Value::String;
-
2588 str.chop(1);
executed (the execution status of this line is deduced): str.chop(1);
-
2589 str.remove(0, 1);
executed (the execution status of this line is deduced): str.remove(0, 1);
-
2590 value->variant = str;
executed (the execution status of this line is deduced): value->variant = str;
-
2591 break;
executed: break;
Execution Count:14
14
2592 case IDENT: { -
2593 if (haveUnary) return false;
never executed: return false;
partially evaluated: haveUnary
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:181
0-181
2594 value->type = Value::Identifier;
executed (the execution status of this line is deduced): value->type = Value::Identifier;
-
2595 const int theid = findKnownValue(str, values, NumKnownValues);
executed (the execution status of this line is deduced): const int theid = findKnownValue(str, values, NumKnownValues);
-
2596 if (theid != 0) {
evaluated: theid != 0
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:106
75-106
2597 value->type = Value::KnownIdentifier;
executed (the execution status of this line is deduced): value->type = Value::KnownIdentifier;
-
2598 value->variant = theid;
executed (the execution status of this line is deduced): value->variant = theid;
-
2599 }
executed: }
Execution Count:75
75
2600 break;
executed: break;
Execution Count:181
181
2601 } -
2602 default: { -
2603 if (haveUnary) return false;
never executed: return false;
partially evaluated: haveUnary
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19
0-19
2604 prev();
executed (the execution status of this line is deduced): prev();
-
2605 if (testHexColor()) {
evaluated: testHexColor()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:4
4-15
2606 QColor col;
executed (the execution status of this line is deduced): QColor col;
-
2607 if (!parseHexColor(&col)) return false;
never executed: return false;
partially evaluated: !parseHexColor(&col)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
2608 value->type = Value::Color;
executed (the execution status of this line is deduced): value->type = Value::Color;
-
2609 value->variant = col;
executed (the execution status of this line is deduced): value->variant = col;
-
2610 } else if (testFunction()) {
executed: }
Execution Count:15
partially evaluated: testFunction()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-15
2611 QString name, args;
executed (the execution status of this line is deduced): QString name, args;
-
2612 if (!parseFunction(&name, &args)) return false;
never executed: return false;
partially evaluated: !parseFunction(&name, &args)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2613 if (name == QLatin1String("url")) {
evaluated: name == QLatin1String("url")
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
2614 value->type = Value::Uri;
executed (the execution status of this line is deduced): value->type = Value::Uri;
-
2615 removeOptionalQuotes(&args);
executed (the execution status of this line is deduced): removeOptionalQuotes(&args);
-
2616 if (QFileInfo(args).isRelative() && !sourcePath.isEmpty()) {
partially evaluated: QFileInfo(args).isRelative()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
partially evaluated: !sourcePath.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2617 args.prepend(sourcePath);
never executed (the execution status of this line is deduced): args.prepend(sourcePath);
-
2618 }
never executed: }
0
2619 value->variant = args;
executed (the execution status of this line is deduced): value->variant = args;
-
2620 } else {
executed: }
Execution Count:3
3
2621 value->type = Value::Function;
executed (the execution status of this line is deduced): value->type = Value::Function;
-
2622 value->variant = QStringList() << name << args;
executed (the execution status of this line is deduced): value->variant = QStringList() << name << args;
-
2623 }
executed: }
Execution Count:1
1
2624 } else { -
2625 return recordError();
never executed: return recordError();
0
2626 } -
2627 return true;
executed: return true;
Execution Count:19
19
2628 } -
2629 } -
2630 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2631 return true;
executed: return true;
Execution Count:524
524
2632} -
2633 -
2634bool Parser::parseFunction(QString *name, QString *args) -
2635{ -
2636 *name = lexem();
executed (the execution status of this line is deduced): *name = lexem();
-
2637 name->chop(1);
executed (the execution status of this line is deduced): name->chop(1);
-
2638 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2639 const int start = index;
executed (the execution status of this line is deduced): const int start = index;
-
2640 if (!until(RPAREN)) return false;
never executed: return false;
partially evaluated: !until(RPAREN)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
2641 for (int i = start; i < index - 1; ++i)
evaluated: i < index - 1
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:6
6-12
2642 args->append(symbols.at(i).lexem());
executed: args->append(symbols.at(i).lexem());
Execution Count:12
12
2643 /* -
2644 if (!nextExpr(&arguments)) return false; -
2645 if (!next(RPAREN)) return false; -
2646 */ -
2647 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2648 return true;
executed: return true;
Execution Count:6
6
2649} -
2650 -
2651bool Parser::parseHexColor(QColor *col) -
2652{ -
2653 col->setNamedColor(lexem());
executed (the execution status of this line is deduced): col->setNamedColor(lexem());
-
2654 if (!col->isValid()) {
partially evaluated: !col->isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
2655 qWarning("QCssParser::parseHexColor: Unknown color name '%s'",lexem().toLatin1().constData());
never executed (the execution status of this line is deduced): QMessageLogger("text/qcssparser.cpp", 2655, __PRETTY_FUNCTION__).warning("QCssParser::parseHexColor: Unknown color name '%s'",lexem().toLatin1().constData());
-
2656 return false;
never executed: return false;
0
2657 } -
2658 skipSpace();
executed (the execution status of this line is deduced): skipSpace();
-
2659 return true;
executed: return true;
Execution Count:15
15
2660} -
2661 -
2662bool Parser::testAndParseUri(QString *uri) -
2663{ -
2664 const int rewind = index;
executed (the execution status of this line is deduced): const int rewind = index;
-
2665 if (!testFunction()) return false;
never executed: return false;
partially evaluated: !testFunction()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2666 -
2667 QString name, args;
executed (the execution status of this line is deduced): QString name, args;
-
2668 if (!parseFunction(&name, &args)) {
partially evaluated: !parseFunction(&name, &args)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2669 index = rewind;
never executed (the execution status of this line is deduced): index = rewind;
-
2670 return false;
never executed: return false;
0
2671 } -
2672 if (name.toLower() != QLatin1String("url")) {
partially evaluated: name.toLower() != QLatin1String("url")
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2673 index = rewind;
never executed (the execution status of this line is deduced): index = rewind;
-
2674 return false;
never executed: return false;
0
2675 } -
2676 *uri = args;
executed (the execution status of this line is deduced): *uri = args;
-
2677 removeOptionalQuotes(uri);
executed (the execution status of this line is deduced): removeOptionalQuotes(uri);
-
2678 return true;
executed: return true;
Execution Count:2
2
2679} -
2680 -
2681bool Parser::testSimpleSelector() -
2682{ -
2683 return testElementName()
executed: return testElementName() || (test(HASH)) || testClass() || testAttrib() || testPseudo();
Execution Count:653
653
2684 || (test(HASH))
executed: return testElementName() || (test(HASH)) || testClass() || testAttrib() || testPseudo();
Execution Count:653
653
2685 || testClass()
executed: return testElementName() || (test(HASH)) || testClass() || testAttrib() || testPseudo();
Execution Count:653
653
2686 || testAttrib()
executed: return testElementName() || (test(HASH)) || testClass() || testAttrib() || testPseudo();
Execution Count:653
653
2687 || testPseudo();
executed: return testElementName() || (test(HASH)) || testClass() || testAttrib() || testPseudo();
Execution Count:653
653
2688} -
2689 -
2690bool Parser::next(QCss::TokenType t) -
2691{ -
2692 if (hasNext() && next() == t)
evaluated: hasNext()
TRUEFALSE
yes
Evaluation Count:1056
yes
Evaluation Count:1
evaluated: next() == t
TRUEFALSE
yes
Evaluation Count:1051
yes
Evaluation Count:5
1-1056
2693 return true;
executed: return true;
Execution Count:1051
1051
2694 return recordError();
executed: return recordError();
Execution Count:6
6
2695} -
2696 -
2697bool Parser::test(QCss::TokenType t) -
2698{ -
2699 if (index >= symbols.count())
evaluated: index >= symbols.count()
TRUEFALSE
yes
Evaluation Count:7180
yes
Evaluation Count:17975
7180-17975
2700 return false;
executed: return false;
Execution Count:7180
7180
2701 if (symbols.at(index).token == t) {
evaluated: symbols.at(index).token == t
TRUEFALSE
yes
Evaluation Count:2870
yes
Evaluation Count:15105
2870-15105
2702 ++index;
executed (the execution status of this line is deduced): ++index;
-
2703 return true;
executed: return true;
Execution Count:2870
2870
2704 } -
2705 return false;
executed: return false;
Execution Count:15105
15105
2706} -
2707 -
2708QString Parser::unquotedLexem() const -
2709{ -
2710 QString s = lexem();
executed (the execution status of this line is deduced): QString s = lexem();
-
2711 if (lookup() == STRING) {
evaluated: lookup() == STRING
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:11
3-11
2712 s.chop(1);
executed (the execution status of this line is deduced): s.chop(1);
-
2713 s.remove(0, 1);
executed (the execution status of this line is deduced): s.remove(0, 1);
-
2714 }
executed: }
Execution Count:3
3
2715 return s;
executed: return s;
Execution Count:14
14
2716} -
2717 -
2718QString Parser::lexemUntil(QCss::TokenType t) -
2719{ -
2720 QString lexem;
never executed (the execution status of this line is deduced): QString lexem;
-
2721 while (hasNext() && next() != t)
never evaluated: hasNext()
never evaluated: next() != t
0
2722 lexem += symbol().lexem();
never executed: lexem += symbol().lexem();
0
2723 return lexem;
never executed: return lexem;
0
2724} -
2725 -
2726bool Parser::until(QCss::TokenType target, QCss::TokenType target2) -
2727{ -
2728 int braceCount = 0;
executed (the execution status of this line is deduced): int braceCount = 0;
-
2729 int brackCount = 0;
executed (the execution status of this line is deduced): int brackCount = 0;
-
2730 int parenCount = 0;
executed (the execution status of this line is deduced): int parenCount = 0;
-
2731 if (index) {
partially evaluated: index
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2732 switch(symbols.at(index-1).token) { -
2733 case LBRACE: ++braceCount; break;
never executed: break;
0
2734 case LBRACKET: ++brackCount; break;
never executed: break;
0
2735 case FUNCTION: -
2736 case LPAREN: ++parenCount; break;
executed: break;
Execution Count:6
6
2737 default: ; -
2738 }
never executed: }
0
2739 }
executed: }
Execution Count:6
6
2740 while (index < symbols.size()) {
partially evaluated: index < symbols.size()
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
2741 QCss::TokenType t = symbols.at(index++).token;
executed (the execution status of this line is deduced): QCss::TokenType t = symbols.at(index++).token;
-
2742 switch (t) { -
2743 case LBRACE: ++braceCount; break;
never executed: break;
0
2744 case RBRACE: --braceCount; break;
never executed: break;
0
2745 case LBRACKET: ++brackCount; break;
never executed: break;
0
2746 case RBRACKET: --brackCount; break;
never executed: break;
0
2747 case FUNCTION: -
2748 case LPAREN: ++parenCount; break;
never executed: break;
0
2749 case RPAREN: --parenCount; break;
executed: break;
Execution Count:6
6
2750 default: break;
executed: break;
Execution Count:12
12
2751 } -
2752 if ((t == target || (target2 != NONE && t == target2))
evaluated: t == target
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:12
partially evaluated: target2 != NONE
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
never evaluated: t == target2
0-12
2753 && braceCount <= 0
partially evaluated: braceCount <= 0
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2754 && brackCount <= 0
partially evaluated: brackCount <= 0
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2755 && parenCount <= 0)
partially evaluated: parenCount <= 0
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
2756 return true;
executed: return true;
Execution Count:6
6
2757 -
2758 if (braceCount < 0 || brackCount < 0 || parenCount < 0) {
partially evaluated: braceCount < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
partially evaluated: brackCount < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
partially evaluated: parenCount < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
2759 --index;
never executed (the execution status of this line is deduced): --index;
-
2760 break;
never executed: break;
0
2761 } -
2762 }
executed: }
Execution Count:12
12
2763 return false;
never executed: return false;
0
2764} -
2765 -
2766bool Parser::testTokenAndEndsWith(QCss::TokenType t, QLatin1String str) -
2767{ -
2768 if (!test(t)) return false;
executed: return false;
Execution Count:2511
evaluated: !test(t)
TRUEFALSE
yes
Evaluation Count:2511
yes
Evaluation Count:19
19-2511
2769 if (!lexem().endsWith(str, Qt::CaseInsensitive)) {
evaluated: !lexem().endsWith(str, Qt::CaseInsensitive)
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:8
8-11
2770 prev();
executed (the execution status of this line is deduced): prev();
-
2771 return false;
executed: return false;
Execution Count:11
11
2772 } -
2773 return true;
executed: return true;
Execution Count:8
8
2774} -
2775 -
2776QT_END_NAMESPACE -
2777#endif // QT_NO_CSSPARSER -
2778 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial