@geastack/engine 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/canvas.cpp +86 -30
- package/css/animation.h +64 -0
- package/css/declarative.h +6 -0
- package/css/engine.h +25 -1
- package/image_store.cpp +136 -33
- package/package.json +2 -2
- package/ui/CSS_FEATURES.md +261 -0
- package/ui/absolute_leaf_refresh.cpp +42 -39
- package/ui/core.cpp +32 -1
- package/ui/css_atom.cpp +6 -0
- package/ui/css_atom.h +2 -0
- package/ui/css_features.h +282 -0
- package/ui/display_invalidation.cpp +29 -0
- package/ui/flex_balance.h +73 -0
- package/ui/image_node.cpp +33 -28
- package/ui/input.cpp +88 -38
- package/ui/input_render.cpp +17 -13
- package/ui/internal.h +51 -5
- package/ui/layout.cpp +2601 -441
- package/ui/layout_snapshot.cpp +49 -6
- package/ui/node_features.h +18 -0
- package/ui/node_lifecycle.cpp +204 -71
- package/ui/node_lifecycle.h +1 -0
- package/ui/node_model.h +930 -70
- package/ui/node_text.h +82 -0
- package/ui/render.cpp +793 -352
- package/ui/renderer_features.h +19 -0
- package/ui/root_scroll_refresh.cpp +46 -24
- package/ui/style.cpp +4155 -1073
- package/ui/style.h +143 -6
- package/ui/style_values.h +16 -0
- package/ui/text.cpp +401 -106
- package/ui/tree_events.cpp +138 -95
- package/ui/tree_events.h +28 -19
- package/ui/tree_inspection.h +15 -0
- package/ui/tree_internal.h +19 -0
- package/ui/tree_nodes.cpp +38 -4
- package/ui/tree_render.cpp +119 -40
- package/ui/tree_scroll_mirror.cpp +26 -0
- package/ui/tree_state.cpp +261 -114
- package/ui/tree_state.h +121 -16
- package/ui/tree_style.cpp +609 -82
- package/ui/view.cpp +720 -299
- package/ui/virtual_keyboard.cpp +10 -3
package/ui/tree_style.cpp
CHANGED
|
@@ -30,6 +30,20 @@ bool nodeParticipatesInMountedTree(const TreeState &state, int node)
|
|
|
30
30
|
bool isTransformProperty(Property prop)
|
|
31
31
|
{
|
|
32
32
|
switch (prop) {
|
|
33
|
+
#if GEA_CSS_TRANSFORMS
|
|
34
|
+
case Property::RotateAngle:
|
|
35
|
+
case Property::RotateAxisX:
|
|
36
|
+
case Property::RotateAxisY:
|
|
37
|
+
case Property::RotateAxisZ:
|
|
38
|
+
case Property::ScaleX:
|
|
39
|
+
case Property::ScaleY:
|
|
40
|
+
case Property::ScaleZ:
|
|
41
|
+
case Property::TransformTranslateOuterAxes:
|
|
42
|
+
case Property::TranslateX:
|
|
43
|
+
case Property::TranslateY:
|
|
44
|
+
case Property::TranslateZ:
|
|
45
|
+
case Property::TranslateXPercent:
|
|
46
|
+
case Property::TranslateYPercent:
|
|
33
47
|
case Property::TransformRotate:
|
|
34
48
|
case Property::TransformRotateX:
|
|
35
49
|
case Property::TransformRotateY:
|
|
@@ -40,12 +54,14 @@ bool isTransformProperty(Property prop)
|
|
|
40
54
|
case Property::TransformTranslateYPercent:
|
|
41
55
|
case Property::TransformScaleX:
|
|
42
56
|
case Property::TransformScaleY:
|
|
57
|
+
case Property::TransformScaleZ:
|
|
43
58
|
case Property::TransformOriginX:
|
|
44
59
|
case Property::TransformOriginY:
|
|
45
60
|
case Property::Perspective:
|
|
46
61
|
case Property::PerspectiveOriginX:
|
|
47
62
|
case Property::PerspectiveOriginY:
|
|
48
63
|
return true;
|
|
64
|
+
#endif
|
|
49
65
|
default:
|
|
50
66
|
return false;
|
|
51
67
|
}
|
|
@@ -54,12 +70,63 @@ bool isTransformProperty(Property prop)
|
|
|
54
70
|
bool isLayoutProperty(Property prop)
|
|
55
71
|
{
|
|
56
72
|
switch (prop) {
|
|
73
|
+
case Property::FlexLineCount:
|
|
74
|
+
case Property::AspectRatio:
|
|
75
|
+
#if GEA_CSS_TRANSFORMS
|
|
76
|
+
case Property::TranslatePresent:
|
|
77
|
+
case Property::TransformPresent:
|
|
78
|
+
case Property::RotatePresent:
|
|
79
|
+
case Property::ScalePresent:
|
|
80
|
+
#endif
|
|
81
|
+
case Property::FilterPresent:
|
|
57
82
|
case Property::Display:
|
|
58
83
|
case Property::FlexDirection:
|
|
84
|
+
case Property::BoxSizing:
|
|
85
|
+
#if GEA_CSS_FLOATS
|
|
86
|
+
case Property::Float:
|
|
87
|
+
#endif
|
|
88
|
+
case Property::MarginTrim:
|
|
89
|
+
#if GEA_CSS_FLOATS
|
|
90
|
+
case Property::Clear:
|
|
91
|
+
#endif
|
|
92
|
+
#if GEA_CSS_WRITING_MODE
|
|
93
|
+
case Property::WritingMode:
|
|
94
|
+
case Property::Direction:
|
|
95
|
+
#endif
|
|
96
|
+
#if GEA_CSS_AXIS_GAP
|
|
97
|
+
case Property::RowGap:
|
|
98
|
+
#endif
|
|
99
|
+
#if GEA_CSS_AXIS_GAP
|
|
100
|
+
case Property::ColumnGap:
|
|
101
|
+
#endif
|
|
102
|
+
case Property::RowGapPercent:
|
|
103
|
+
case Property::ColumnGapPercent:
|
|
104
|
+
case Property::MarginTopAuto:
|
|
105
|
+
case Property::MarginRightAuto:
|
|
106
|
+
case Property::MarginBottomAuto:
|
|
107
|
+
case Property::MarginLeftAuto:
|
|
108
|
+
case Property::MarginTopExpression:
|
|
109
|
+
case Property::MarginRightExpression:
|
|
110
|
+
case Property::MarginBottomExpression:
|
|
111
|
+
case Property::MarginLeftExpression:
|
|
112
|
+
case Property::PaddingTopExpression:
|
|
113
|
+
case Property::PaddingRightExpression:
|
|
114
|
+
case Property::PaddingBottomExpression:
|
|
115
|
+
case Property::PaddingLeftExpression:
|
|
116
|
+
case Property::WidthExpression:
|
|
117
|
+
case Property::HeightExpression:
|
|
118
|
+
case Property::Order:
|
|
59
119
|
case Property::FlexWrap:
|
|
60
120
|
case Property::JustifyContent:
|
|
61
121
|
case Property::AlignItems:
|
|
62
122
|
case Property::JustifyItems:
|
|
123
|
+
case Property::JustifySelf:
|
|
124
|
+
#if GEA_CSS_GRID
|
|
125
|
+
case Property::GridRowStart:
|
|
126
|
+
case Property::GridColumnStart:
|
|
127
|
+
case Property::GridRowEnd:
|
|
128
|
+
case Property::GridColumnEnd:
|
|
129
|
+
#endif
|
|
63
130
|
case Property::AlignContent:
|
|
64
131
|
case Property::AlignSelf:
|
|
65
132
|
case Property::Gap:
|
|
@@ -74,6 +141,12 @@ bool isLayoutProperty(Property prop)
|
|
|
74
141
|
case Property::Flex:
|
|
75
142
|
case Property::FlexShrink:
|
|
76
143
|
case Property::FlexBasis:
|
|
144
|
+
case Property::FlexBasisExpression:
|
|
145
|
+
case Property::BorderWidth:
|
|
146
|
+
case Property::BorderTopWidth:
|
|
147
|
+
case Property::BorderRightWidth:
|
|
148
|
+
case Property::BorderBottomWidth:
|
|
149
|
+
case Property::BorderLeftWidth:
|
|
77
150
|
case Property::PaddingTop:
|
|
78
151
|
case Property::PaddingRight:
|
|
79
152
|
case Property::PaddingBottom:
|
|
@@ -98,9 +171,14 @@ bool isLayoutProperty(Property prop)
|
|
|
98
171
|
case Property::FontSize:
|
|
99
172
|
case Property::FontWeight:
|
|
100
173
|
case Property::LineHeight:
|
|
174
|
+
case Property::LineHeightExpression:
|
|
175
|
+
case Property::LineHeightMultiplier:
|
|
176
|
+
case Property::Visibility:
|
|
101
177
|
case Property::WhiteSpace:
|
|
102
178
|
case Property::TextOverflow:
|
|
179
|
+
#if GEA_UI_IMAGE_NODES
|
|
103
180
|
case Property::ImageId:
|
|
181
|
+
#endif
|
|
104
182
|
case Property::ImageFit:
|
|
105
183
|
return true;
|
|
106
184
|
default:
|
|
@@ -159,7 +237,53 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
159
237
|
#else
|
|
160
238
|
if (recordInline)
|
|
161
239
|
#endif
|
|
162
|
-
|
|
240
|
+
{
|
|
241
|
+
auto &overrides = ensureRareData(node).inlineStyles;
|
|
242
|
+
// Width/height and their percentage/expression companions are one
|
|
243
|
+
// authored declaration. Replaying a stale companion would override a
|
|
244
|
+
// later numeric value (or an intrinsic sizing keyword).
|
|
245
|
+
if (prop == Property::Height || prop == Property::HeightPercent || prop == Property::HeightExpression) {
|
|
246
|
+
for (Property companion : {Property::Height, Property::HeightPercent, Property::HeightExpression})
|
|
247
|
+
if (companion != prop) overrides.remove(companion);
|
|
248
|
+
}
|
|
249
|
+
if (prop == Property::Width || prop == Property::WidthPercent || prop == Property::WidthExpression) {
|
|
250
|
+
for (Property companion : {Property::Width, Property::WidthPercent, Property::WidthExpression})
|
|
251
|
+
if (companion != prop) overrides.remove(companion);
|
|
252
|
+
}
|
|
253
|
+
if (prop == Property::LineHeight || prop == Property::LineHeightExpression || prop == Property::LineHeightMultiplier)
|
|
254
|
+
for (Property companion : {Property::LineHeight, Property::LineHeightExpression, Property::LineHeightMultiplier})
|
|
255
|
+
if (companion != prop) overrides.remove(companion);
|
|
256
|
+
if (prop == Property::FlexBasis || prop == Property::FlexBasisExpression)
|
|
257
|
+
overrides.remove(prop == Property::FlexBasis ? Property::FlexBasisExpression : Property::FlexBasis);
|
|
258
|
+
if (prop >= Property::MarginTop && prop <= Property::MarginLeft)
|
|
259
|
+
overrides.remove(static_cast<Property>(static_cast<int>(Property::MarginTopExpression) + static_cast<int>(prop) - static_cast<int>(Property::MarginTop)));
|
|
260
|
+
if (prop >= Property::PaddingTop && prop <= Property::PaddingLeft)
|
|
261
|
+
overrides.remove(static_cast<Property>(static_cast<int>(Property::PaddingTopExpression) + static_cast<int>(prop) - static_cast<int>(Property::PaddingTop)));
|
|
262
|
+
if (prop == Property::Gap)
|
|
263
|
+
for (Property companion : {Property::RowGap, Property::ColumnGap, Property::RowGapPercent, Property::ColumnGapPercent}) overrides.remove(companion);
|
|
264
|
+
if (prop == Property::BorderWidth)
|
|
265
|
+
for (Property side : {Property::BorderTopWidth, Property::BorderRightWidth, Property::BorderBottomWidth, Property::BorderLeftWidth}) overrides.remove(side);
|
|
266
|
+
if (prop == Property::BorderRelief)
|
|
267
|
+
for (int side = 0; side < 4; ++side) overrides.remove(static_cast<Property>(static_cast<int>(Property::BorderTopRelief) + side));
|
|
268
|
+
|
|
269
|
+
// Literal/currentColor companions form one authored color. A common
|
|
270
|
+
// border-color resets all side colors; later side writes retain their order.
|
|
271
|
+
if (prop == Property::BorderColor || prop == Property::BorderColorCurrent) {
|
|
272
|
+
for (Property color : {Property::BorderColor, Property::BorderColorCurrent,
|
|
273
|
+
Property::BorderTopColor, Property::BorderRightColor, Property::BorderBottomColor, Property::BorderLeftColor,
|
|
274
|
+
Property::BorderTopColorCurrent, Property::BorderRightColorCurrent, Property::BorderBottomColorCurrent, Property::BorderLeftColorCurrent, Property::BorderAlpha, Property::BorderTopAlpha, Property::BorderRightAlpha, Property::BorderBottomAlpha, Property::BorderLeftAlpha})
|
|
275
|
+
overrides.remove(color);
|
|
276
|
+
} else {
|
|
277
|
+
const Property colors[] = {Property::BorderTopColor, Property::BorderRightColor, Property::BorderBottomColor, Property::BorderLeftColor};
|
|
278
|
+
for (int side = 0; side < 4; ++side) {
|
|
279
|
+
const Property current = static_cast<Property>(static_cast<int>(Property::BorderTopColorCurrent) + side);
|
|
280
|
+
if (prop == colors[side] || prop == current) { overrides.remove(colors[side]); overrides.remove(current); overrides.remove(static_cast<Property>(static_cast<int>(Property::BorderTopAlpha) + side)); break; }
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (prop == Property::BackgroundColor) { overrides.remove(Property::BackgroundColor); overrides.remove(Property::BackgroundAlpha); }
|
|
284
|
+
if (prop == Property::Color) { overrides.remove(Property::Color); overrides.remove(Property::ColorAlpha); }
|
|
285
|
+
overrides.set(prop, value);
|
|
286
|
+
}
|
|
163
287
|
Node *n = &state.nodes[node];
|
|
164
288
|
int changed = 0;
|
|
165
289
|
int prevOpacity = -1;
|
|
@@ -195,14 +319,111 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
195
319
|
changed = 1;
|
|
196
320
|
}
|
|
197
321
|
break;
|
|
322
|
+
case Property::BoxSizing: if (n->style.box_sizing != value) { n->style.box_sizing = value; changed = 1; } break;
|
|
323
|
+
#if GEA_CSS_FLOATS
|
|
324
|
+
case Property::Float: if (n->style.float_side != value) { n->style.float_side = value; changed = 1; } break;
|
|
325
|
+
#endif
|
|
326
|
+
#if GEA_CSS_ASPECT_RATIO
|
|
327
|
+
case Property::AspectRatio: if ((GEA_CSS_ASPECT_RATIO ? rstyle(n->style).aspect_ratio : 0) != value) { rstyleMut(n->style).aspect_ratio = value; changed = 1; } break;
|
|
328
|
+
#endif
|
|
329
|
+
#if GEA_CSS_CONTAINMENT
|
|
330
|
+
case Property::Containment: if ((GEA_CSS_CONTAINMENT ? rstyle(n->style).containment : 0) != value) { rstyleMut(n->style).containment = value; changed = 1; } break;
|
|
331
|
+
#endif
|
|
332
|
+
#if GEA_CSS_FLEX_LINE_COUNT
|
|
333
|
+
case Property::FlexLineCount: if ((GEA_CSS_FLEX_LINE_COUNT ? rstyle(n->style).flex_line_count : 1) != value) { rstyleMut(n->style).flex_line_count = value; changed = 1; } break;
|
|
334
|
+
#endif
|
|
335
|
+
#if GEA_CSS_MARGIN_TRIM
|
|
336
|
+
case Property::MarginTrim: if ((GEA_CSS_MARGIN_TRIM ? rstyle(n->style).margin_trim : 0) != value) { rstyleMut(n->style).margin_trim = value; changed = 1; } break;
|
|
337
|
+
#endif
|
|
338
|
+
#if GEA_CSS_FLOATS
|
|
339
|
+
case Property::Clear: if (n->style.clear_side != value) { n->style.clear_side = value; changed = 1; } break;
|
|
340
|
+
#endif
|
|
341
|
+
#if GEA_CSS_WRITING_MODE
|
|
342
|
+
case Property::Direction: if (n->style.direction != value) { n->style.direction = value; changed = 1; } break;
|
|
343
|
+
case Property::WritingMode: if (n->style.writing_mode != value) { n->style.writing_mode = value; changed = 1; } break;
|
|
344
|
+
#endif
|
|
345
|
+
#if GEA_CSS_AXIS_GAP
|
|
346
|
+
case Property::RowGap: if (n->style.row_gap != value) { n->style.row_gap = value; changed = 1; } break;
|
|
347
|
+
#endif
|
|
348
|
+
#if GEA_CSS_AXIS_GAP
|
|
349
|
+
case Property::ColumnGap: if (n->style.column_gap != value) { n->style.column_gap = value; changed = 1; } break;
|
|
350
|
+
#endif
|
|
351
|
+
#if GEA_CSS_PERCENT_GAP
|
|
352
|
+
case Property::RowGapPercent: if (n->style.row_gap_percent != value) { n->style.row_gap_percent = value; changed = 1; } break;
|
|
353
|
+
case Property::ColumnGapPercent: if (n->style.column_gap_percent != value) { n->style.column_gap_percent = value; changed = 1; } break;
|
|
354
|
+
#endif
|
|
355
|
+
case Property::MarginTopAuto: { const auto mask = (n->style.margin_auto & ~1) | (value ? 1 : 0); if (mask != n->style.margin_auto) { n->style.margin_auto = mask; changed = 1; } break; }
|
|
356
|
+
case Property::MarginRightAuto: { const auto mask = (n->style.margin_auto & ~2) | (value ? 2 : 0); if (mask != n->style.margin_auto) { n->style.margin_auto = mask; changed = 1; } break; }
|
|
357
|
+
case Property::MarginBottomAuto: { const auto mask = (n->style.margin_auto & ~4) | (value ? 4 : 0); if (mask != n->style.margin_auto) { n->style.margin_auto = mask; changed = 1; } break; }
|
|
358
|
+
case Property::MarginLeftAuto: { const auto mask = (n->style.margin_auto & ~8) | (value ? 8 : 0); if (mask != n->style.margin_auto) { n->style.margin_auto = mask; changed = 1; } break; }
|
|
359
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
360
|
+
case Property::MarginTopExpression: if (rstyle(n->style).margin_expression[0] != value) { rstyleMut(n->style).margin_expression[0] = value; changed = 1; } break;
|
|
361
|
+
#endif
|
|
362
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
363
|
+
case Property::MarginRightExpression: if (rstyle(n->style).margin_expression[1] != value) { rstyleMut(n->style).margin_expression[1] = value; changed = 1; } break;
|
|
364
|
+
#endif
|
|
365
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
366
|
+
case Property::MarginBottomExpression: if (rstyle(n->style).margin_expression[2] != value) { rstyleMut(n->style).margin_expression[2] = value; changed = 1; } break;
|
|
367
|
+
#endif
|
|
368
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
369
|
+
case Property::MarginLeftExpression: if (rstyle(n->style).margin_expression[3] != value) { rstyleMut(n->style).margin_expression[3] = value; changed = 1; } break;
|
|
370
|
+
#endif
|
|
371
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
372
|
+
case Property::PaddingTopExpression: if (rstyle(n->style).padding_expression[0] != value) { rstyleMut(n->style).padding_expression[0] = value; changed = 1; } break;
|
|
373
|
+
#endif
|
|
374
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
375
|
+
case Property::PaddingRightExpression: if (rstyle(n->style).padding_expression[1] != value) { rstyleMut(n->style).padding_expression[1] = value; changed = 1; } break;
|
|
376
|
+
#endif
|
|
377
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
378
|
+
case Property::PaddingBottomExpression: if (rstyle(n->style).padding_expression[2] != value) { rstyleMut(n->style).padding_expression[2] = value; changed = 1; } break;
|
|
379
|
+
#endif
|
|
380
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
381
|
+
case Property::PaddingLeftExpression: if (rstyle(n->style).padding_expression[3] != value) { rstyleMut(n->style).padding_expression[3] = value; changed = 1; } break;
|
|
382
|
+
#endif
|
|
383
|
+
case Property::WidthExpression: if (n->style.width_expression != value) { n->style.width_expression = value; n->style.width = n->style.width_percent = kUnset; changed = 1; } break;
|
|
384
|
+
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
385
|
+
case Property::HeightExpression: if (n->style.height_expression != value) { n->style.height_expression = value; n->style.height = n->style.height_percent = kUnset; changed = 1; } break;
|
|
386
|
+
#endif
|
|
387
|
+
#if GEA_CSS_ORDER
|
|
388
|
+
case Property::Order: if (n->style.order != value) { n->style.order = value; changed = 1; } break;
|
|
389
|
+
#endif
|
|
390
|
+
#if GEA_CSS_FLEX_WRAP
|
|
198
391
|
case Property::FlexWrap: if (n->style.flex_wrap != value) { n->style.flex_wrap = value; changed = 1; } break;
|
|
392
|
+
#endif
|
|
199
393
|
case Property::JustifyContent: if (n->style.justify_content != value) { n->style.justify_content = value; changed = 1; } break;
|
|
200
394
|
case Property::AlignItems: if (n->style.align_items != value) { n->style.align_items = value; changed = 1; } break;
|
|
395
|
+
#if GEA_CSS_JUSTIFY_ITEMS
|
|
201
396
|
case Property::JustifyItems: if (n->style.justify_items != value) { n->style.justify_items = value; changed = 1; } break;
|
|
397
|
+
#endif
|
|
398
|
+
#if GEA_CSS_ALIGN_CONTENT
|
|
202
399
|
case Property::AlignContent: if (n->style.align_content != value) { n->style.align_content = value; changed = 1; } break;
|
|
400
|
+
#endif
|
|
401
|
+
#if GEA_CSS_ALIGN_SELF
|
|
203
402
|
case Property::AlignSelf: if (n->style.align_self != value) { n->style.align_self = value; changed = 1; } break;
|
|
204
|
-
|
|
403
|
+
#endif
|
|
404
|
+
#if GEA_CSS_JUSTIFY_SELF
|
|
405
|
+
case Property::JustifySelf: if ((GEA_CSS_JUSTIFY_SELF ? rstyle(n->style).justify_self : -1) != value) { rstyleMut(n->style).justify_self = value; changed = 1; } break;
|
|
406
|
+
#endif
|
|
407
|
+
#if GEA_CSS_GRID
|
|
408
|
+
case Property::GridRowStart: if (rstyle(n->style).grid_line[0] != value) { rstyleMut(n->style).grid_line[0] = value; changed = 1; } break;
|
|
409
|
+
case Property::GridColumnStart: if (rstyle(n->style).grid_line[1] != value) { rstyleMut(n->style).grid_line[1] = value; changed = 1; } break;
|
|
410
|
+
case Property::GridRowEnd: if (rstyle(n->style).grid_line[2] != value) { rstyleMut(n->style).grid_line[2] = value; changed = 1; } break;
|
|
411
|
+
case Property::GridColumnEnd: if (rstyle(n->style).grid_line[3] != value) { rstyleMut(n->style).grid_line[3] = value; changed = 1; } break;
|
|
412
|
+
#endif
|
|
413
|
+
case Property::Gap:
|
|
414
|
+
if (n->style.gap != value || n->style.row_gap != kUnset || n->style.column_gap != kUnset || n->style.row_gap_percent != kUnset || n->style.column_gap_percent != kUnset) {
|
|
415
|
+
n->style.gap = value;
|
|
416
|
+
#if GEA_CSS_AXIS_GAP
|
|
417
|
+
n->style.row_gap = n->style.column_gap = kUnset;
|
|
418
|
+
#endif
|
|
419
|
+
#if GEA_CSS_PERCENT_GAP
|
|
420
|
+
n->style.row_gap_percent = n->style.column_gap_percent = kUnset;
|
|
421
|
+
#endif
|
|
422
|
+
changed = 1;
|
|
423
|
+
}
|
|
424
|
+
break;
|
|
205
425
|
case Property::Width:
|
|
426
|
+
if (n->style.width_expression >= 0) { n->style.width_expression = -1; changed = 1; }
|
|
206
427
|
if (n->style.width != value || n->style.width_percent != kUnset) {
|
|
207
428
|
n->style.width = value;
|
|
208
429
|
n->style.width_percent = kUnset;
|
|
@@ -210,6 +431,9 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
210
431
|
}
|
|
211
432
|
break;
|
|
212
433
|
case Property::Height:
|
|
434
|
+
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
435
|
+
if (n->style.height_expression != -1) { n->style.height_expression = -1; changed = 1; }
|
|
436
|
+
#endif
|
|
213
437
|
if (n->style.height != value || n->style.height_percent != kUnset) {
|
|
214
438
|
n->style.height = value;
|
|
215
439
|
n->style.height_percent = kUnset;
|
|
@@ -217,6 +441,7 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
217
441
|
}
|
|
218
442
|
break;
|
|
219
443
|
case Property::WidthPercent:
|
|
444
|
+
if (n->style.width_expression >= 0) { n->style.width_expression = -1; changed = 1; }
|
|
220
445
|
if (n->style.width_percent != value || n->style.width != kUnset) {
|
|
221
446
|
n->style.width_percent = value;
|
|
222
447
|
n->style.width = kUnset;
|
|
@@ -224,96 +449,206 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
224
449
|
}
|
|
225
450
|
break;
|
|
226
451
|
case Property::HeightPercent:
|
|
452
|
+
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
453
|
+
if (n->style.height_expression != -1) { n->style.height_expression = -1; changed = 1; }
|
|
454
|
+
#endif
|
|
227
455
|
if (n->style.height_percent != value || n->style.height != kUnset) {
|
|
228
456
|
n->style.height_percent = value;
|
|
229
457
|
n->style.height = kUnset;
|
|
230
458
|
changed = 1;
|
|
231
459
|
}
|
|
232
460
|
break;
|
|
461
|
+
#if GEA_CSS_MIN_WIDTH
|
|
233
462
|
case Property::MinWidth: if (n->style.min_width != value) { n->style.min_width = value; changed = 1; } break;
|
|
463
|
+
#endif
|
|
234
464
|
case Property::MinHeight: if (n->style.min_height != value) { n->style.min_height = value; changed = 1; } break;
|
|
235
465
|
case Property::MaxWidth: if (n->style.max_width != value) { n->style.max_width = value; changed = 1; } break;
|
|
466
|
+
#if GEA_CSS_MAX_HEIGHT
|
|
236
467
|
case Property::MaxHeight: if (n->style.max_height != value) { n->style.max_height = value; changed = 1; } break;
|
|
468
|
+
#endif
|
|
237
469
|
case Property::Flex: if (n->style.flex != value) { n->style.flex = value; changed = 1; } break;
|
|
238
470
|
case Property::FlexShrink: if (n->style.flex_shrink != value) { n->style.flex_shrink = value; changed = 1; } break;
|
|
239
|
-
case Property::FlexBasis:
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
case Property::
|
|
471
|
+
case Property::FlexBasis:
|
|
472
|
+
#if GEA_CSS_FLEX_BASIS_EXPRESSIONS
|
|
473
|
+
if (rstyle(n->style).flex_basis_expression >= 0) { rstyleMut(n->style).flex_basis_expression = -1; changed = 1; }
|
|
474
|
+
#endif
|
|
475
|
+
#if GEA_CSS_FLEX_BASIS
|
|
476
|
+
if (n->style.flex_basis != value) { n->style.flex_basis = value; changed = 1; }
|
|
477
|
+
#endif
|
|
478
|
+
break;
|
|
479
|
+
#if GEA_CSS_FLEX_BASIS_EXPRESSIONS
|
|
480
|
+
case Property::FlexBasisExpression:
|
|
481
|
+
if (rstyle(n->style).flex_basis_expression != value || n->style.flex_basis != kUnset) {
|
|
482
|
+
rstyleMut(n->style).flex_basis_expression = value;
|
|
483
|
+
#if GEA_CSS_FLEX_BASIS
|
|
484
|
+
n->style.flex_basis = kUnset;
|
|
485
|
+
#endif
|
|
486
|
+
changed = 1;
|
|
487
|
+
}
|
|
488
|
+
break;
|
|
489
|
+
#endif
|
|
490
|
+
case Property::PaddingTop:
|
|
491
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
492
|
+
if (rstyle(n->style).padding_expression[0] >= 0) { rstyleMut(n->style).padding_expression[0] = -1; changed = 1; }
|
|
493
|
+
#endif
|
|
494
|
+
if (n->style.padding[0] != value) { n->style.padding[0] = value; changed = 1; } break;
|
|
495
|
+
case Property::PaddingRight:
|
|
496
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
497
|
+
if (rstyle(n->style).padding_expression[1] >= 0) { rstyleMut(n->style).padding_expression[1] = -1; changed = 1; }
|
|
498
|
+
#endif
|
|
499
|
+
if (n->style.padding[1] != value) { n->style.padding[1] = value; changed = 1; } break;
|
|
500
|
+
case Property::PaddingBottom:
|
|
501
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
502
|
+
if (rstyle(n->style).padding_expression[2] >= 0) { rstyleMut(n->style).padding_expression[2] = -1; changed = 1; }
|
|
503
|
+
#endif
|
|
504
|
+
if (n->style.padding[2] != value) { n->style.padding[2] = value; changed = 1; } break;
|
|
505
|
+
case Property::PaddingLeft:
|
|
506
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
507
|
+
if (rstyle(n->style).padding_expression[3] >= 0) { rstyleMut(n->style).padding_expression[3] = -1; changed = 1; }
|
|
508
|
+
#endif
|
|
509
|
+
if (n->style.padding[3] != value) { n->style.padding[3] = value; changed = 1; } break;
|
|
510
|
+
case Property::MarginTop:
|
|
511
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
512
|
+
if (rstyle(n->style).margin_expression[0] >= 0) { rstyleMut(n->style).margin_expression[0] = -1; changed = 1; }
|
|
513
|
+
#endif
|
|
514
|
+
if (n->style.margin[0] != value || (n->style.margin_auto & 1)) { n->style.margin[0] = value; n->style.margin_auto &= ~1; changed = 1; } break;
|
|
515
|
+
case Property::MarginRight:
|
|
516
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
517
|
+
if (rstyle(n->style).margin_expression[1] >= 0) { rstyleMut(n->style).margin_expression[1] = -1; changed = 1; }
|
|
518
|
+
#endif
|
|
519
|
+
if (n->style.margin[1] != value || (n->style.margin_auto & 2)) { n->style.margin[1] = value; n->style.margin_auto &= ~2; changed = 1; } break;
|
|
520
|
+
case Property::MarginBottom:
|
|
521
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
522
|
+
if (rstyle(n->style).margin_expression[2] >= 0) { rstyleMut(n->style).margin_expression[2] = -1; changed = 1; }
|
|
523
|
+
#endif
|
|
524
|
+
if (n->style.margin[2] != value || (n->style.margin_auto & 4)) { n->style.margin[2] = value; n->style.margin_auto &= ~4; changed = 1; } break;
|
|
525
|
+
case Property::MarginLeft:
|
|
526
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
527
|
+
if (rstyle(n->style).margin_expression[3] >= 0) { rstyleMut(n->style).margin_expression[3] = -1; changed = 1; }
|
|
528
|
+
#endif
|
|
529
|
+
if (n->style.margin[3] != value || (n->style.margin_auto & 8)) { n->style.margin[3] = value; n->style.margin_auto &= ~8; changed = 1; } break;
|
|
530
|
+
case Property::Position: if (value == kPositionFixed) state.fixedPositionUsed = true; if (n->style.position != value) { n->style.position = value; changed = 1; } break;
|
|
249
531
|
case Property::Top:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
n->style
|
|
532
|
+
#if GEA_CSS_POSITION_TOP
|
|
533
|
+
if (GEA_CSS_POSITION_PX_0(n->style) != value || GEA_CSS_POSITION_PERCENT_0(n->style) != kUnset) {
|
|
534
|
+
GEA_CSS_POSITION_PX_0(n->style) = value;
|
|
535
|
+
#if GEA_CSS_POSITION_TOP_PERCENT
|
|
536
|
+
GEA_CSS_POSITION_PERCENT_0(n->style) = kUnset;
|
|
537
|
+
#endif
|
|
253
538
|
changed = 1;
|
|
254
539
|
}
|
|
540
|
+
#endif
|
|
255
541
|
break;
|
|
256
542
|
case Property::Right:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
n->style
|
|
543
|
+
#if GEA_CSS_POSITION_RIGHT
|
|
544
|
+
if (GEA_CSS_POSITION_PX_1(n->style) != value || GEA_CSS_POSITION_PERCENT_1(n->style) != kUnset) {
|
|
545
|
+
GEA_CSS_POSITION_PX_1(n->style) = value;
|
|
546
|
+
#if GEA_CSS_POSITION_RIGHT_PERCENT
|
|
547
|
+
GEA_CSS_POSITION_PERCENT_1(n->style) = kUnset;
|
|
548
|
+
#endif
|
|
260
549
|
changed = 1;
|
|
261
550
|
}
|
|
551
|
+
#endif
|
|
262
552
|
break;
|
|
263
553
|
case Property::Bottom:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
n->style
|
|
554
|
+
#if GEA_CSS_POSITION_BOTTOM
|
|
555
|
+
if (GEA_CSS_POSITION_PX_2(n->style) != value || GEA_CSS_POSITION_PERCENT_2(n->style) != kUnset) {
|
|
556
|
+
GEA_CSS_POSITION_PX_2(n->style) = value;
|
|
557
|
+
#if GEA_CSS_POSITION_BOTTOM_PERCENT
|
|
558
|
+
GEA_CSS_POSITION_PERCENT_2(n->style) = kUnset;
|
|
559
|
+
#endif
|
|
267
560
|
changed = 1;
|
|
268
561
|
}
|
|
562
|
+
#endif
|
|
269
563
|
break;
|
|
270
564
|
case Property::Left:
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
n->style
|
|
565
|
+
#if GEA_CSS_POSITION_LEFT
|
|
566
|
+
if (GEA_CSS_POSITION_PX_3(n->style) != value || GEA_CSS_POSITION_PERCENT_3(n->style) != kUnset) {
|
|
567
|
+
GEA_CSS_POSITION_PX_3(n->style) = value;
|
|
568
|
+
#if GEA_CSS_POSITION_LEFT_PERCENT
|
|
569
|
+
GEA_CSS_POSITION_PERCENT_3(n->style) = kUnset;
|
|
570
|
+
#endif
|
|
274
571
|
changed = 1;
|
|
275
572
|
}
|
|
573
|
+
#endif
|
|
276
574
|
break;
|
|
277
575
|
case Property::TopPercent:
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
n->style
|
|
576
|
+
#if GEA_CSS_POSITION_TOP_PERCENT
|
|
577
|
+
if (GEA_CSS_POSITION_PERCENT_0(n->style) != value || GEA_CSS_POSITION_PX_0(n->style) != kUnset) {
|
|
578
|
+
GEA_CSS_POSITION_PERCENT_0(n->style) = value;
|
|
579
|
+
#if GEA_CSS_POSITION_TOP
|
|
580
|
+
GEA_CSS_POSITION_PX_0(n->style) = kUnset;
|
|
581
|
+
#endif
|
|
281
582
|
changed = 1;
|
|
282
583
|
}
|
|
584
|
+
#endif
|
|
283
585
|
break;
|
|
284
586
|
case Property::RightPercent:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
n->style
|
|
587
|
+
#if GEA_CSS_POSITION_RIGHT_PERCENT
|
|
588
|
+
if (GEA_CSS_POSITION_PERCENT_1(n->style) != value || GEA_CSS_POSITION_PX_1(n->style) != kUnset) {
|
|
589
|
+
GEA_CSS_POSITION_PERCENT_1(n->style) = value;
|
|
590
|
+
#if GEA_CSS_POSITION_RIGHT
|
|
591
|
+
GEA_CSS_POSITION_PX_1(n->style) = kUnset;
|
|
592
|
+
#endif
|
|
288
593
|
changed = 1;
|
|
289
594
|
}
|
|
595
|
+
#endif
|
|
290
596
|
break;
|
|
291
597
|
case Property::BottomPercent:
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
n->style
|
|
598
|
+
#if GEA_CSS_POSITION_BOTTOM_PERCENT
|
|
599
|
+
if (GEA_CSS_POSITION_PERCENT_2(n->style) != value || GEA_CSS_POSITION_PX_2(n->style) != kUnset) {
|
|
600
|
+
GEA_CSS_POSITION_PERCENT_2(n->style) = value;
|
|
601
|
+
#if GEA_CSS_POSITION_BOTTOM
|
|
602
|
+
GEA_CSS_POSITION_PX_2(n->style) = kUnset;
|
|
603
|
+
#endif
|
|
295
604
|
changed = 1;
|
|
296
605
|
}
|
|
606
|
+
#endif
|
|
297
607
|
break;
|
|
298
608
|
case Property::LeftPercent:
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
n->style
|
|
609
|
+
#if GEA_CSS_POSITION_LEFT_PERCENT
|
|
610
|
+
if (GEA_CSS_POSITION_PERCENT_3(n->style) != value || GEA_CSS_POSITION_PX_3(n->style) != kUnset) {
|
|
611
|
+
GEA_CSS_POSITION_PERCENT_3(n->style) = value;
|
|
612
|
+
#if GEA_CSS_POSITION_LEFT
|
|
613
|
+
GEA_CSS_POSITION_PX_3(n->style) = kUnset;
|
|
614
|
+
#endif
|
|
302
615
|
changed = 1;
|
|
303
616
|
}
|
|
617
|
+
#endif
|
|
304
618
|
break;
|
|
305
|
-
|
|
619
|
+
#if GEA_CSS_Z_INDEX
|
|
620
|
+
case Property::ZIndex: {
|
|
621
|
+
const bool automatic = value == kZIndexAuto;
|
|
622
|
+
const int level = automatic ? 0 : std::clamp(value, -32768, 32767);
|
|
623
|
+
if (n->style.z_index != level || n->style.z_index_auto != automatic) {
|
|
624
|
+
n->style.z_index = level; n->style.z_index_auto = automatic; changed = 1;
|
|
625
|
+
}
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
#endif
|
|
306
629
|
case Property::BackgroundColor: {
|
|
307
630
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
308
631
|
if (n->style.bg_color != next) { n->style.bg_color = next; changed = 1; }
|
|
309
632
|
if (n->style.bg_alpha != 255) { n->style.bg_alpha = 255; changed = 1; }
|
|
310
|
-
if (n->style.bg_fill != 0) { n->style.bg_fill = 0; changed = 1; }
|
|
311
|
-
if (rstyle(n->style).bg_gradient_has_mid != 0) { rstyleMut(n->style).bg_gradient_has_mid = 0; changed = 1; }
|
|
312
|
-
if (rstyle(n->style).bg_overlay_gradient != 0) { rstyleMut(n->style).bg_overlay_gradient = 0; changed = 1; }
|
|
313
|
-
if (rstyle(n->style).bg_radial_gradient != 0) { rstyleMut(n->style).bg_radial_gradient = 0; changed = 1; }
|
|
314
|
-
if (rstyle(n->style).bg_grid_axes != 0) { rstyleMut(n->style).bg_grid_axes = 0; changed = 1; }
|
|
315
633
|
break;
|
|
316
634
|
}
|
|
635
|
+
case Property::BackgroundAlpha: {
|
|
636
|
+
const uint8_t alpha = static_cast<uint8_t>(std::clamp(value, 0, 255));
|
|
637
|
+
if (n->style.bg_alpha != alpha) { n->style.bg_alpha = alpha; changed = 1; }
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
#if GEA_CSS_BACKGROUND_LAYERS
|
|
641
|
+
case Property::BackgroundClip: if (rstyle(n->style).bg_clip != value) { rstyleMut(n->style).bg_clip = value; changed = 1; } break;
|
|
642
|
+
case Property::BackgroundSizeList: if (rstyle(n->style).bg_size_list != value) { rstyleMut(n->style).bg_size_list = value; changed = 1; } break;
|
|
643
|
+
case Property::BackgroundPositionList: if (rstyle(n->style).bg_position_list != value) { rstyleMut(n->style).bg_position_list = value; changed = 1; } break;
|
|
644
|
+
case Property::BackgroundRepeatList: if (rstyle(n->style).bg_repeat_list != value) { rstyleMut(n->style).bg_repeat_list = value; changed = 1; } break;
|
|
645
|
+
case Property::BackgroundAttachmentList: if (rstyle(n->style).bg_attachment_list != value) { rstyleMut(n->style).bg_attachment_list = value; changed = 1; } break;
|
|
646
|
+
case Property::BackgroundOriginList: if (rstyle(n->style).bg_origin_list != value) { rstyleMut(n->style).bg_origin_list = value; changed = 1; } break;
|
|
647
|
+
|
|
648
|
+
#endif
|
|
649
|
+
case Property::BackgroundImage:
|
|
650
|
+
changed = StyleValues::applyBackgroundImage(n->style, value, node);
|
|
651
|
+
break;
|
|
317
652
|
case Property::HasBackground: if (n->style.has_bg != value) { n->style.has_bg = value; changed = 1; } break;
|
|
318
653
|
case Property::ActiveBackgroundColor: {
|
|
319
654
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
@@ -324,14 +659,19 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
324
659
|
case Property::Color: {
|
|
325
660
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
326
661
|
if (n->style.text_color != next) { n->style.text_color = next; changed = 1; }
|
|
662
|
+
#if GEA_CSS_TEXT_ALPHA
|
|
327
663
|
if (n->style.text_alpha != 255) { n->style.text_alpha = 255; changed = 1; }
|
|
664
|
+
#endif
|
|
328
665
|
break;
|
|
329
666
|
}
|
|
667
|
+
#if GEA_CSS_OPACITY
|
|
330
668
|
case Property::Opacity: {
|
|
331
669
|
uint8_t next = (uint8_t)value;
|
|
332
670
|
if (n->style.opacity != next) { prevOpacity = n->style.opacity; n->style.opacity = next; changed = 1; }
|
|
333
671
|
break;
|
|
334
672
|
}
|
|
673
|
+
#endif
|
|
674
|
+
#if GEA_CSS_BLINK
|
|
335
675
|
case Property::BlinkInterval:
|
|
336
676
|
value = value > 0 ? value : 0;
|
|
337
677
|
if (n->style.blink_interval_ms != value) {
|
|
@@ -341,108 +681,218 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
341
681
|
changed = 1;
|
|
342
682
|
}
|
|
343
683
|
break;
|
|
344
|
-
|
|
684
|
+
#endif
|
|
685
|
+
case Property::ColorAlpha: {
|
|
686
|
+
#if GEA_CSS_TEXT_ALPHA
|
|
687
|
+
const uint8_t alpha = static_cast<uint8_t>(std::clamp(value, 0, 255));
|
|
688
|
+
if (n->style.text_alpha != alpha) { n->style.text_alpha = alpha; changed = 1; }
|
|
689
|
+
#endif
|
|
690
|
+
break;
|
|
691
|
+
}
|
|
692
|
+
case Property::BorderAlpha: {
|
|
693
|
+
#if GEA_CSS_BORDER_ALPHA
|
|
694
|
+
const uint8_t alpha = static_cast<uint8_t>(std::clamp(value, 0, 255));
|
|
695
|
+
if (n->style.border_alpha != alpha) { n->style.border_alpha = alpha; changed = 1; }
|
|
696
|
+
#endif
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
700
|
+
case Property::BorderTopAlpha:
|
|
701
|
+
case Property::BorderRightAlpha:
|
|
702
|
+
case Property::BorderBottomAlpha:
|
|
703
|
+
case Property::BorderLeftAlpha:
|
|
704
|
+
{
|
|
705
|
+
const int side = static_cast<int>(prop) - static_cast<int>(Property::BorderTopAlpha);
|
|
706
|
+
const uint8_t alpha = static_cast<uint8_t>(std::clamp(value, 0, 255));
|
|
707
|
+
if (rstyle(n->style).border_side_alpha[side] != alpha) { rstyleMut(n->style).border_side_alpha[side] = alpha; changed = 1; }
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
#endif
|
|
711
|
+
case Property::BorderColorCurrent: changed |= setBorderColorBinding(n->style, -1, value != 0); break;
|
|
712
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
713
|
+
case Property::BorderTopColorCurrent:
|
|
714
|
+
case Property::BorderRightColorCurrent:
|
|
715
|
+
case Property::BorderBottomColorCurrent:
|
|
716
|
+
case Property::BorderLeftColorCurrent:
|
|
717
|
+
changed |= setBorderColorBinding(n->style, static_cast<int>(prop) - static_cast<int>(Property::BorderTopColorCurrent), value != 0);
|
|
718
|
+
break;
|
|
719
|
+
#endif
|
|
720
|
+
case Property::BorderWidth: changed |= setComputedBorderWidth(n->style, -1, value, n->parent >= 0 ? &state.nodes[n->parent].style : nullptr); break;
|
|
345
721
|
case Property::BorderColor: {
|
|
722
|
+
changed |= setBorderColorBinding(n->style, -1, false);
|
|
346
723
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
347
724
|
if (n->style.border_color != next) { n->style.border_color = next; changed = 1; }
|
|
725
|
+
#if GEA_CSS_BORDER_ALPHA
|
|
348
726
|
if (n->style.border_alpha != 255) { n->style.border_alpha = 255; changed = 1; }
|
|
727
|
+
#endif
|
|
349
728
|
break;
|
|
350
729
|
}
|
|
351
|
-
|
|
352
|
-
case Property::
|
|
353
|
-
|
|
354
|
-
|
|
730
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
731
|
+
case Property::BorderTopWidth: changed |= setComputedBorderWidth(n->style, 0, value, n->parent >= 0 ? &state.nodes[n->parent].style : nullptr); break;
|
|
732
|
+
#endif
|
|
733
|
+
#if GEA_CSS_BORDER_RELIEF
|
|
734
|
+
case Property::BorderRelief:
|
|
735
|
+
case Property::BorderTopRelief:
|
|
736
|
+
case Property::BorderRightRelief:
|
|
737
|
+
case Property::BorderBottomRelief:
|
|
738
|
+
case Property::BorderLeftRelief:
|
|
739
|
+
for (int side = 0; side < 4; ++side) {
|
|
740
|
+
if (prop != Property::BorderRelief && side != static_cast<int>(prop) - static_cast<int>(Property::BorderTopRelief)) continue;
|
|
741
|
+
if (rstyle(n->style).border_relief[side] != value) {
|
|
742
|
+
rstyleMut(n->style).border_relief[side] = static_cast<uint8_t>(value);
|
|
743
|
+
changed = 1;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
break;
|
|
747
|
+
#endif
|
|
748
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
749
|
+
case Property::BorderRightWidth: changed |= setComputedBorderWidth(n->style, 1, value, n->parent >= 0 ? &state.nodes[n->parent].style : nullptr); break;
|
|
750
|
+
case Property::BorderBottomWidth: changed |= setComputedBorderWidth(n->style, 2, value, n->parent >= 0 ? &state.nodes[n->parent].style : nullptr); break;
|
|
751
|
+
case Property::BorderLeftWidth: changed |= setComputedBorderWidth(n->style, 3, value, n->parent >= 0 ? &state.nodes[n->parent].style : nullptr); break;
|
|
355
752
|
case Property::BorderTopColor: {
|
|
753
|
+
changed |= setBorderColorBinding(n->style, 0, false);
|
|
356
754
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
357
755
|
if (rstyle(n->style).border_side_color[0] != next) { rstyleMut(n->style).border_side_color[0] = next; changed = 1; }
|
|
358
756
|
if (rstyle(n->style).border_side_alpha[0] != 255) { rstyleMut(n->style).border_side_alpha[0] = 255; changed = 1; }
|
|
359
757
|
break;
|
|
360
758
|
}
|
|
361
759
|
case Property::BorderRightColor: {
|
|
760
|
+
changed |= setBorderColorBinding(n->style, 1, false);
|
|
362
761
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
363
762
|
if (rstyle(n->style).border_side_color[1] != next) { rstyleMut(n->style).border_side_color[1] = next; changed = 1; }
|
|
364
763
|
if (rstyle(n->style).border_side_alpha[1] != 255) { rstyleMut(n->style).border_side_alpha[1] = 255; changed = 1; }
|
|
365
764
|
break;
|
|
366
765
|
}
|
|
367
766
|
case Property::BorderBottomColor: {
|
|
767
|
+
changed |= setBorderColorBinding(n->style, 2, false);
|
|
368
768
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
369
769
|
if (rstyle(n->style).border_side_color[2] != next) { rstyleMut(n->style).border_side_color[2] = next; changed = 1; }
|
|
370
770
|
if (rstyle(n->style).border_side_alpha[2] != 255) { rstyleMut(n->style).border_side_alpha[2] = 255; changed = 1; }
|
|
371
771
|
break;
|
|
372
772
|
}
|
|
373
773
|
case Property::BorderLeftColor: {
|
|
774
|
+
changed |= setBorderColorBinding(n->style, 3, false);
|
|
374
775
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
375
776
|
if (rstyle(n->style).border_side_color[3] != next) { rstyleMut(n->style).border_side_color[3] = next; changed = 1; }
|
|
376
777
|
if (rstyle(n->style).border_side_alpha[3] != 255) { rstyleMut(n->style).border_side_alpha[3] = 255; changed = 1; }
|
|
377
778
|
break;
|
|
378
779
|
}
|
|
780
|
+
#endif
|
|
379
781
|
case Property::BorderRadiusTopLeft:
|
|
380
|
-
if (n->style.border_radius[0] != value || n->style.border_radius_percent[0] != kUnset) {
|
|
381
|
-
n->style.border_radius[0] = value;
|
|
382
|
-
|
|
782
|
+
if (n->style.border_radius[GEA_CSS_RADIUS_INDEX(0)] != value || n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] != kUnset) {
|
|
783
|
+
n->style.border_radius[GEA_CSS_RADIUS_INDEX(0)] = value;
|
|
784
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
785
|
+
n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] = kUnset;
|
|
786
|
+
#endif
|
|
383
787
|
changed = 1;
|
|
384
788
|
}
|
|
385
789
|
break;
|
|
386
790
|
case Property::BorderRadiusTopRight:
|
|
387
|
-
if (n->style.border_radius[1] != value || n->style.border_radius_percent[1] != kUnset) {
|
|
388
|
-
n->style.border_radius[1] = value;
|
|
389
|
-
|
|
791
|
+
if (n->style.border_radius[GEA_CSS_RADIUS_INDEX(1)] != value || n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] != kUnset) {
|
|
792
|
+
n->style.border_radius[GEA_CSS_RADIUS_INDEX(1)] = value;
|
|
793
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
794
|
+
n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] = kUnset;
|
|
795
|
+
#endif
|
|
390
796
|
changed = 1;
|
|
391
797
|
}
|
|
392
798
|
break;
|
|
393
799
|
case Property::BorderRadiusBottomRight:
|
|
394
|
-
if (n->style.border_radius[2] != value || n->style.border_radius_percent[2] != kUnset) {
|
|
395
|
-
n->style.border_radius[2] = value;
|
|
396
|
-
|
|
800
|
+
if (n->style.border_radius[GEA_CSS_RADIUS_INDEX(2)] != value || n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] != kUnset) {
|
|
801
|
+
n->style.border_radius[GEA_CSS_RADIUS_INDEX(2)] = value;
|
|
802
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
803
|
+
n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] = kUnset;
|
|
804
|
+
#endif
|
|
397
805
|
changed = 1;
|
|
398
806
|
}
|
|
399
807
|
break;
|
|
400
808
|
case Property::BorderRadiusBottomLeft:
|
|
401
|
-
if (n->style.border_radius[3] != value || n->style.border_radius_percent[3] != kUnset) {
|
|
402
|
-
n->style.border_radius[3] = value;
|
|
403
|
-
|
|
809
|
+
if (n->style.border_radius[GEA_CSS_RADIUS_INDEX(3)] != value || n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] != kUnset) {
|
|
810
|
+
n->style.border_radius[GEA_CSS_RADIUS_INDEX(3)] = value;
|
|
811
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
812
|
+
n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] = kUnset;
|
|
813
|
+
#endif
|
|
404
814
|
changed = 1;
|
|
405
815
|
}
|
|
406
816
|
break;
|
|
817
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
407
818
|
case Property::BorderRadiusTopLeftPercent:
|
|
408
|
-
if (n->style.border_radius_percent[0] != value || n->style.border_radius[0] != 0) {
|
|
409
|
-
n->style.border_radius_percent[0] = value;
|
|
410
|
-
n->style.border_radius[0] = 0;
|
|
819
|
+
if (n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] != value || n->style.border_radius[GEA_CSS_RADIUS_INDEX(0)] != 0) {
|
|
820
|
+
n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] = value;
|
|
821
|
+
n->style.border_radius[GEA_CSS_RADIUS_INDEX(0)] = 0;
|
|
411
822
|
changed = 1;
|
|
412
823
|
}
|
|
413
824
|
break;
|
|
414
825
|
case Property::BorderRadiusTopRightPercent:
|
|
415
|
-
if (n->style.border_radius_percent[1] != value || n->style.border_radius[1] != 0) {
|
|
416
|
-
n->style.border_radius_percent[1] = value;
|
|
417
|
-
n->style.border_radius[1] = 0;
|
|
826
|
+
if (n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] != value || n->style.border_radius[GEA_CSS_RADIUS_INDEX(1)] != 0) {
|
|
827
|
+
n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] = value;
|
|
828
|
+
n->style.border_radius[GEA_CSS_RADIUS_INDEX(1)] = 0;
|
|
418
829
|
changed = 1;
|
|
419
830
|
}
|
|
420
831
|
break;
|
|
421
832
|
case Property::BorderRadiusBottomRightPercent:
|
|
422
|
-
if (n->style.border_radius_percent[2] != value || n->style.border_radius[2] != 0) {
|
|
423
|
-
n->style.border_radius_percent[2] = value;
|
|
424
|
-
n->style.border_radius[2] = 0;
|
|
833
|
+
if (n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] != value || n->style.border_radius[GEA_CSS_RADIUS_INDEX(2)] != 0) {
|
|
834
|
+
n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] = value;
|
|
835
|
+
n->style.border_radius[GEA_CSS_RADIUS_INDEX(2)] = 0;
|
|
425
836
|
changed = 1;
|
|
426
837
|
}
|
|
427
838
|
break;
|
|
428
839
|
case Property::BorderRadiusBottomLeftPercent:
|
|
429
|
-
if (n->style.border_radius_percent[3] != value || n->style.border_radius[3] != 0) {
|
|
430
|
-
n->style.border_radius_percent[3] = value;
|
|
431
|
-
n->style.border_radius[3] = 0;
|
|
840
|
+
if (n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] != value || n->style.border_radius[GEA_CSS_RADIUS_INDEX(3)] != 0) {
|
|
841
|
+
n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] = value;
|
|
842
|
+
n->style.border_radius[GEA_CSS_RADIUS_INDEX(3)] = 0;
|
|
432
843
|
changed = 1;
|
|
433
844
|
}
|
|
434
845
|
break;
|
|
846
|
+
#endif
|
|
435
847
|
case Property::FontId: if (n->style.font_id != value) { n->style.font_id = value; changed = 1; } break;
|
|
436
848
|
case Property::FontSize: if (n->style.font_size != value) { n->style.font_size = value; changed = 1; } break;
|
|
437
849
|
case Property::FontWeight: if (n->style.font_weight != value) { n->style.font_weight = value; changed = 1; } break;
|
|
438
|
-
case Property::LineHeight:
|
|
850
|
+
case Property::LineHeight:
|
|
851
|
+
if (n->style.line_height_multiplier >= 0) { n->style.line_height_multiplier = -1; changed = 1; }
|
|
852
|
+
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
853
|
+
if (rstyle(n->style).line_height_expression >= 0) { rstyleMut(n->style).line_height_expression = -1; changed = 1; }
|
|
854
|
+
#endif
|
|
855
|
+
if (n->style.line_height != value) { n->style.line_height = value; changed = 1; } break;
|
|
856
|
+
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
857
|
+
case Property::LineHeightExpression: {
|
|
858
|
+
if (n->style.line_height_multiplier >= 0) { n->style.line_height_multiplier = -1; changed = 1; }
|
|
859
|
+
const int height = resolveLineHeightExpression(node, value);
|
|
860
|
+
if (rstyle(n->style).line_height_expression != value || n->style.line_height != height) {
|
|
861
|
+
rstyleMut(n->style).line_height_expression = value; n->style.line_height = height; changed = 1;
|
|
862
|
+
} break;
|
|
863
|
+
}
|
|
864
|
+
#endif
|
|
865
|
+
case Property::LineHeightMultiplier: {
|
|
866
|
+
const int height = resolveLineHeightMultiplier(node, value);
|
|
867
|
+
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
868
|
+
if (rstyle(n->style).line_height_expression >= 0) { rstyleMut(n->style).line_height_expression = -1; changed = 1; }
|
|
869
|
+
#endif
|
|
870
|
+
if (n->style.line_height_multiplier != value || n->style.line_height != height) {
|
|
871
|
+
n->style.line_height_multiplier = value; n->style.line_height = height; changed = 1;
|
|
872
|
+
} break;
|
|
873
|
+
}
|
|
439
874
|
case Property::TextAlign: if (n->style.text_align != value) { n->style.text_align = value; changed = 1; } break;
|
|
875
|
+
#if GEA_CSS_TEXT_DECORATION
|
|
440
876
|
case Property::TextDecoration: if (n->style.text_decoration != value) { n->style.text_decoration = value; changed = 1; } break;
|
|
877
|
+
#endif
|
|
878
|
+
#if GEA_CSS_TEXT_TRANSFORM
|
|
441
879
|
case Property::TextTransform: if (n->style.text_transform != value) { n->style.text_transform = value; changed = 1; } break;
|
|
880
|
+
#endif
|
|
442
881
|
case Property::WhiteSpace: if (n->style.white_space != static_cast<int8_t>(value)) { n->style.white_space = static_cast<int8_t>(value); changed = 1; } break;
|
|
443
882
|
case Property::TextOverflow: if (n->style.text_overflow != static_cast<int8_t>(value)) { n->style.text_overflow = static_cast<int8_t>(value); changed = 1; } break;
|
|
883
|
+
#if GEA_CSS_TRANSFORMS
|
|
884
|
+
case Property::TransformStyle: if (rstyle(n->style).transform_preserve_3d != (value != 0)) { rstyleMut(n->style).transform_preserve_3d = value != 0; changed = 1; } break;
|
|
885
|
+
#endif
|
|
886
|
+
#if GEA_CSS_VISIBILITY
|
|
887
|
+
case Property::Visibility: if (n->style.visibility != static_cast<int8_t>(value)) { n->style.visibility = static_cast<int8_t>(value); changed = 1; } break;
|
|
888
|
+
#endif
|
|
889
|
+
#if GEA_CSS_TRANSFORMS
|
|
444
890
|
case Property::Backface: if (n->style.backface_hidden != static_cast<int8_t>(value)) { n->style.backface_hidden = static_cast<int8_t>(value); changed = 1; } break;
|
|
891
|
+
#endif
|
|
892
|
+
#if GEA_CSS_POINTER_EVENTS
|
|
445
893
|
case Property::PointerEvents: if (n->style.pointer_events != static_cast<int8_t>(value)) { n->style.pointer_events = static_cast<int8_t>(value); changed = 1; } break;
|
|
894
|
+
#endif
|
|
895
|
+
#if GEA_CSS_OVERFLOW_AXES
|
|
446
896
|
case Property::Overflow: {
|
|
447
897
|
const int8_t next = static_cast<int8_t>(value);
|
|
448
898
|
if (n->style.overflow != next || n->style.overflow_x != next || n->style.overflow_y != next) {
|
|
@@ -473,6 +923,16 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
473
923
|
}
|
|
474
924
|
break;
|
|
475
925
|
}
|
|
926
|
+
#else
|
|
927
|
+
case Property::Overflow:
|
|
928
|
+
case Property::OverflowX:
|
|
929
|
+
case Property::OverflowY: {
|
|
930
|
+
const int8_t next = static_cast<int8_t>(value);
|
|
931
|
+
if (n->style.overflow != next) { n->style.overflow = next; changed = 1; }
|
|
932
|
+
break;
|
|
933
|
+
}
|
|
934
|
+
#endif
|
|
935
|
+
#if GEA_CSS_MASK
|
|
476
936
|
case Property::MaskRightFadeWidth: {
|
|
477
937
|
const int16_t next = static_cast<int16_t>(value < 0 ? 0 : value > 32767 ? 32767 : value);
|
|
478
938
|
if (n->style.mask_right_fade_width != next) {
|
|
@@ -481,8 +941,36 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
481
941
|
}
|
|
482
942
|
break;
|
|
483
943
|
}
|
|
944
|
+
#endif
|
|
945
|
+
#if GEA_UI_IMAGE_NODES
|
|
484
946
|
case Property::ImageId: if (n->image_id != value) { n->image_id = value; changed = 1; } break;
|
|
947
|
+
#endif
|
|
948
|
+
#if GEA_CSS_IMAGE_FIT
|
|
485
949
|
case Property::ImageFit: if (n->style.image_fit != value) { n->style.image_fit = value; changed = 1; } break;
|
|
950
|
+
#endif
|
|
951
|
+
#if GEA_CSS_TRANSFORMS
|
|
952
|
+
case Property::TransformTranslateOuterAxes: if (rstyle(n->style).transform_translate_outer_axes != value) { rstyleMut(n->style).transform_translate_outer_axes = value; changed = 1; } break;
|
|
953
|
+
case Property::RotateAngle: if (rstyle(n->style).rotate_angle != value) { rstyleMut(n->style).rotate_angle = value; changed = 1; } break;
|
|
954
|
+
case Property::RotateAxisX: if (rstyle(n->style).rotate_axis_x != value) { rstyleMut(n->style).rotate_axis_x = value; changed = 1; } break;
|
|
955
|
+
case Property::RotateAxisY: if (rstyle(n->style).rotate_axis_y != value) { rstyleMut(n->style).rotate_axis_y = value; changed = 1; } break;
|
|
956
|
+
case Property::RotateAxisZ: if (rstyle(n->style).rotate_axis_z != value) { rstyleMut(n->style).rotate_axis_z = value; changed = 1; } break;
|
|
957
|
+
case Property::ScaleX: if (rstyle(n->style).scale_x != value) { rstyleMut(n->style).scale_x = value; changed = 1; } break;
|
|
958
|
+
case Property::ScaleY: if (rstyle(n->style).scale_y != value) { rstyleMut(n->style).scale_y = value; changed = 1; } break;
|
|
959
|
+
case Property::ScaleZ: if (rstyle(n->style).scale_z != value) { rstyleMut(n->style).scale_z = value; changed = 1; } break;
|
|
960
|
+
case Property::TranslatePresent: if (rstyle(n->style).translate_present != (value != 0)) { rstyleMut(n->style).translate_present = value != 0; changed = 1; } break;
|
|
961
|
+
case Property::TranslateX: if (rstyle(n->style).translate_x != value) { rstyleMut(n->style).translate_x = value; changed = 1; } break;
|
|
962
|
+
case Property::TranslateY: if (rstyle(n->style).translate_y != value) { rstyleMut(n->style).translate_y = value; changed = 1; } break;
|
|
963
|
+
case Property::TranslateZ: if (rstyle(n->style).translate_z != value) { rstyleMut(n->style).translate_z = value; changed = 1; } break;
|
|
964
|
+
case Property::TranslateXPercent: if (rstyle(n->style).translate_x_percent != value) { rstyleMut(n->style).translate_x_percent = value; changed = 1; } break;
|
|
965
|
+
case Property::TranslateYPercent: if (rstyle(n->style).translate_y_percent != value) { rstyleMut(n->style).translate_y_percent = value; changed = 1; } break;
|
|
966
|
+
case Property::TransformPresent: if (rstyle(n->style).transform_present != (value != 0)) { rstyleMut(n->style).transform_present = value != 0; changed = 1; } break;
|
|
967
|
+
case Property::RotatePresent: if (rstyle(n->style).rotate_present != (value != 0)) { rstyleMut(n->style).rotate_present = value != 0; changed = 1; } break;
|
|
968
|
+
case Property::ScalePresent: if (rstyle(n->style).scale_present != (value != 0)) { rstyleMut(n->style).scale_present = value != 0; changed = 1; } break;
|
|
969
|
+
#endif
|
|
970
|
+
#if GEA_CSS_FILTERS
|
|
971
|
+
case Property::FilterPresent: if (rstyle(n->style).filter_present != (value != 0)) { rstyleMut(n->style).filter_present = value != 0; changed = 1; } break;
|
|
972
|
+
#endif
|
|
973
|
+
#if GEA_CSS_TRANSFORMS
|
|
486
974
|
case Property::TransformRotate:
|
|
487
975
|
if (rstyle(n->style).transform_rotate != value) {
|
|
488
976
|
rstyleMut(n->style).transform_rotate = value;
|
|
@@ -498,31 +986,49 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
498
986
|
case Property::TransformTranslateYPercent: if (rstyle(n->style).transform_translate_y_percent != value) { rstyleMut(n->style).transform_translate_y_percent = value; changed = 1; } break;
|
|
499
987
|
case Property::TransformScaleX: if (rstyle(n->style).transform_scale_x != value) { rstyleMut(n->style).transform_scale_x = value; changed = 1; } break;
|
|
500
988
|
case Property::TransformScaleY: if (rstyle(n->style).transform_scale_y != value) { rstyleMut(n->style).transform_scale_y = value; changed = 1; } break;
|
|
989
|
+
case Property::TransformScaleZ: if (rstyle(n->style).transform_scale_z != value) { rstyleMut(n->style).transform_scale_z = value; changed = 1; } break;
|
|
501
990
|
case Property::TransformOriginX: if (rstyle(n->style).transform_origin_x != value) { rstyleMut(n->style).transform_origin_x = value; changed = 1; } break;
|
|
502
991
|
case Property::TransformOriginY: if (rstyle(n->style).transform_origin_y != value) { rstyleMut(n->style).transform_origin_y = value; changed = 1; } break;
|
|
503
992
|
case Property::Perspective: if (rstyle(n->style).perspective != value) { rstyleMut(n->style).perspective = value; changed = 1; } break;
|
|
504
993
|
case Property::PerspectiveOriginX: if (rstyle(n->style).perspective_origin_x != value) { rstyleMut(n->style).perspective_origin_x = value; changed = 1; } break;
|
|
505
994
|
case Property::PerspectiveOriginY: if (rstyle(n->style).perspective_origin_y != value) { rstyleMut(n->style).perspective_origin_y = value; changed = 1; } break;
|
|
995
|
+
#endif
|
|
996
|
+
#if GEA_CSS_FILTERS
|
|
506
997
|
case Property::FilterBlur: if (rstyle(n->style).filter_blur_radius != value) { rstyleMut(n->style).filter_blur_radius = value; changed = 1; } break;
|
|
998
|
+
#endif
|
|
999
|
+
#if GEA_CSS_BOX_SHADOW
|
|
507
1000
|
case Property::BoxShadowInset: {
|
|
508
1001
|
const uint8_t next = value != 0 ? 1 : 0;
|
|
509
1002
|
if (rstyle(n->style).box_shadow_inset != next) { rstyleMut(n->style).box_shadow_inset = next; changed = 1; }
|
|
510
1003
|
break;
|
|
511
1004
|
}
|
|
1005
|
+
#endif
|
|
1006
|
+
#if GEA_CSS_BOX_SHADOW
|
|
512
1007
|
case Property::BoxShadowOffsetX: if (rstyle(n->style).box_shadow_offset_x != value) { rstyleMut(n->style).box_shadow_offset_x = value; changed = 1; } break;
|
|
1008
|
+
#endif
|
|
1009
|
+
#if GEA_CSS_BOX_SHADOW
|
|
513
1010
|
case Property::BoxShadowOffsetY: if (rstyle(n->style).box_shadow_offset_y != value) { rstyleMut(n->style).box_shadow_offset_y = value; changed = 1; } break;
|
|
1011
|
+
#endif
|
|
1012
|
+
#if GEA_CSS_BOX_SHADOW
|
|
514
1013
|
case Property::BoxShadowBlur: if (rstyle(n->style).box_shadow_blur_radius != value) { rstyleMut(n->style).box_shadow_blur_radius = value; changed = 1; } break;
|
|
1014
|
+
#endif
|
|
1015
|
+
#if GEA_CSS_BOX_SHADOW
|
|
515
1016
|
case Property::BoxShadowSpread: if (rstyle(n->style).box_shadow_spread != value) { rstyleMut(n->style).box_shadow_spread = value; changed = 1; } break;
|
|
1017
|
+
#endif
|
|
1018
|
+
#if GEA_CSS_BOX_SHADOW
|
|
516
1019
|
case Property::BoxShadowColor: {
|
|
517
1020
|
const style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
518
1021
|
if (rstyle(n->style).box_shadow_color != next) { rstyleMut(n->style).box_shadow_color = next; changed = 1; }
|
|
519
1022
|
break;
|
|
520
1023
|
}
|
|
1024
|
+
#endif
|
|
1025
|
+
#if GEA_CSS_BOX_SHADOW
|
|
521
1026
|
case Property::BoxShadowAlpha: {
|
|
522
1027
|
const uint8_t next = static_cast<uint8_t>(value < 0 ? 0 : value > 255 ? 255 : value);
|
|
523
1028
|
if (rstyle(n->style).box_shadow_alpha != next) { rstyleMut(n->style).box_shadow_alpha = next; changed = 1; }
|
|
524
1029
|
break;
|
|
525
1030
|
}
|
|
1031
|
+
#endif
|
|
526
1032
|
default:
|
|
527
1033
|
perf.treeSetStyleNoop++;
|
|
528
1034
|
return;
|
|
@@ -532,7 +1038,7 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
532
1038
|
return;
|
|
533
1039
|
}
|
|
534
1040
|
perf.treeSetStyleChanged++;
|
|
535
|
-
if (isLayoutProperty(prop))
|
|
1041
|
+
if (isLayoutProperty(prop) || (isTransformProperty(prop) && state.fixedPositionUsed))
|
|
536
1042
|
perf.treeSetStyleLayoutChanged++;
|
|
537
1043
|
if (isTransformProperty(prop))
|
|
538
1044
|
perf.treeSetStyleTransformChanged++;
|
|
@@ -540,6 +1046,16 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
540
1046
|
perf.treeSetStylePaintChanged++;
|
|
541
1047
|
if (state.styleInvalidationSuppressionDepth > 0) return;
|
|
542
1048
|
if (!nodeParticipatesInMountedTree(state, node)) return;
|
|
1049
|
+
const bool hadRecolor = n->render.bg_recolor_pending;
|
|
1050
|
+
const bool canRecolor = !n->render.dirty || hadRecolor;
|
|
1051
|
+
n->render.text_partial_dirty = 0;
|
|
1052
|
+
n->render.bg_recolor_pending = 0;
|
|
1053
|
+
if (prop == Property::Visibility || prop == Property::Backface || prop == Property::TransformStyle)
|
|
1054
|
+
tree.markDisplayListDirty();
|
|
1055
|
+
const int documentRoot = state.mountedRoot;
|
|
1056
|
+
if (documentRoot >= 0 && documentRoot < state.nodeCount && isDocumentCanvasRoot(state.nodes[documentRoot]) &&
|
|
1057
|
+
(node == documentRoot || (n->parent == documentRoot && std::string_view(tagFromId(n->tag_id)) == "body")))
|
|
1058
|
+
tree.markDisplayListDirty();
|
|
543
1059
|
// An ImageId (src) swap on an element with a FIXED CSS display box (explicit
|
|
544
1060
|
// width+height — e.g. a forecast row's 24x20 icon re-pointed at a different icon
|
|
545
1061
|
// every data refresh) is PAINT-ONLY: the layout box is the styled box regardless
|
|
@@ -556,12 +1072,14 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
556
1072
|
(n->style.height != kUnset || n->style.height_percent != kUnset);
|
|
557
1073
|
if (fixedBox) {
|
|
558
1074
|
n->render.dirty = 1;
|
|
1075
|
+
#if GEA_CSS_SCROLLING
|
|
559
1076
|
n->render.non_scroll_dirty = 1;
|
|
1077
|
+
#endif
|
|
560
1078
|
tree.markNodeDisplayCommandsDirty(node);
|
|
561
1079
|
return;
|
|
562
1080
|
}
|
|
563
1081
|
}
|
|
564
|
-
if (prop == Property::BackgroundColor &&
|
|
1082
|
+
if (canRecolor && prop == Property::BackgroundColor &&
|
|
565
1083
|
previousHasBg &&
|
|
566
1084
|
previousBgAlpha == 255 &&
|
|
567
1085
|
previousBgFill == 0 &&
|
|
@@ -577,21 +1095,28 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
577
1095
|
rstyle(n->style).bg_radial_gradient == 0 &&
|
|
578
1096
|
rstyle(n->style).bg_grid_axes == 0 &&
|
|
579
1097
|
previousBgColor != n->style.bg_color) {
|
|
1098
|
+
if (!hadRecolor) n->render.bg_recolor_from = previousBgColor;
|
|
580
1099
|
n->render.bg_recolor_pending = 1;
|
|
581
|
-
n->render.bg_recolor_from = previousBgColor;
|
|
582
|
-
n->render.bg_recolor_to = n->style.bg_color;
|
|
583
1100
|
}
|
|
584
1101
|
n->render.dirty = 1;
|
|
585
1102
|
// Paint-only properties (background, colors, shadows, ...) repaint in
|
|
586
1103
|
// place: geometry is untouched, so they don't demand a relayout pass.
|
|
587
|
-
//
|
|
588
|
-
|
|
1104
|
+
// Keep geometry dirt separate from transform dirt: coalescing both must
|
|
1105
|
+
// not let a retained transform update suppress the required relayout.
|
|
1106
|
+
if (isLayoutProperty(prop) || (isTransformProperty(prop) && state.fixedPositionUsed))
|
|
589
1107
|
n->render.layout_dirty = 1;
|
|
1108
|
+
#if GEA_CSS_SCROLLING
|
|
590
1109
|
n->render.non_scroll_dirty = 1;
|
|
1110
|
+
#endif
|
|
591
1111
|
if (isTransformProperty(prop)) {
|
|
1112
|
+
#if GEA_CSS_TRANSFORMS
|
|
592
1113
|
n->render.transform_dirty = 1;
|
|
1114
|
+
#endif
|
|
1115
|
+
|
|
1116
|
+
#if GEA_CSS_TRANSFORMS
|
|
593
1117
|
state.transformScanSerial = ~0ull;
|
|
594
1118
|
state.transformScanValid = false; // a transform was added/changed → drop durable no-transform cache
|
|
1119
|
+
#endif
|
|
595
1120
|
}
|
|
596
1121
|
if (DisplayInvalidation::rebuildsNodeDisplayCommands(prop)) {
|
|
597
1122
|
const bool stayLocal = DisplayInvalidation::nodeDisplayChangeCanStayLocal(node);
|
|
@@ -683,15 +1208,17 @@ void Tree::resetStyleForClassRecompute(int node)
|
|
|
683
1208
|
auto &state = treeState();
|
|
684
1209
|
if (node < 0 || node >= state.nodeCount) return;
|
|
685
1210
|
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
state.nodes[node].
|
|
689
|
-
|
|
1211
|
+
NodeLifecycle::resetStyle(state.nodes[node].style);
|
|
1212
|
+
#if GEA_UI_IMAGE_NODES
|
|
1213
|
+
state.nodes[node].image_id = -1;
|
|
1214
|
+
#endif
|
|
690
1215
|
if (state.styleInvalidationSuppressionDepth > 0) return;
|
|
691
1216
|
if (!nodeParticipatesInMountedTree(state, node)) return;
|
|
692
1217
|
state.nodes[node].render.dirty = 1;
|
|
693
1218
|
state.nodes[node].render.layout_dirty = 1;
|
|
1219
|
+
#if GEA_CSS_SCROLLING
|
|
694
1220
|
state.nodes[node].render.non_scroll_dirty = 1;
|
|
1221
|
+
#endif
|
|
695
1222
|
markDisplayListDirty();
|
|
696
1223
|
}
|
|
697
1224
|
|