@geastack/engine 0.1.6 → 0.1.8
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 +105 -48
- package/css/declarative.h +6 -0
- package/css/engine.h +20 -0
- package/image_store.cpp +136 -33
- package/package.json +4 -3
- package/ui/CSS_FEATURES.md +261 -0
- package/ui/absolute_leaf_refresh.cpp +77 -62
- package/ui/core.cpp +26 -3
- package/ui/css_atom.cpp +6 -0
- package/ui/css_atom.h +2 -0
- package/ui/css_features.h +369 -0
- package/ui/document.cpp +11 -0
- package/ui/image_node.cpp +25 -24
- package/ui/input.cpp +46 -26
- package/ui/input_render.cpp +31 -27
- package/ui/internal.h +22 -0
- package/ui/layout.cpp +899 -613
- package/ui/layout_snapshot.cpp +29 -2
- package/ui/node_features.h +36 -0
- package/ui/node_lifecycle.cpp +358 -84
- package/ui/node_lifecycle.h +1 -0
- package/ui/node_model.h +816 -96
- package/ui/node_text.h +84 -0
- package/ui/refresh_perf.h +19 -17
- package/ui/render.cpp +341 -259
- package/ui/renderer_features.h +24 -0
- package/ui/root_scroll_refresh.cpp +86 -69
- package/ui/storage_usage.h +45 -0
- package/ui/style.cpp +1398 -349
- package/ui/style_values.h +2 -2
- package/ui/text.cpp +172 -154
- package/ui/tree_events.cpp +218 -92
- package/ui/tree_events.h +44 -20
- package/ui/tree_inspection.h +15 -0
- package/ui/tree_nodes.cpp +51 -19
- package/ui/tree_render.cpp +159 -126
- package/ui/tree_scroll_mirror.cpp +30 -4
- package/ui/tree_state.cpp +334 -115
- package/ui/tree_state.h +118 -22
- package/ui/tree_style.cpp +679 -303
- package/ui/view.cpp +268 -208
- package/ui/virtual_keyboard.cpp +18 -11
package/ui/tree_style.cpp
CHANGED
|
@@ -30,6 +30,7 @@ bool nodeParticipatesInMountedTree(const TreeState &state, int node)
|
|
|
30
30
|
bool isTransformProperty(Property prop)
|
|
31
31
|
{
|
|
32
32
|
switch (prop) {
|
|
33
|
+
#if GEA_CSS_TRANSFORMS
|
|
33
34
|
case Property::RotateAngle:
|
|
34
35
|
case Property::RotateAxisX:
|
|
35
36
|
case Property::RotateAxisY:
|
|
@@ -60,6 +61,7 @@ bool isTransformProperty(Property prop)
|
|
|
60
61
|
case Property::PerspectiveOriginX:
|
|
61
62
|
case Property::PerspectiveOriginY:
|
|
62
63
|
return true;
|
|
64
|
+
#endif
|
|
63
65
|
default:
|
|
64
66
|
return false;
|
|
65
67
|
}
|
|
@@ -70,21 +72,33 @@ bool isLayoutProperty(Property prop)
|
|
|
70
72
|
switch (prop) {
|
|
71
73
|
case Property::FlexLineCount:
|
|
72
74
|
case Property::AspectRatio:
|
|
75
|
+
#if GEA_CSS_TRANSFORMS
|
|
73
76
|
case Property::TranslatePresent:
|
|
74
77
|
case Property::TransformPresent:
|
|
75
78
|
case Property::RotatePresent:
|
|
76
79
|
case Property::ScalePresent:
|
|
80
|
+
#endif
|
|
77
81
|
case Property::FilterPresent:
|
|
78
82
|
case Property::Display:
|
|
79
83
|
case Property::FlexDirection:
|
|
80
84
|
case Property::BoxSizing:
|
|
85
|
+
#if GEA_CSS_FLOATS
|
|
81
86
|
case Property::Float:
|
|
87
|
+
#endif
|
|
82
88
|
case Property::MarginTrim:
|
|
89
|
+
#if GEA_CSS_FLOATS
|
|
83
90
|
case Property::Clear:
|
|
91
|
+
#endif
|
|
92
|
+
#if GEA_CSS_WRITING_MODE
|
|
84
93
|
case Property::WritingMode:
|
|
85
94
|
case Property::Direction:
|
|
95
|
+
#endif
|
|
96
|
+
#if GEA_CSS_AXIS_GAP
|
|
86
97
|
case Property::RowGap:
|
|
98
|
+
#endif
|
|
99
|
+
#if GEA_CSS_AXIS_GAP
|
|
87
100
|
case Property::ColumnGap:
|
|
101
|
+
#endif
|
|
88
102
|
case Property::RowGapPercent:
|
|
89
103
|
case Property::ColumnGapPercent:
|
|
90
104
|
case Property::MarginTopAuto:
|
|
@@ -107,10 +121,12 @@ bool isLayoutProperty(Property prop)
|
|
|
107
121
|
case Property::AlignItems:
|
|
108
122
|
case Property::JustifyItems:
|
|
109
123
|
case Property::JustifySelf:
|
|
124
|
+
#if GEA_CSS_GRID
|
|
110
125
|
case Property::GridRowStart:
|
|
111
126
|
case Property::GridColumnStart:
|
|
112
127
|
case Property::GridRowEnd:
|
|
113
128
|
case Property::GridColumnEnd:
|
|
129
|
+
#endif
|
|
114
130
|
case Property::AlignContent:
|
|
115
131
|
case Property::AlignSelf:
|
|
116
132
|
case Property::Gap:
|
|
@@ -160,7 +176,9 @@ bool isLayoutProperty(Property prop)
|
|
|
160
176
|
case Property::Visibility:
|
|
161
177
|
case Property::WhiteSpace:
|
|
162
178
|
case Property::TextOverflow:
|
|
179
|
+
#if GEA_UI_IMAGE_NODES
|
|
163
180
|
case Property::ImageId:
|
|
181
|
+
#endif
|
|
164
182
|
case Property::ImageFit:
|
|
165
183
|
return true;
|
|
166
184
|
default:
|
|
@@ -193,7 +211,7 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
193
211
|
{
|
|
194
212
|
auto &perf = refreshPerfStatsMutable();
|
|
195
213
|
ScopedRefreshStat timer(perf.treeSetStyleUs);
|
|
196
|
-
perf.treeSetStyleCalls
|
|
214
|
+
GEA_REFRESH_PERF(perf.treeSetStyleCalls++);
|
|
197
215
|
auto &state = treeState();
|
|
198
216
|
if (node < 0 || node >= state.nodeCount) return;
|
|
199
217
|
// Record every authored inline property — including Left/Top — so it survives a
|
|
@@ -241,6 +259,8 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
241
259
|
overrides.remove(static_cast<Property>(static_cast<int>(Property::MarginTopExpression) + static_cast<int>(prop) - static_cast<int>(Property::MarginTop)));
|
|
242
260
|
if (prop >= Property::PaddingTop && prop <= Property::PaddingLeft)
|
|
243
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);
|
|
244
264
|
if (prop == Property::BorderWidth)
|
|
245
265
|
for (Property side : {Property::BorderTopWidth, Property::BorderRightWidth, Property::BorderBottomWidth, Property::BorderLeftWidth}) overrides.remove(side);
|
|
246
266
|
if (prop == Property::BorderRelief)
|
|
@@ -265,6 +285,7 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
265
285
|
overrides.set(prop, value);
|
|
266
286
|
}
|
|
267
287
|
Node *n = &state.nodes[node];
|
|
288
|
+
ComputedStyle &style = n->mutableStyle();
|
|
268
289
|
int changed = 0;
|
|
269
290
|
int prevOpacity = -1;
|
|
270
291
|
// These previous-bg values feed ONLY the BackgroundColor solid-recolor fast path
|
|
@@ -273,254 +294,500 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
273
294
|
// layout/paint writes (e.g. 128 left/top writes per frame in bouncing-balls = ~512
|
|
274
295
|
// wasted pooled reads). Gate them on the property.
|
|
275
296
|
const bool isBgColorChange = (prop == Property::BackgroundColor);
|
|
276
|
-
const style_color_t previousBgColor = isBgColorChange ?
|
|
277
|
-
const uint8_t previousHasBg = isBgColorChange ?
|
|
278
|
-
const uint8_t previousBgAlpha = isBgColorChange ?
|
|
279
|
-
const int8_t previousBgFill = isBgColorChange ?
|
|
280
|
-
const uint8_t previousBgGradientHasMid = isBgColorChange ? rstyle(
|
|
281
|
-
const uint8_t previousBgOverlayGradient = isBgColorChange ? rstyle(
|
|
282
|
-
const uint8_t previousBgRadialGradient = isBgColorChange ? rstyle(
|
|
283
|
-
const uint8_t previousBgGridAxes = isBgColorChange ? rstyle(
|
|
297
|
+
const style_color_t previousBgColor = isBgColorChange ? style.bg_color : style_color_t{};
|
|
298
|
+
const uint8_t previousHasBg = isBgColorChange ? style.has_bg : 0;
|
|
299
|
+
const uint8_t previousBgAlpha = isBgColorChange ? style.bg_alpha : 0;
|
|
300
|
+
const int8_t previousBgFill = isBgColorChange ? style.bg_fill : 0;
|
|
301
|
+
const uint8_t previousBgGradientHasMid = isBgColorChange ? rstyle(style).bg_gradient_has_mid : 0;
|
|
302
|
+
const uint8_t previousBgOverlayGradient = isBgColorChange ? rstyle(style).bg_overlay_gradient : 0;
|
|
303
|
+
const uint8_t previousBgRadialGradient = isBgColorChange ? rstyle(style).bg_radial_gradient : 0;
|
|
304
|
+
const uint8_t previousBgGridAxes = isBgColorChange ? rstyle(style).bg_grid_axes : 0;
|
|
284
305
|
switch (prop) {
|
|
285
306
|
case Property::Display:
|
|
286
307
|
// Any application of the `display` property is explicit authoring — record
|
|
287
308
|
// it so the inline-formatting heuristic treats e.g. `display:block` on a
|
|
288
309
|
// <span> as block-level (stacks) rather than its default inline behaviour.
|
|
289
|
-
|
|
290
|
-
if (
|
|
310
|
+
#if GEA_CSS_DISPLAY_EXPLICIT
|
|
311
|
+
if (!style.display_explicit) { style.display_explicit = 1; changed = 1; }
|
|
312
|
+
#endif
|
|
313
|
+
if (style.display != value) { style.display = value; changed = 1; }
|
|
291
314
|
break;
|
|
315
|
+
#if GEA_CSS_FLEX_DIRECTION
|
|
292
316
|
case Property::FlexDirection:
|
|
293
|
-
if (!
|
|
294
|
-
|
|
295
|
-
changed = 1;
|
|
296
|
-
}
|
|
297
|
-
if (
|
|
298
|
-
|
|
299
|
-
changed = 1;
|
|
300
|
-
}
|
|
301
|
-
break;
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
case Property::
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
case Property::
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
case Property::
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
case Property::
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
case Property::
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
case Property::
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
case Property::
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
case Property::
|
|
326
|
-
case Property::
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
case Property::
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
case Property::
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
case Property::
|
|
336
|
-
case Property::
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
case Property::
|
|
340
|
-
|
|
317
|
+
if (!style.flex_direction_explicit) {
|
|
318
|
+
style.flex_direction_explicit = 1;
|
|
319
|
+
changed = 1;
|
|
320
|
+
}
|
|
321
|
+
if (style.flex_direction != value) {
|
|
322
|
+
style.flex_direction = value;
|
|
323
|
+
changed = 1;
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
#endif
|
|
327
|
+
#if GEA_CSS_BOX_SIZING
|
|
328
|
+
case Property::BoxSizing: if (style.box_sizing != value) { style.box_sizing = value; changed = 1; } break;
|
|
329
|
+
#endif
|
|
330
|
+
#if GEA_CSS_FLOATS
|
|
331
|
+
case Property::Float: if (style.float_side != value) { style.float_side = value; changed = 1; } break;
|
|
332
|
+
#endif
|
|
333
|
+
#if GEA_CSS_ASPECT_RATIO
|
|
334
|
+
case Property::AspectRatio: if ((GEA_CSS_ASPECT_RATIO ? rstyle(style).aspect_ratio : 0) != value) { rstyleMut(style).aspect_ratio = value; changed = 1; } break;
|
|
335
|
+
#endif
|
|
336
|
+
#if GEA_CSS_CONTAINMENT
|
|
337
|
+
case Property::Containment: if ((GEA_CSS_CONTAINMENT ? rstyle(style).containment : 0) != value) { rstyleMut(style).containment = value; changed = 1; } break;
|
|
338
|
+
#endif
|
|
339
|
+
#if GEA_CSS_FLEX_LINE_COUNT
|
|
340
|
+
case Property::FlexLineCount: if ((GEA_CSS_FLEX_LINE_COUNT ? rstyle(style).flex_line_count : 1) != value) { rstyleMut(style).flex_line_count = value; changed = 1; } break;
|
|
341
|
+
#endif
|
|
342
|
+
#if GEA_CSS_MARGIN_TRIM
|
|
343
|
+
case Property::MarginTrim: if ((GEA_CSS_MARGIN_TRIM ? rstyle(style).margin_trim : 0) != value) { rstyleMut(style).margin_trim = value; changed = 1; } break;
|
|
344
|
+
#endif
|
|
345
|
+
#if GEA_CSS_FLOATS
|
|
346
|
+
case Property::Clear: if (style.clear_side != value) { style.clear_side = value; changed = 1; } break;
|
|
347
|
+
#endif
|
|
348
|
+
#if GEA_CSS_WRITING_MODE
|
|
349
|
+
case Property::Direction: if (style.direction != value) { style.direction = value; changed = 1; } break;
|
|
350
|
+
case Property::WritingMode: if (style.writing_mode != value) { style.writing_mode = value; changed = 1; } break;
|
|
351
|
+
#endif
|
|
352
|
+
#if GEA_CSS_AXIS_GAP
|
|
353
|
+
case Property::RowGap: if (style.row_gap != value) { style.row_gap = value; changed = 1; } break;
|
|
354
|
+
#endif
|
|
355
|
+
#if GEA_CSS_AXIS_GAP
|
|
356
|
+
case Property::ColumnGap: if (style.column_gap != value) { style.column_gap = value; changed = 1; } break;
|
|
357
|
+
#endif
|
|
358
|
+
#if GEA_CSS_PERCENT_GAP
|
|
359
|
+
case Property::RowGapPercent: if (style.row_gap_percent != value) { style.row_gap_percent = value; changed = 1; } break;
|
|
360
|
+
case Property::ColumnGapPercent: if (style.column_gap_percent != value) { style.column_gap_percent = value; changed = 1; } break;
|
|
361
|
+
#endif
|
|
362
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
363
|
+
case Property::MarginTopAuto: { const auto mask = (style.margin_auto & ~1) | (value ? 1 : 0); if (mask != style.margin_auto) { style.margin_auto = mask; changed = 1; } break; }
|
|
364
|
+
#endif
|
|
365
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
366
|
+
case Property::MarginRightAuto: { const auto mask = (style.margin_auto & ~2) | (value ? 2 : 0); if (mask != style.margin_auto) { style.margin_auto = mask; changed = 1; } break; }
|
|
367
|
+
#endif
|
|
368
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
369
|
+
case Property::MarginBottomAuto: { const auto mask = (style.margin_auto & ~4) | (value ? 4 : 0); if (mask != style.margin_auto) { style.margin_auto = mask; changed = 1; } break; }
|
|
370
|
+
#endif
|
|
371
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
372
|
+
case Property::MarginLeftAuto: { const auto mask = (style.margin_auto & ~8) | (value ? 8 : 0); if (mask != style.margin_auto) { style.margin_auto = mask; changed = 1; } break; }
|
|
373
|
+
#endif
|
|
374
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
375
|
+
case Property::MarginTopExpression: if (rstyle(style).margin_expression[0] != value) { rstyleMut(style).margin_expression[0] = value; changed = 1; } break;
|
|
376
|
+
#endif
|
|
377
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
378
|
+
case Property::MarginRightExpression: if (rstyle(style).margin_expression[1] != value) { rstyleMut(style).margin_expression[1] = value; changed = 1; } break;
|
|
379
|
+
#endif
|
|
380
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
381
|
+
case Property::MarginBottomExpression: if (rstyle(style).margin_expression[2] != value) { rstyleMut(style).margin_expression[2] = value; changed = 1; } break;
|
|
382
|
+
#endif
|
|
383
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
384
|
+
case Property::MarginLeftExpression: if (rstyle(style).margin_expression[3] != value) { rstyleMut(style).margin_expression[3] = value; changed = 1; } break;
|
|
385
|
+
#endif
|
|
386
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
387
|
+
case Property::PaddingTopExpression: if (rstyle(style).padding_expression[0] != value) { rstyleMut(style).padding_expression[0] = value; changed = 1; } break;
|
|
388
|
+
#endif
|
|
389
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
390
|
+
case Property::PaddingRightExpression: if (rstyle(style).padding_expression[1] != value) { rstyleMut(style).padding_expression[1] = value; changed = 1; } break;
|
|
391
|
+
#endif
|
|
392
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
393
|
+
case Property::PaddingBottomExpression: if (rstyle(style).padding_expression[2] != value) { rstyleMut(style).padding_expression[2] = value; changed = 1; } break;
|
|
394
|
+
#endif
|
|
395
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
396
|
+
case Property::PaddingLeftExpression: if (rstyle(style).padding_expression[3] != value) { rstyleMut(style).padding_expression[3] = value; changed = 1; } break;
|
|
397
|
+
#endif
|
|
398
|
+
#if GEA_CSS_WIDTH_EXPRESSIONS
|
|
399
|
+
case Property::WidthExpression:
|
|
400
|
+
if (style.width_expression != value) {
|
|
401
|
+
style.width_expression = value;
|
|
402
|
+
style.width = kUnset;
|
|
403
|
+
#if GEA_CSS_WIDTH_PERCENT
|
|
404
|
+
style.width_percent = kUnset;
|
|
405
|
+
#endif
|
|
406
|
+
changed = 1;
|
|
407
|
+
}
|
|
408
|
+
break;
|
|
409
|
+
#endif
|
|
410
|
+
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
411
|
+
case Property::HeightExpression:
|
|
412
|
+
if (style.height_expression != value) {
|
|
413
|
+
style.height_expression = value;
|
|
414
|
+
style.height = kUnset;
|
|
415
|
+
#if GEA_CSS_HEIGHT_PERCENT
|
|
416
|
+
style.height_percent = kUnset;
|
|
417
|
+
#endif
|
|
418
|
+
changed = 1;
|
|
419
|
+
}
|
|
420
|
+
break;
|
|
421
|
+
#endif
|
|
422
|
+
#if GEA_CSS_ORDER
|
|
423
|
+
case Property::Order: if (style.order != value) { style.order = value; changed = 1; } break;
|
|
424
|
+
#endif
|
|
425
|
+
#if GEA_CSS_FLEX_WRAP
|
|
426
|
+
case Property::FlexWrap: if (style.flex_wrap != value) { style.flex_wrap = value; changed = 1; } break;
|
|
427
|
+
#endif
|
|
428
|
+
#if GEA_CSS_JUSTIFY_CONTENT
|
|
429
|
+
case Property::JustifyContent: if (style.justify_content != value) { style.justify_content = value; changed = 1; } break;
|
|
430
|
+
#endif
|
|
431
|
+
#if GEA_CSS_ALIGN_ITEMS
|
|
432
|
+
case Property::AlignItems: if (style.align_items != value) { style.align_items = value; changed = 1; } break;
|
|
433
|
+
#endif
|
|
434
|
+
#if GEA_CSS_JUSTIFY_ITEMS
|
|
435
|
+
case Property::JustifyItems: if (style.justify_items != value) { style.justify_items = value; changed = 1; } break;
|
|
436
|
+
#endif
|
|
437
|
+
#if GEA_CSS_ALIGN_CONTENT
|
|
438
|
+
case Property::AlignContent: if (style.align_content != value) { style.align_content = value; changed = 1; } break;
|
|
439
|
+
#endif
|
|
440
|
+
#if GEA_CSS_ALIGN_SELF
|
|
441
|
+
case Property::AlignSelf: if (style.align_self != value) { style.align_self = value; changed = 1; } break;
|
|
442
|
+
#endif
|
|
443
|
+
#if GEA_CSS_JUSTIFY_SELF
|
|
444
|
+
case Property::JustifySelf: if ((GEA_CSS_JUSTIFY_SELF ? rstyle(style).justify_self : -1) != value) { rstyleMut(style).justify_self = value; changed = 1; } break;
|
|
445
|
+
#endif
|
|
446
|
+
#if GEA_CSS_GRID
|
|
447
|
+
case Property::GridRowStart: if (rstyle(style).grid_line[0] != value) { rstyleMut(style).grid_line[0] = value; changed = 1; } break;
|
|
448
|
+
case Property::GridColumnStart: if (rstyle(style).grid_line[1] != value) { rstyleMut(style).grid_line[1] = value; changed = 1; } break;
|
|
449
|
+
case Property::GridRowEnd: if (rstyle(style).grid_line[2] != value) { rstyleMut(style).grid_line[2] = value; changed = 1; } break;
|
|
450
|
+
case Property::GridColumnEnd: if (rstyle(style).grid_line[3] != value) { rstyleMut(style).grid_line[3] = value; changed = 1; } break;
|
|
451
|
+
#endif
|
|
452
|
+
#if GEA_CSS_GAP
|
|
341
453
|
case Property::Gap:
|
|
342
|
-
if (
|
|
343
|
-
|
|
344
|
-
|
|
454
|
+
if (style.gap != value || style.row_gap != kUnset || style.column_gap != kUnset || style.row_gap_percent != kUnset || style.column_gap_percent != kUnset) {
|
|
455
|
+
style.gap = value;
|
|
456
|
+
#if GEA_CSS_AXIS_GAP
|
|
457
|
+
style.row_gap = style.column_gap = kUnset;
|
|
458
|
+
#endif
|
|
459
|
+
#if GEA_CSS_PERCENT_GAP
|
|
460
|
+
style.row_gap_percent = style.column_gap_percent = kUnset;
|
|
461
|
+
#endif
|
|
345
462
|
changed = 1;
|
|
346
463
|
}
|
|
347
464
|
break;
|
|
465
|
+
#endif
|
|
348
466
|
case Property::Width:
|
|
349
|
-
|
|
350
|
-
if (
|
|
351
|
-
|
|
352
|
-
|
|
467
|
+
#if GEA_CSS_WIDTH_EXPRESSIONS
|
|
468
|
+
if (style.width_expression >= 0) { style.width_expression = -1; changed = 1; }
|
|
469
|
+
#endif
|
|
470
|
+
if (style.width != value || style.width_percent != kUnset) {
|
|
471
|
+
style.width = value;
|
|
472
|
+
#if GEA_CSS_WIDTH_PERCENT
|
|
473
|
+
style.width_percent = kUnset;
|
|
474
|
+
#endif
|
|
353
475
|
changed = 1;
|
|
354
476
|
}
|
|
355
477
|
break;
|
|
356
478
|
case Property::Height:
|
|
357
|
-
|
|
358
|
-
if (
|
|
359
|
-
|
|
360
|
-
|
|
479
|
+
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
480
|
+
if (style.height_expression != -1) { style.height_expression = -1; changed = 1; }
|
|
481
|
+
#endif
|
|
482
|
+
if (style.height != value || style.height_percent != kUnset) {
|
|
483
|
+
style.height = value;
|
|
484
|
+
#if GEA_CSS_HEIGHT_PERCENT
|
|
485
|
+
style.height_percent = kUnset;
|
|
486
|
+
#endif
|
|
361
487
|
changed = 1;
|
|
362
488
|
}
|
|
363
489
|
break;
|
|
364
490
|
case Property::WidthPercent:
|
|
365
|
-
|
|
366
|
-
if (
|
|
367
|
-
|
|
368
|
-
|
|
491
|
+
#if GEA_CSS_WIDTH_EXPRESSIONS
|
|
492
|
+
if (style.width_expression >= 0) { style.width_expression = -1; changed = 1; }
|
|
493
|
+
#endif
|
|
494
|
+
if (style.width_percent != value || style.width != kUnset) {
|
|
495
|
+
#if GEA_CSS_WIDTH_PERCENT
|
|
496
|
+
style.width_percent = value;
|
|
497
|
+
#endif
|
|
498
|
+
style.width = kUnset;
|
|
369
499
|
changed = 1;
|
|
370
500
|
}
|
|
371
501
|
break;
|
|
372
502
|
case Property::HeightPercent:
|
|
373
|
-
|
|
374
|
-
if (
|
|
375
|
-
|
|
376
|
-
|
|
503
|
+
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
504
|
+
if (style.height_expression != -1) { style.height_expression = -1; changed = 1; }
|
|
505
|
+
#endif
|
|
506
|
+
if (style.height_percent != value || style.height != kUnset) {
|
|
507
|
+
#if GEA_CSS_HEIGHT_PERCENT
|
|
508
|
+
style.height_percent = value;
|
|
509
|
+
#endif
|
|
510
|
+
style.height = kUnset;
|
|
377
511
|
changed = 1;
|
|
378
512
|
}
|
|
379
513
|
break;
|
|
380
|
-
|
|
381
|
-
case Property::
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
case Property::
|
|
385
|
-
|
|
514
|
+
#if GEA_CSS_MIN_WIDTH
|
|
515
|
+
case Property::MinWidth: if (style.min_width != value) { style.min_width = value; changed = 1; } break;
|
|
516
|
+
#endif
|
|
517
|
+
#if GEA_CSS_MIN_HEIGHT
|
|
518
|
+
case Property::MinHeight: if (style.min_height != value) { style.min_height = value; changed = 1; } break;
|
|
519
|
+
#endif
|
|
520
|
+
#if GEA_CSS_MAX_WIDTH
|
|
521
|
+
case Property::MaxWidth: if (style.max_width != value) { style.max_width = value; changed = 1; } break;
|
|
522
|
+
#endif
|
|
523
|
+
#if GEA_CSS_MAX_HEIGHT
|
|
524
|
+
case Property::MaxHeight: if (style.max_height != value) { style.max_height = value; changed = 1; } break;
|
|
525
|
+
#endif
|
|
526
|
+
#if GEA_CSS_FLEX_FACTORS
|
|
527
|
+
case Property::Flex: if (style.flex != value) { style.flex = value; changed = 1; } break;
|
|
528
|
+
case Property::FlexShrink: if (style.flex_shrink != value) { style.flex_shrink = value; changed = 1; } break;
|
|
529
|
+
#endif
|
|
386
530
|
case Property::FlexBasis:
|
|
387
|
-
|
|
388
|
-
if (
|
|
531
|
+
#if GEA_CSS_FLEX_BASIS_EXPRESSIONS
|
|
532
|
+
if (rstyle(style).flex_basis_expression >= 0) { rstyleMut(style).flex_basis_expression = -1; changed = 1; }
|
|
533
|
+
#endif
|
|
534
|
+
#if GEA_CSS_FLEX_BASIS
|
|
535
|
+
if (style.flex_basis != value) { style.flex_basis = value; changed = 1; }
|
|
536
|
+
#endif
|
|
537
|
+
break;
|
|
538
|
+
#if GEA_CSS_FLEX_BASIS_EXPRESSIONS
|
|
389
539
|
case Property::FlexBasisExpression:
|
|
390
|
-
if (rstyle(
|
|
391
|
-
rstyleMut(
|
|
540
|
+
if (rstyle(style).flex_basis_expression != value || style.flex_basis != kUnset) {
|
|
541
|
+
rstyleMut(style).flex_basis_expression = value;
|
|
542
|
+
#if GEA_CSS_FLEX_BASIS
|
|
543
|
+
style.flex_basis = kUnset;
|
|
544
|
+
#endif
|
|
545
|
+
changed = 1;
|
|
546
|
+
}
|
|
547
|
+
break;
|
|
548
|
+
#endif
|
|
549
|
+
#if GEA_CSS_PADDING
|
|
550
|
+
case Property::PaddingTop:
|
|
551
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
552
|
+
if (rstyle(style).padding_expression[0] >= 0) { rstyleMut(style).padding_expression[0] = -1; changed = 1; }
|
|
553
|
+
#endif
|
|
554
|
+
if (style.padding[0] != value) { style.padding[0] = value; changed = 1; } break;
|
|
555
|
+
case Property::PaddingRight:
|
|
556
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
557
|
+
if (rstyle(style).padding_expression[1] >= 0) { rstyleMut(style).padding_expression[1] = -1; changed = 1; }
|
|
558
|
+
#endif
|
|
559
|
+
if (style.padding[1] != value) { style.padding[1] = value; changed = 1; } break;
|
|
560
|
+
case Property::PaddingBottom:
|
|
561
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
562
|
+
if (rstyle(style).padding_expression[2] >= 0) { rstyleMut(style).padding_expression[2] = -1; changed = 1; }
|
|
563
|
+
#endif
|
|
564
|
+
if (style.padding[2] != value) { style.padding[2] = value; changed = 1; } break;
|
|
565
|
+
case Property::PaddingLeft:
|
|
566
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
567
|
+
if (rstyle(style).padding_expression[3] >= 0) { rstyleMut(style).padding_expression[3] = -1; changed = 1; }
|
|
568
|
+
#endif
|
|
569
|
+
if (style.padding[3] != value) { style.padding[3] = value; changed = 1; } break;
|
|
570
|
+
#endif
|
|
571
|
+
#if GEA_CSS_MARGINS
|
|
572
|
+
case Property::MarginTop:
|
|
573
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
574
|
+
if (rstyle(style).margin_expression[0] >= 0) { rstyleMut(style).margin_expression[0] = -1; changed = 1; }
|
|
575
|
+
#endif
|
|
576
|
+
if (style.margin[0] != value || (style.margin_auto & 1)) {
|
|
577
|
+
style.margin[0] = value;
|
|
578
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
579
|
+
style.margin_auto &= ~1;
|
|
580
|
+
#endif
|
|
581
|
+
changed = 1;
|
|
392
582
|
} break;
|
|
393
|
-
case Property::
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
583
|
+
case Property::MarginRight:
|
|
584
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
585
|
+
if (rstyle(style).margin_expression[1] >= 0) { rstyleMut(style).margin_expression[1] = -1; changed = 1; }
|
|
586
|
+
#endif
|
|
587
|
+
if (style.margin[1] != value || (style.margin_auto & 2)) {
|
|
588
|
+
style.margin[1] = value;
|
|
589
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
590
|
+
style.margin_auto &= ~2;
|
|
591
|
+
#endif
|
|
592
|
+
changed = 1;
|
|
593
|
+
} break;
|
|
594
|
+
case Property::MarginBottom:
|
|
595
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
596
|
+
if (rstyle(style).margin_expression[2] >= 0) { rstyleMut(style).margin_expression[2] = -1; changed = 1; }
|
|
597
|
+
#endif
|
|
598
|
+
if (style.margin[2] != value || (style.margin_auto & 4)) {
|
|
599
|
+
style.margin[2] = value;
|
|
600
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
601
|
+
style.margin_auto &= ~4;
|
|
602
|
+
#endif
|
|
603
|
+
changed = 1;
|
|
604
|
+
} break;
|
|
605
|
+
case Property::MarginLeft:
|
|
606
|
+
#if GEA_CSS_BOX_EXPRESSIONS
|
|
607
|
+
if (rstyle(style).margin_expression[3] >= 0) { rstyleMut(style).margin_expression[3] = -1; changed = 1; }
|
|
608
|
+
#endif
|
|
609
|
+
if (style.margin[3] != value || (style.margin_auto & 8)) {
|
|
610
|
+
style.margin[3] = value;
|
|
611
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
612
|
+
style.margin_auto &= ~8;
|
|
613
|
+
#endif
|
|
614
|
+
changed = 1;
|
|
615
|
+
} break;
|
|
616
|
+
#endif
|
|
617
|
+
case Property::Position: if (value == kPositionFixed) state.fixedPositionUsed = true; if (style.position != value) { style.position = value; changed = 1; } break;
|
|
402
618
|
case Property::Top:
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
619
|
+
#if GEA_CSS_POSITION_TOP
|
|
620
|
+
if (GEA_CSS_POSITION_PX_0(style) != value || GEA_CSS_POSITION_PERCENT_0(style) != kUnset) {
|
|
621
|
+
GEA_CSS_POSITION_PX_0(style) = value;
|
|
622
|
+
#if GEA_CSS_POSITION_TOP_PERCENT
|
|
623
|
+
GEA_CSS_POSITION_PERCENT_0(style) = kUnset;
|
|
624
|
+
#endif
|
|
406
625
|
changed = 1;
|
|
407
626
|
}
|
|
627
|
+
#endif
|
|
408
628
|
break;
|
|
409
629
|
case Property::Right:
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
630
|
+
#if GEA_CSS_POSITION_RIGHT
|
|
631
|
+
if (GEA_CSS_POSITION_PX_1(style) != value || GEA_CSS_POSITION_PERCENT_1(style) != kUnset) {
|
|
632
|
+
GEA_CSS_POSITION_PX_1(style) = value;
|
|
633
|
+
#if GEA_CSS_POSITION_RIGHT_PERCENT
|
|
634
|
+
GEA_CSS_POSITION_PERCENT_1(style) = kUnset;
|
|
635
|
+
#endif
|
|
413
636
|
changed = 1;
|
|
414
637
|
}
|
|
638
|
+
#endif
|
|
415
639
|
break;
|
|
416
640
|
case Property::Bottom:
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
641
|
+
#if GEA_CSS_POSITION_BOTTOM
|
|
642
|
+
if (GEA_CSS_POSITION_PX_2(style) != value || GEA_CSS_POSITION_PERCENT_2(style) != kUnset) {
|
|
643
|
+
GEA_CSS_POSITION_PX_2(style) = value;
|
|
644
|
+
#if GEA_CSS_POSITION_BOTTOM_PERCENT
|
|
645
|
+
GEA_CSS_POSITION_PERCENT_2(style) = kUnset;
|
|
646
|
+
#endif
|
|
420
647
|
changed = 1;
|
|
421
648
|
}
|
|
649
|
+
#endif
|
|
422
650
|
break;
|
|
423
651
|
case Property::Left:
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
652
|
+
#if GEA_CSS_POSITION_LEFT
|
|
653
|
+
if (GEA_CSS_POSITION_PX_3(style) != value || GEA_CSS_POSITION_PERCENT_3(style) != kUnset) {
|
|
654
|
+
GEA_CSS_POSITION_PX_3(style) = value;
|
|
655
|
+
#if GEA_CSS_POSITION_LEFT_PERCENT
|
|
656
|
+
GEA_CSS_POSITION_PERCENT_3(style) = kUnset;
|
|
657
|
+
#endif
|
|
427
658
|
changed = 1;
|
|
428
659
|
}
|
|
660
|
+
#endif
|
|
429
661
|
break;
|
|
430
662
|
case Property::TopPercent:
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
663
|
+
#if GEA_CSS_POSITION_TOP_PERCENT
|
|
664
|
+
if (GEA_CSS_POSITION_PERCENT_0(style) != value || GEA_CSS_POSITION_PX_0(style) != kUnset) {
|
|
665
|
+
GEA_CSS_POSITION_PERCENT_0(style) = value;
|
|
666
|
+
#if GEA_CSS_POSITION_TOP
|
|
667
|
+
GEA_CSS_POSITION_PX_0(style) = kUnset;
|
|
668
|
+
#endif
|
|
434
669
|
changed = 1;
|
|
435
670
|
}
|
|
671
|
+
#endif
|
|
436
672
|
break;
|
|
437
673
|
case Property::RightPercent:
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
674
|
+
#if GEA_CSS_POSITION_RIGHT_PERCENT
|
|
675
|
+
if (GEA_CSS_POSITION_PERCENT_1(style) != value || GEA_CSS_POSITION_PX_1(style) != kUnset) {
|
|
676
|
+
GEA_CSS_POSITION_PERCENT_1(style) = value;
|
|
677
|
+
#if GEA_CSS_POSITION_RIGHT
|
|
678
|
+
GEA_CSS_POSITION_PX_1(style) = kUnset;
|
|
679
|
+
#endif
|
|
441
680
|
changed = 1;
|
|
442
681
|
}
|
|
682
|
+
#endif
|
|
443
683
|
break;
|
|
444
684
|
case Property::BottomPercent:
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
685
|
+
#if GEA_CSS_POSITION_BOTTOM_PERCENT
|
|
686
|
+
if (GEA_CSS_POSITION_PERCENT_2(style) != value || GEA_CSS_POSITION_PX_2(style) != kUnset) {
|
|
687
|
+
GEA_CSS_POSITION_PERCENT_2(style) = value;
|
|
688
|
+
#if GEA_CSS_POSITION_BOTTOM
|
|
689
|
+
GEA_CSS_POSITION_PX_2(style) = kUnset;
|
|
690
|
+
#endif
|
|
448
691
|
changed = 1;
|
|
449
692
|
}
|
|
693
|
+
#endif
|
|
450
694
|
break;
|
|
451
695
|
case Property::LeftPercent:
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
696
|
+
#if GEA_CSS_POSITION_LEFT_PERCENT
|
|
697
|
+
if (GEA_CSS_POSITION_PERCENT_3(style) != value || GEA_CSS_POSITION_PX_3(style) != kUnset) {
|
|
698
|
+
GEA_CSS_POSITION_PERCENT_3(style) = value;
|
|
699
|
+
#if GEA_CSS_POSITION_LEFT
|
|
700
|
+
GEA_CSS_POSITION_PX_3(style) = kUnset;
|
|
701
|
+
#endif
|
|
455
702
|
changed = 1;
|
|
456
703
|
}
|
|
704
|
+
#endif
|
|
457
705
|
break;
|
|
706
|
+
#if GEA_CSS_Z_INDEX
|
|
458
707
|
case Property::ZIndex: {
|
|
459
708
|
const bool automatic = value == kZIndexAuto;
|
|
460
709
|
const int level = automatic ? 0 : std::clamp(value, -32768, 32767);
|
|
461
|
-
if (
|
|
462
|
-
|
|
710
|
+
if (style.z_index != level || style.z_index_auto != automatic) {
|
|
711
|
+
style.z_index = level; style.z_index_auto = automatic; changed = 1;
|
|
463
712
|
}
|
|
464
713
|
break;
|
|
465
714
|
}
|
|
715
|
+
#endif
|
|
466
716
|
case Property::BackgroundColor: {
|
|
467
717
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
468
|
-
if (
|
|
469
|
-
if (
|
|
718
|
+
if (style.bg_color != next) { style.bg_color = next; changed = 1; }
|
|
719
|
+
if (style.bg_alpha != 255) { style.bg_alpha = 255; changed = 1; }
|
|
470
720
|
break;
|
|
471
721
|
}
|
|
472
722
|
case Property::BackgroundAlpha: {
|
|
473
723
|
const uint8_t alpha = static_cast<uint8_t>(std::clamp(value, 0, 255));
|
|
474
|
-
if (
|
|
724
|
+
if (style.bg_alpha != alpha) { style.bg_alpha = alpha; changed = 1; }
|
|
475
725
|
break;
|
|
476
726
|
}
|
|
477
|
-
|
|
478
|
-
case Property::
|
|
479
|
-
case Property::
|
|
480
|
-
case Property::
|
|
481
|
-
case Property::
|
|
482
|
-
case Property::
|
|
727
|
+
#if GEA_CSS_BACKGROUND_LAYERS
|
|
728
|
+
case Property::BackgroundClip: if (rstyle(style).bg_clip != value) { rstyleMut(style).bg_clip = value; changed = 1; } break;
|
|
729
|
+
case Property::BackgroundSizeList: if (rstyle(style).bg_size_list != value) { rstyleMut(style).bg_size_list = value; changed = 1; } break;
|
|
730
|
+
case Property::BackgroundPositionList: if (rstyle(style).bg_position_list != value) { rstyleMut(style).bg_position_list = value; changed = 1; } break;
|
|
731
|
+
case Property::BackgroundRepeatList: if (rstyle(style).bg_repeat_list != value) { rstyleMut(style).bg_repeat_list = value; changed = 1; } break;
|
|
732
|
+
case Property::BackgroundAttachmentList: if (rstyle(style).bg_attachment_list != value) { rstyleMut(style).bg_attachment_list = value; changed = 1; } break;
|
|
733
|
+
case Property::BackgroundOriginList: if (rstyle(style).bg_origin_list != value) { rstyleMut(style).bg_origin_list = value; changed = 1; } break;
|
|
483
734
|
|
|
735
|
+
#endif
|
|
484
736
|
case Property::BackgroundImage:
|
|
485
|
-
changed = StyleValues::applyBackgroundImage(
|
|
737
|
+
changed = StyleValues::applyBackgroundImage(style, value, node);
|
|
486
738
|
break;
|
|
487
|
-
case Property::HasBackground: if (
|
|
739
|
+
case Property::HasBackground: if (style.has_bg != value) { style.has_bg = value; changed = 1; } break;
|
|
740
|
+
#if GEA_CSS_ACTIVE_BACKGROUND
|
|
488
741
|
case Property::ActiveBackgroundColor: {
|
|
489
742
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
490
|
-
if (
|
|
743
|
+
if (style.active_bg_color != next) { style.active_bg_color = next; changed = 1; }
|
|
491
744
|
break;
|
|
492
745
|
}
|
|
493
|
-
|
|
746
|
+
#endif
|
|
747
|
+
#if GEA_CSS_ACTIVE_BACKGROUND
|
|
748
|
+
case Property::HasActiveBackground: if (style.has_active_bg != value) { style.has_active_bg = value; changed = 1; } break;
|
|
749
|
+
#endif
|
|
494
750
|
case Property::Color: {
|
|
495
751
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
496
|
-
if (
|
|
497
|
-
|
|
752
|
+
if (style.text_color != next) { style.text_color = next; changed = 1; }
|
|
753
|
+
#if GEA_CSS_TEXT_ALPHA
|
|
754
|
+
if (style.text_alpha != 255) { style.text_alpha = 255; changed = 1; }
|
|
755
|
+
#endif
|
|
498
756
|
break;
|
|
499
757
|
}
|
|
758
|
+
#if GEA_CSS_OPACITY
|
|
500
759
|
case Property::Opacity: {
|
|
501
760
|
uint8_t next = (uint8_t)value;
|
|
502
|
-
if (
|
|
761
|
+
if (style.opacity != next) { prevOpacity = style.opacity; style.opacity = next; changed = 1; }
|
|
503
762
|
break;
|
|
504
763
|
}
|
|
764
|
+
#endif
|
|
765
|
+
#if GEA_CSS_BLINK
|
|
505
766
|
case Property::BlinkInterval:
|
|
506
767
|
value = value > 0 ? value : 0;
|
|
507
|
-
if (
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
768
|
+
if (style.blink_interval_ms != value) {
|
|
769
|
+
style.blink_interval_ms = value;
|
|
770
|
+
style.blink_started_ms = state.lastFrameMs;
|
|
771
|
+
style.blink_visible = 1;
|
|
511
772
|
changed = 1;
|
|
512
773
|
}
|
|
513
774
|
break;
|
|
775
|
+
#endif
|
|
514
776
|
case Property::ColorAlpha: {
|
|
777
|
+
#if GEA_CSS_TEXT_ALPHA
|
|
515
778
|
const uint8_t alpha = static_cast<uint8_t>(std::clamp(value, 0, 255));
|
|
516
|
-
if (
|
|
779
|
+
if (style.text_alpha != alpha) { style.text_alpha = alpha; changed = 1; }
|
|
780
|
+
#endif
|
|
517
781
|
break;
|
|
518
782
|
}
|
|
519
783
|
case Property::BorderAlpha: {
|
|
784
|
+
#if GEA_CSS_BORDER_ALPHA
|
|
520
785
|
const uint8_t alpha = static_cast<uint8_t>(std::clamp(value, 0, 255));
|
|
521
|
-
if (
|
|
786
|
+
if (style.border_alpha != alpha) { style.border_alpha = alpha; changed = 1; }
|
|
787
|
+
#endif
|
|
522
788
|
break;
|
|
523
789
|
}
|
|
790
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
524
791
|
case Property::BorderTopAlpha:
|
|
525
792
|
case Property::BorderRightAlpha:
|
|
526
793
|
case Property::BorderBottomAlpha:
|
|
@@ -528,25 +795,35 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
528
795
|
{
|
|
529
796
|
const int side = static_cast<int>(prop) - static_cast<int>(Property::BorderTopAlpha);
|
|
530
797
|
const uint8_t alpha = static_cast<uint8_t>(std::clamp(value, 0, 255));
|
|
531
|
-
if (rstyle(
|
|
798
|
+
if (rstyle(style).border_side_alpha[side] != alpha) { rstyleMut(style).border_side_alpha[side] = alpha; changed = 1; }
|
|
532
799
|
break;
|
|
533
800
|
}
|
|
534
|
-
|
|
801
|
+
#endif
|
|
802
|
+
case Property::BorderColorCurrent: changed |= setBorderColorBinding(style, -1, value != 0); break;
|
|
803
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
535
804
|
case Property::BorderTopColorCurrent:
|
|
536
805
|
case Property::BorderRightColorCurrent:
|
|
537
806
|
case Property::BorderBottomColorCurrent:
|
|
538
807
|
case Property::BorderLeftColorCurrent:
|
|
539
|
-
changed |= setBorderColorBinding(
|
|
808
|
+
changed |= setBorderColorBinding(style, static_cast<int>(prop) - static_cast<int>(Property::BorderTopColorCurrent), value != 0);
|
|
540
809
|
break;
|
|
541
|
-
|
|
810
|
+
#endif
|
|
811
|
+
case Property::BorderWidth: changed |= setComputedBorderWidth(style, -1, value, n->parent >= 0 ? &state.nodes[n->parent].computedStyle() : nullptr); break;
|
|
812
|
+
#if GEA_CSS_BORDER_COLORS
|
|
542
813
|
case Property::BorderColor: {
|
|
543
|
-
changed |= setBorderColorBinding(
|
|
814
|
+
changed |= setBorderColorBinding(style, -1, false);
|
|
544
815
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
545
|
-
if (
|
|
546
|
-
|
|
816
|
+
if (style.border_color != next) { style.border_color = next; changed = 1; }
|
|
817
|
+
#if GEA_CSS_BORDER_ALPHA
|
|
818
|
+
if (style.border_alpha != 255) { style.border_alpha = 255; changed = 1; }
|
|
819
|
+
#endif
|
|
547
820
|
break;
|
|
548
821
|
}
|
|
549
|
-
|
|
822
|
+
#endif
|
|
823
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
824
|
+
case Property::BorderTopWidth: changed |= setComputedBorderWidth(style, 0, value, n->parent >= 0 ? &state.nodes[n->parent].computedStyle() : nullptr); break;
|
|
825
|
+
#endif
|
|
826
|
+
#if GEA_CSS_BORDER_RELIEF
|
|
550
827
|
case Property::BorderRelief:
|
|
551
828
|
case Property::BorderTopRelief:
|
|
552
829
|
case Property::BorderRightRelief:
|
|
@@ -554,245 +831,334 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
554
831
|
case Property::BorderLeftRelief:
|
|
555
832
|
for (int side = 0; side < 4; ++side) {
|
|
556
833
|
if (prop != Property::BorderRelief && side != static_cast<int>(prop) - static_cast<int>(Property::BorderTopRelief)) continue;
|
|
557
|
-
if (rstyle(
|
|
558
|
-
rstyleMut(
|
|
834
|
+
if (rstyle(style).border_relief[side] != value) {
|
|
835
|
+
rstyleMut(style).border_relief[side] = static_cast<uint8_t>(value);
|
|
559
836
|
changed = 1;
|
|
560
837
|
}
|
|
561
838
|
}
|
|
562
839
|
break;
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
case Property::
|
|
840
|
+
#endif
|
|
841
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
842
|
+
case Property::BorderRightWidth: changed |= setComputedBorderWidth(style, 1, value, n->parent >= 0 ? &state.nodes[n->parent].computedStyle() : nullptr); break;
|
|
843
|
+
case Property::BorderBottomWidth: changed |= setComputedBorderWidth(style, 2, value, n->parent >= 0 ? &state.nodes[n->parent].computedStyle() : nullptr); break;
|
|
844
|
+
case Property::BorderLeftWidth: changed |= setComputedBorderWidth(style, 3, value, n->parent >= 0 ? &state.nodes[n->parent].computedStyle() : nullptr); break;
|
|
566
845
|
case Property::BorderTopColor: {
|
|
567
|
-
changed |= setBorderColorBinding(
|
|
846
|
+
changed |= setBorderColorBinding(style, 0, false);
|
|
568
847
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
569
|
-
if (rstyle(
|
|
570
|
-
if (rstyle(
|
|
848
|
+
if (rstyle(style).border_side_color[0] != next) { rstyleMut(style).border_side_color[0] = next; changed = 1; }
|
|
849
|
+
if (rstyle(style).border_side_alpha[0] != 255) { rstyleMut(style).border_side_alpha[0] = 255; changed = 1; }
|
|
571
850
|
break;
|
|
572
851
|
}
|
|
573
852
|
case Property::BorderRightColor: {
|
|
574
|
-
changed |= setBorderColorBinding(
|
|
853
|
+
changed |= setBorderColorBinding(style, 1, false);
|
|
575
854
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
576
|
-
if (rstyle(
|
|
577
|
-
if (rstyle(
|
|
855
|
+
if (rstyle(style).border_side_color[1] != next) { rstyleMut(style).border_side_color[1] = next; changed = 1; }
|
|
856
|
+
if (rstyle(style).border_side_alpha[1] != 255) { rstyleMut(style).border_side_alpha[1] = 255; changed = 1; }
|
|
578
857
|
break;
|
|
579
858
|
}
|
|
580
859
|
case Property::BorderBottomColor: {
|
|
581
|
-
changed |= setBorderColorBinding(
|
|
860
|
+
changed |= setBorderColorBinding(style, 2, false);
|
|
582
861
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
583
|
-
if (rstyle(
|
|
584
|
-
if (rstyle(
|
|
862
|
+
if (rstyle(style).border_side_color[2] != next) { rstyleMut(style).border_side_color[2] = next; changed = 1; }
|
|
863
|
+
if (rstyle(style).border_side_alpha[2] != 255) { rstyleMut(style).border_side_alpha[2] = 255; changed = 1; }
|
|
585
864
|
break;
|
|
586
865
|
}
|
|
587
866
|
case Property::BorderLeftColor: {
|
|
588
|
-
changed |= setBorderColorBinding(
|
|
867
|
+
changed |= setBorderColorBinding(style, 3, false);
|
|
589
868
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
590
|
-
if (rstyle(
|
|
591
|
-
if (rstyle(
|
|
869
|
+
if (rstyle(style).border_side_color[3] != next) { rstyleMut(style).border_side_color[3] = next; changed = 1; }
|
|
870
|
+
if (rstyle(style).border_side_alpha[3] != 255) { rstyleMut(style).border_side_alpha[3] = 255; changed = 1; }
|
|
592
871
|
break;
|
|
593
872
|
}
|
|
873
|
+
#endif
|
|
594
874
|
case Property::BorderRadiusTopLeft:
|
|
595
|
-
if (
|
|
596
|
-
|
|
597
|
-
|
|
875
|
+
if (style.border_radius[GEA_CSS_RADIUS_INDEX(0)] != value || style.border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] != kUnset) {
|
|
876
|
+
style.border_radius[GEA_CSS_RADIUS_INDEX(0)] = value;
|
|
877
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
878
|
+
style.border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] = kUnset;
|
|
879
|
+
#endif
|
|
598
880
|
changed = 1;
|
|
599
881
|
}
|
|
600
882
|
break;
|
|
601
883
|
case Property::BorderRadiusTopRight:
|
|
602
|
-
if (
|
|
603
|
-
|
|
604
|
-
|
|
884
|
+
if (style.border_radius[GEA_CSS_RADIUS_INDEX(1)] != value || style.border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] != kUnset) {
|
|
885
|
+
style.border_radius[GEA_CSS_RADIUS_INDEX(1)] = value;
|
|
886
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
887
|
+
style.border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] = kUnset;
|
|
888
|
+
#endif
|
|
605
889
|
changed = 1;
|
|
606
890
|
}
|
|
607
891
|
break;
|
|
608
892
|
case Property::BorderRadiusBottomRight:
|
|
609
|
-
if (
|
|
610
|
-
|
|
611
|
-
|
|
893
|
+
if (style.border_radius[GEA_CSS_RADIUS_INDEX(2)] != value || style.border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] != kUnset) {
|
|
894
|
+
style.border_radius[GEA_CSS_RADIUS_INDEX(2)] = value;
|
|
895
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
896
|
+
style.border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] = kUnset;
|
|
897
|
+
#endif
|
|
612
898
|
changed = 1;
|
|
613
899
|
}
|
|
614
900
|
break;
|
|
615
901
|
case Property::BorderRadiusBottomLeft:
|
|
616
|
-
if (
|
|
617
|
-
|
|
618
|
-
|
|
902
|
+
if (style.border_radius[GEA_CSS_RADIUS_INDEX(3)] != value || style.border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] != kUnset) {
|
|
903
|
+
style.border_radius[GEA_CSS_RADIUS_INDEX(3)] = value;
|
|
904
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
905
|
+
style.border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] = kUnset;
|
|
906
|
+
#endif
|
|
619
907
|
changed = 1;
|
|
620
908
|
}
|
|
621
909
|
break;
|
|
910
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
622
911
|
case Property::BorderRadiusTopLeftPercent:
|
|
623
|
-
if (
|
|
624
|
-
|
|
625
|
-
|
|
912
|
+
if (style.border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] != value || style.border_radius[GEA_CSS_RADIUS_INDEX(0)] != 0) {
|
|
913
|
+
style.border_radius_percent[GEA_CSS_RADIUS_INDEX(0)] = value;
|
|
914
|
+
style.border_radius[GEA_CSS_RADIUS_INDEX(0)] = 0;
|
|
626
915
|
changed = 1;
|
|
627
916
|
}
|
|
628
917
|
break;
|
|
629
918
|
case Property::BorderRadiusTopRightPercent:
|
|
630
|
-
if (
|
|
631
|
-
|
|
632
|
-
|
|
919
|
+
if (style.border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] != value || style.border_radius[GEA_CSS_RADIUS_INDEX(1)] != 0) {
|
|
920
|
+
style.border_radius_percent[GEA_CSS_RADIUS_INDEX(1)] = value;
|
|
921
|
+
style.border_radius[GEA_CSS_RADIUS_INDEX(1)] = 0;
|
|
633
922
|
changed = 1;
|
|
634
923
|
}
|
|
635
924
|
break;
|
|
636
925
|
case Property::BorderRadiusBottomRightPercent:
|
|
637
|
-
if (
|
|
638
|
-
|
|
639
|
-
|
|
926
|
+
if (style.border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] != value || style.border_radius[GEA_CSS_RADIUS_INDEX(2)] != 0) {
|
|
927
|
+
style.border_radius_percent[GEA_CSS_RADIUS_INDEX(2)] = value;
|
|
928
|
+
style.border_radius[GEA_CSS_RADIUS_INDEX(2)] = 0;
|
|
640
929
|
changed = 1;
|
|
641
930
|
}
|
|
642
931
|
break;
|
|
643
932
|
case Property::BorderRadiusBottomLeftPercent:
|
|
644
|
-
if (
|
|
645
|
-
|
|
646
|
-
|
|
933
|
+
if (style.border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] != value || style.border_radius[GEA_CSS_RADIUS_INDEX(3)] != 0) {
|
|
934
|
+
style.border_radius_percent[GEA_CSS_RADIUS_INDEX(3)] = value;
|
|
935
|
+
style.border_radius[GEA_CSS_RADIUS_INDEX(3)] = 0;
|
|
647
936
|
changed = 1;
|
|
648
937
|
}
|
|
649
938
|
break;
|
|
650
|
-
|
|
651
|
-
case Property::
|
|
652
|
-
case Property::
|
|
939
|
+
#endif
|
|
940
|
+
case Property::FontId: if (style.font_id != value) { style.font_id = value; changed = 1; } break;
|
|
941
|
+
case Property::FontSize: if (style.font_size != value) { style.font_size = value; changed = 1; } break;
|
|
942
|
+
#if GEA_CSS_FONT_WEIGHT
|
|
943
|
+
case Property::FontWeight: if (style.font_weight != value) { style.font_weight = value; changed = 1; } break;
|
|
944
|
+
#endif
|
|
945
|
+
#if GEA_CSS_LINE_HEIGHT
|
|
653
946
|
case Property::LineHeight:
|
|
654
|
-
|
|
655
|
-
if (
|
|
656
|
-
|
|
947
|
+
#if GEA_CSS_LINE_HEIGHT_MULTIPLIER
|
|
948
|
+
if (style.line_height_multiplier >= 0) { style.line_height_multiplier = -1; changed = 1; }
|
|
949
|
+
#endif
|
|
950
|
+
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
951
|
+
if (rstyle(style).line_height_expression >= 0) { rstyleMut(style).line_height_expression = -1; changed = 1; }
|
|
952
|
+
#endif
|
|
953
|
+
if (style.line_height != value) { style.line_height = value; changed = 1; } break;
|
|
954
|
+
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
657
955
|
case Property::LineHeightExpression: {
|
|
658
|
-
|
|
956
|
+
#if GEA_CSS_LINE_HEIGHT_MULTIPLIER
|
|
957
|
+
if (style.line_height_multiplier >= 0) { style.line_height_multiplier = -1; changed = 1; }
|
|
958
|
+
#endif
|
|
659
959
|
const int height = resolveLineHeightExpression(node, value);
|
|
660
|
-
if (rstyle(
|
|
661
|
-
rstyleMut(
|
|
960
|
+
if (rstyle(style).line_height_expression != value || style.line_height != height) {
|
|
961
|
+
rstyleMut(style).line_height_expression = value; style.line_height = height; changed = 1;
|
|
662
962
|
} break;
|
|
663
963
|
}
|
|
964
|
+
#endif
|
|
965
|
+
#if GEA_CSS_LINE_HEIGHT_MULTIPLIER
|
|
664
966
|
case Property::LineHeightMultiplier: {
|
|
665
967
|
const int height = resolveLineHeightMultiplier(node, value);
|
|
666
|
-
|
|
667
|
-
if (
|
|
668
|
-
|
|
968
|
+
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
969
|
+
if (rstyle(style).line_height_expression >= 0) { rstyleMut(style).line_height_expression = -1; changed = 1; }
|
|
970
|
+
#endif
|
|
971
|
+
if (style.line_height_multiplier != value || style.line_height != height) {
|
|
972
|
+
style.line_height_multiplier = value; style.line_height = height; changed = 1;
|
|
669
973
|
} break;
|
|
670
974
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
case Property::
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
case Property::
|
|
678
|
-
|
|
679
|
-
|
|
975
|
+
#endif
|
|
976
|
+
#endif
|
|
977
|
+
#if GEA_CSS_TEXT_ALIGN
|
|
978
|
+
case Property::TextAlign: if (style.text_align != value) { style.text_align = value; changed = 1; } break;
|
|
979
|
+
#endif
|
|
980
|
+
#if GEA_CSS_TEXT_DECORATION
|
|
981
|
+
case Property::TextDecoration: if (style.text_decoration != value) { style.text_decoration = value; changed = 1; } break;
|
|
982
|
+
#endif
|
|
983
|
+
#if GEA_CSS_TEXT_TRANSFORM
|
|
984
|
+
case Property::TextTransform: if (style.text_transform != value) { style.text_transform = value; changed = 1; } break;
|
|
985
|
+
#endif
|
|
986
|
+
#if GEA_CSS_WHITE_SPACE
|
|
987
|
+
case Property::WhiteSpace: if (style.white_space != static_cast<int8_t>(value)) { style.white_space = static_cast<int8_t>(value); changed = 1; } break;
|
|
988
|
+
#endif
|
|
989
|
+
#if GEA_CSS_TEXT_OVERFLOW
|
|
990
|
+
case Property::TextOverflow: if (style.text_overflow != static_cast<int8_t>(value)) { style.text_overflow = static_cast<int8_t>(value); changed = 1; } break;
|
|
991
|
+
#endif
|
|
992
|
+
#if GEA_CSS_TRANSFORMS
|
|
993
|
+
case Property::TransformStyle: if (rstyle(style).transform_preserve_3d != (value != 0)) { rstyleMut(style).transform_preserve_3d = value != 0; changed = 1; } break;
|
|
994
|
+
#endif
|
|
995
|
+
#if GEA_CSS_VISIBILITY
|
|
996
|
+
case Property::Visibility: if (style.visibility != static_cast<int8_t>(value)) { style.visibility = static_cast<int8_t>(value); changed = 1; } break;
|
|
997
|
+
#endif
|
|
998
|
+
#if GEA_CSS_TRANSFORMS
|
|
999
|
+
case Property::Backface: if (style.backface_hidden != static_cast<int8_t>(value)) { style.backface_hidden = static_cast<int8_t>(value); changed = 1; } break;
|
|
1000
|
+
#endif
|
|
1001
|
+
#if GEA_CSS_POINTER_EVENTS
|
|
1002
|
+
case Property::PointerEvents: if (style.pointer_events != static_cast<int8_t>(value)) { style.pointer_events = static_cast<int8_t>(value); changed = 1; } break;
|
|
1003
|
+
#endif
|
|
1004
|
+
#if GEA_CSS_OVERFLOW_AXES
|
|
680
1005
|
case Property::Overflow: {
|
|
681
1006
|
const int8_t next = static_cast<int8_t>(value);
|
|
682
|
-
if (
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
1007
|
+
if (style.overflow != next || style.overflow_x != next || style.overflow_y != next) {
|
|
1008
|
+
style.overflow = next;
|
|
1009
|
+
style.overflow_x = next;
|
|
1010
|
+
style.overflow_y = next;
|
|
686
1011
|
changed = 1;
|
|
687
1012
|
}
|
|
688
1013
|
break;
|
|
689
1014
|
}
|
|
690
1015
|
case Property::OverflowX: {
|
|
691
1016
|
const int8_t next = static_cast<int8_t>(value);
|
|
692
|
-
const int8_t aggregate = aggregateOverflow(next,
|
|
693
|
-
if (
|
|
694
|
-
|
|
695
|
-
|
|
1017
|
+
const int8_t aggregate = aggregateOverflow(next, style.overflow_y);
|
|
1018
|
+
if (style.overflow_x != next || style.overflow != aggregate) {
|
|
1019
|
+
style.overflow_x = next;
|
|
1020
|
+
style.overflow = aggregate;
|
|
696
1021
|
changed = 1;
|
|
697
1022
|
}
|
|
698
1023
|
break;
|
|
699
1024
|
}
|
|
700
1025
|
case Property::OverflowY: {
|
|
701
1026
|
const int8_t next = static_cast<int8_t>(value);
|
|
702
|
-
const int8_t aggregate = aggregateOverflow(
|
|
703
|
-
if (
|
|
704
|
-
|
|
705
|
-
|
|
1027
|
+
const int8_t aggregate = aggregateOverflow(style.overflow_x, next);
|
|
1028
|
+
if (style.overflow_y != next || style.overflow != aggregate) {
|
|
1029
|
+
style.overflow_y = next;
|
|
1030
|
+
style.overflow = aggregate;
|
|
706
1031
|
changed = 1;
|
|
707
1032
|
}
|
|
708
1033
|
break;
|
|
709
1034
|
}
|
|
1035
|
+
#else
|
|
1036
|
+
case Property::Overflow:
|
|
1037
|
+
case Property::OverflowX:
|
|
1038
|
+
case Property::OverflowY: {
|
|
1039
|
+
const int8_t next = static_cast<int8_t>(value);
|
|
1040
|
+
if (style.overflow != next) { style.overflow = next; changed = 1; }
|
|
1041
|
+
break;
|
|
1042
|
+
}
|
|
1043
|
+
#endif
|
|
1044
|
+
#if GEA_CSS_MASK
|
|
710
1045
|
case Property::MaskRightFadeWidth: {
|
|
711
1046
|
const int16_t next = static_cast<int16_t>(value < 0 ? 0 : value > 32767 ? 32767 : value);
|
|
712
|
-
if (
|
|
713
|
-
|
|
1047
|
+
if (style.mask_right_fade_width != next) {
|
|
1048
|
+
style.mask_right_fade_width = next;
|
|
714
1049
|
changed = 1;
|
|
715
1050
|
}
|
|
716
1051
|
break;
|
|
717
1052
|
}
|
|
1053
|
+
#endif
|
|
1054
|
+
#if GEA_UI_IMAGE_NODES
|
|
718
1055
|
case Property::ImageId: if (n->image_id != value) { n->image_id = value; changed = 1; } break;
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
case Property::
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
case Property::
|
|
725
|
-
case Property::
|
|
726
|
-
case Property::
|
|
727
|
-
case Property::
|
|
728
|
-
case Property::
|
|
729
|
-
case Property::
|
|
730
|
-
case Property::
|
|
731
|
-
case Property::
|
|
732
|
-
case Property::
|
|
733
|
-
case Property::
|
|
734
|
-
case Property::
|
|
735
|
-
case Property::
|
|
736
|
-
case Property::
|
|
737
|
-
case Property::
|
|
1056
|
+
#endif
|
|
1057
|
+
#if GEA_CSS_IMAGE_FIT
|
|
1058
|
+
case Property::ImageFit: if (style.image_fit != value) { style.image_fit = value; changed = 1; } break;
|
|
1059
|
+
#endif
|
|
1060
|
+
#if GEA_CSS_TRANSFORMS
|
|
1061
|
+
case Property::TransformTranslateOuterAxes: if (rstyle(style).transform_translate_outer_axes != value) { rstyleMut(style).transform_translate_outer_axes = value; changed = 1; } break;
|
|
1062
|
+
case Property::RotateAngle: if (rstyle(style).rotate_angle != value) { rstyleMut(style).rotate_angle = value; changed = 1; } break;
|
|
1063
|
+
case Property::RotateAxisX: if (rstyle(style).rotate_axis_x != value) { rstyleMut(style).rotate_axis_x = value; changed = 1; } break;
|
|
1064
|
+
case Property::RotateAxisY: if (rstyle(style).rotate_axis_y != value) { rstyleMut(style).rotate_axis_y = value; changed = 1; } break;
|
|
1065
|
+
case Property::RotateAxisZ: if (rstyle(style).rotate_axis_z != value) { rstyleMut(style).rotate_axis_z = value; changed = 1; } break;
|
|
1066
|
+
case Property::ScaleX: if (rstyle(style).scale_x != value) { rstyleMut(style).scale_x = value; changed = 1; } break;
|
|
1067
|
+
case Property::ScaleY: if (rstyle(style).scale_y != value) { rstyleMut(style).scale_y = value; changed = 1; } break;
|
|
1068
|
+
case Property::ScaleZ: if (rstyle(style).scale_z != value) { rstyleMut(style).scale_z = value; changed = 1; } break;
|
|
1069
|
+
case Property::TranslatePresent: if (rstyle(style).translate_present != (value != 0)) { rstyleMut(style).translate_present = value != 0; changed = 1; } break;
|
|
1070
|
+
case Property::TranslateX: if (rstyle(style).translate_x != value) { rstyleMut(style).translate_x = value; changed = 1; } break;
|
|
1071
|
+
case Property::TranslateY: if (rstyle(style).translate_y != value) { rstyleMut(style).translate_y = value; changed = 1; } break;
|
|
1072
|
+
case Property::TranslateZ: if (rstyle(style).translate_z != value) { rstyleMut(style).translate_z = value; changed = 1; } break;
|
|
1073
|
+
case Property::TranslateXPercent: if (rstyle(style).translate_x_percent != value) { rstyleMut(style).translate_x_percent = value; changed = 1; } break;
|
|
1074
|
+
case Property::TranslateYPercent: if (rstyle(style).translate_y_percent != value) { rstyleMut(style).translate_y_percent = value; changed = 1; } break;
|
|
1075
|
+
case Property::TransformPresent: if (rstyle(style).transform_present != (value != 0)) { rstyleMut(style).transform_present = value != 0; changed = 1; } break;
|
|
1076
|
+
case Property::RotatePresent: if (rstyle(style).rotate_present != (value != 0)) { rstyleMut(style).rotate_present = value != 0; changed = 1; } break;
|
|
1077
|
+
case Property::ScalePresent: if (rstyle(style).scale_present != (value != 0)) { rstyleMut(style).scale_present = value != 0; changed = 1; } break;
|
|
1078
|
+
#endif
|
|
1079
|
+
#if GEA_CSS_FILTERS
|
|
1080
|
+
case Property::FilterPresent: if (rstyle(style).filter_present != (value != 0)) { rstyleMut(style).filter_present = value != 0; changed = 1; } break;
|
|
1081
|
+
#endif
|
|
1082
|
+
#if GEA_CSS_TRANSFORMS
|
|
738
1083
|
case Property::TransformRotate:
|
|
739
|
-
if (rstyle(
|
|
740
|
-
rstyleMut(
|
|
741
|
-
changed = 1;
|
|
742
|
-
}
|
|
743
|
-
break;
|
|
744
|
-
case Property::TransformRotateX: if (rstyle(
|
|
745
|
-
case Property::TransformRotateY: if (rstyle(
|
|
746
|
-
case Property::TransformTranslateX: if (rstyle(
|
|
747
|
-
case Property::TransformTranslateY: if (rstyle(
|
|
748
|
-
case Property::TransformTranslateZ: if (rstyle(
|
|
749
|
-
case Property::TransformTranslateXPercent: if (rstyle(
|
|
750
|
-
case Property::TransformTranslateYPercent: if (rstyle(
|
|
751
|
-
case Property::TransformScaleX: if (rstyle(
|
|
752
|
-
case Property::TransformScaleY: if (rstyle(
|
|
753
|
-
case Property::TransformScaleZ: if (rstyle(
|
|
754
|
-
case Property::TransformOriginX: if (rstyle(
|
|
755
|
-
case Property::TransformOriginY: if (rstyle(
|
|
756
|
-
case Property::Perspective: if (rstyle(
|
|
757
|
-
case Property::PerspectiveOriginX: if (rstyle(
|
|
758
|
-
case Property::PerspectiveOriginY: if (rstyle(
|
|
759
|
-
|
|
1084
|
+
if (rstyle(style).transform_rotate != value) {
|
|
1085
|
+
rstyleMut(style).transform_rotate = value;
|
|
1086
|
+
changed = 1;
|
|
1087
|
+
}
|
|
1088
|
+
break;
|
|
1089
|
+
case Property::TransformRotateX: if (rstyle(style).transform_rotate_x != value) { rstyleMut(style).transform_rotate_x = value; changed = 1; } break;
|
|
1090
|
+
case Property::TransformRotateY: if (rstyle(style).transform_rotate_y != value) { rstyleMut(style).transform_rotate_y = value; changed = 1; } break;
|
|
1091
|
+
case Property::TransformTranslateX: if (rstyle(style).transform_translate_x != value) { rstyleMut(style).transform_translate_x = value; changed = 1; } break;
|
|
1092
|
+
case Property::TransformTranslateY: if (rstyle(style).transform_translate_y != value) { rstyleMut(style).transform_translate_y = value; changed = 1; } break;
|
|
1093
|
+
case Property::TransformTranslateZ: if (rstyle(style).transform_translate_z != value) { rstyleMut(style).transform_translate_z = value; changed = 1; } break;
|
|
1094
|
+
case Property::TransformTranslateXPercent: if (rstyle(style).transform_translate_x_percent != value) { rstyleMut(style).transform_translate_x_percent = value; changed = 1; } break;
|
|
1095
|
+
case Property::TransformTranslateYPercent: if (rstyle(style).transform_translate_y_percent != value) { rstyleMut(style).transform_translate_y_percent = value; changed = 1; } break;
|
|
1096
|
+
case Property::TransformScaleX: if (rstyle(style).transform_scale_x != value) { rstyleMut(style).transform_scale_x = value; changed = 1; } break;
|
|
1097
|
+
case Property::TransformScaleY: if (rstyle(style).transform_scale_y != value) { rstyleMut(style).transform_scale_y = value; changed = 1; } break;
|
|
1098
|
+
case Property::TransformScaleZ: if (rstyle(style).transform_scale_z != value) { rstyleMut(style).transform_scale_z = value; changed = 1; } break;
|
|
1099
|
+
case Property::TransformOriginX: if (rstyle(style).transform_origin_x != value) { rstyleMut(style).transform_origin_x = value; changed = 1; } break;
|
|
1100
|
+
case Property::TransformOriginY: if (rstyle(style).transform_origin_y != value) { rstyleMut(style).transform_origin_y = value; changed = 1; } break;
|
|
1101
|
+
case Property::Perspective: if (rstyle(style).perspective != value) { rstyleMut(style).perspective = value; changed = 1; } break;
|
|
1102
|
+
case Property::PerspectiveOriginX: if (rstyle(style).perspective_origin_x != value) { rstyleMut(style).perspective_origin_x = value; changed = 1; } break;
|
|
1103
|
+
case Property::PerspectiveOriginY: if (rstyle(style).perspective_origin_y != value) { rstyleMut(style).perspective_origin_y = value; changed = 1; } break;
|
|
1104
|
+
#endif
|
|
1105
|
+
#if GEA_CSS_FILTERS
|
|
1106
|
+
case Property::FilterBlur: if (rstyle(style).filter_blur_radius != value) { rstyleMut(style).filter_blur_radius = value; changed = 1; } break;
|
|
1107
|
+
#endif
|
|
1108
|
+
#if GEA_CSS_BOX_SHADOW
|
|
760
1109
|
case Property::BoxShadowInset: {
|
|
761
1110
|
const uint8_t next = value != 0 ? 1 : 0;
|
|
762
|
-
if (rstyle(
|
|
1111
|
+
if (rstyle(style).box_shadow_inset != next) { rstyleMut(style).box_shadow_inset = next; changed = 1; }
|
|
763
1112
|
break;
|
|
764
1113
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
case Property::
|
|
768
|
-
|
|
1114
|
+
#endif
|
|
1115
|
+
#if GEA_CSS_BOX_SHADOW
|
|
1116
|
+
case Property::BoxShadowOffsetX: if (rstyle(style).box_shadow_offset_x != value) { rstyleMut(style).box_shadow_offset_x = value; changed = 1; } break;
|
|
1117
|
+
#endif
|
|
1118
|
+
#if GEA_CSS_BOX_SHADOW
|
|
1119
|
+
case Property::BoxShadowOffsetY: if (rstyle(style).box_shadow_offset_y != value) { rstyleMut(style).box_shadow_offset_y = value; changed = 1; } break;
|
|
1120
|
+
#endif
|
|
1121
|
+
#if GEA_CSS_BOX_SHADOW
|
|
1122
|
+
case Property::BoxShadowBlur: if (rstyle(style).box_shadow_blur_radius != value) { rstyleMut(style).box_shadow_blur_radius = value; changed = 1; } break;
|
|
1123
|
+
#endif
|
|
1124
|
+
#if GEA_CSS_BOX_SHADOW
|
|
1125
|
+
case Property::BoxShadowSpread: if (rstyle(style).box_shadow_spread != value) { rstyleMut(style).box_shadow_spread = value; changed = 1; } break;
|
|
1126
|
+
#endif
|
|
1127
|
+
#if GEA_CSS_BOX_SHADOW
|
|
769
1128
|
case Property::BoxShadowColor: {
|
|
770
1129
|
const style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
771
|
-
if (rstyle(
|
|
1130
|
+
if (rstyle(style).box_shadow_color != next) { rstyleMut(style).box_shadow_color = next; changed = 1; }
|
|
772
1131
|
break;
|
|
773
1132
|
}
|
|
1133
|
+
#endif
|
|
1134
|
+
#if GEA_CSS_BOX_SHADOW
|
|
774
1135
|
case Property::BoxShadowAlpha: {
|
|
775
1136
|
const uint8_t next = static_cast<uint8_t>(value < 0 ? 0 : value > 255 ? 255 : value);
|
|
776
|
-
if (rstyle(
|
|
1137
|
+
if (rstyle(style).box_shadow_alpha != next) { rstyleMut(style).box_shadow_alpha = next; changed = 1; }
|
|
777
1138
|
break;
|
|
778
1139
|
}
|
|
1140
|
+
#endif
|
|
779
1141
|
default:
|
|
780
|
-
perf.treeSetStyleNoop
|
|
1142
|
+
GEA_REFRESH_PERF(perf.treeSetStyleNoop++);
|
|
781
1143
|
return;
|
|
782
1144
|
}
|
|
783
1145
|
if (!changed) {
|
|
784
|
-
perf.treeSetStyleNoop
|
|
1146
|
+
GEA_REFRESH_PERF(perf.treeSetStyleNoop++);
|
|
785
1147
|
return;
|
|
786
1148
|
}
|
|
787
|
-
perf.treeSetStyleChanged
|
|
1149
|
+
GEA_REFRESH_PERF(perf.treeSetStyleChanged++);
|
|
788
1150
|
if (isLayoutProperty(prop) || (isTransformProperty(prop) && state.fixedPositionUsed))
|
|
789
|
-
perf.treeSetStyleLayoutChanged
|
|
1151
|
+
GEA_REFRESH_PERF(perf.treeSetStyleLayoutChanged++);
|
|
790
1152
|
if (isTransformProperty(prop))
|
|
791
|
-
perf.treeSetStyleTransformChanged
|
|
1153
|
+
GEA_REFRESH_PERF(perf.treeSetStyleTransformChanged++);
|
|
792
1154
|
else if (isPaintProperty(prop))
|
|
793
|
-
perf.treeSetStylePaintChanged
|
|
1155
|
+
GEA_REFRESH_PERF(perf.treeSetStylePaintChanged++);
|
|
794
1156
|
if (state.styleInvalidationSuppressionDepth > 0) return;
|
|
795
1157
|
if (!nodeParticipatesInMountedTree(state, node)) return;
|
|
1158
|
+
const bool hadRecolor = n->render.bg_recolor_pending;
|
|
1159
|
+
const bool canRecolor = !n->render.dirty || hadRecolor;
|
|
1160
|
+
n->render.text_partial_dirty = 0;
|
|
1161
|
+
n->render.bg_recolor_pending = 0;
|
|
796
1162
|
if (prop == Property::Visibility || prop == Property::Backface || prop == Property::TransformStyle)
|
|
797
1163
|
tree.markDisplayListDirty();
|
|
798
1164
|
const int documentRoot = state.mountedRoot;
|
|
@@ -811,16 +1177,18 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
811
1177
|
// path below, since its intrinsic size can move layout.
|
|
812
1178
|
if (prop == Property::ImageId) {
|
|
813
1179
|
const bool fixedBox =
|
|
814
|
-
(
|
|
815
|
-
(
|
|
1180
|
+
(style.width != kUnset || style.width_percent != kUnset) &&
|
|
1181
|
+
(style.height != kUnset || style.height_percent != kUnset);
|
|
816
1182
|
if (fixedBox) {
|
|
817
1183
|
n->render.dirty = 1;
|
|
1184
|
+
#if GEA_CSS_SCROLLING
|
|
818
1185
|
n->render.non_scroll_dirty = 1;
|
|
1186
|
+
#endif
|
|
819
1187
|
tree.markNodeDisplayCommandsDirty(node);
|
|
820
1188
|
return;
|
|
821
1189
|
}
|
|
822
1190
|
}
|
|
823
|
-
if (prop == Property::BackgroundColor &&
|
|
1191
|
+
if (canRecolor && prop == Property::BackgroundColor &&
|
|
824
1192
|
previousHasBg &&
|
|
825
1193
|
previousBgAlpha == 255 &&
|
|
826
1194
|
previousBgFill == 0 &&
|
|
@@ -828,17 +1196,16 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
828
1196
|
previousBgOverlayGradient == 0 &&
|
|
829
1197
|
previousBgRadialGradient == 0 &&
|
|
830
1198
|
previousBgGridAxes == 0 &&
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
rstyle(
|
|
835
|
-
rstyle(
|
|
836
|
-
rstyle(
|
|
837
|
-
rstyle(
|
|
838
|
-
previousBgColor !=
|
|
1199
|
+
style.has_bg &&
|
|
1200
|
+
style.bg_alpha == 255 &&
|
|
1201
|
+
style.bg_fill == 0 &&
|
|
1202
|
+
rstyle(style).bg_gradient_has_mid == 0 &&
|
|
1203
|
+
rstyle(style).bg_overlay_gradient == 0 &&
|
|
1204
|
+
rstyle(style).bg_radial_gradient == 0 &&
|
|
1205
|
+
rstyle(style).bg_grid_axes == 0 &&
|
|
1206
|
+
previousBgColor != style.bg_color) {
|
|
1207
|
+
if (!hadRecolor) n->render.bg_recolor_from = previousBgColor;
|
|
839
1208
|
n->render.bg_recolor_pending = 1;
|
|
840
|
-
n->render.bg_recolor_from = previousBgColor;
|
|
841
|
-
n->render.bg_recolor_to = n->style.bg_color;
|
|
842
1209
|
}
|
|
843
1210
|
n->render.dirty = 1;
|
|
844
1211
|
// Paint-only properties (background, colors, shadows, ...) repaint in
|
|
@@ -847,11 +1214,18 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
847
1214
|
// not let a retained transform update suppress the required relayout.
|
|
848
1215
|
if (isLayoutProperty(prop) || (isTransformProperty(prop) && state.fixedPositionUsed))
|
|
849
1216
|
n->render.layout_dirty = 1;
|
|
1217
|
+
#if GEA_CSS_SCROLLING
|
|
850
1218
|
n->render.non_scroll_dirty = 1;
|
|
1219
|
+
#endif
|
|
851
1220
|
if (isTransformProperty(prop)) {
|
|
1221
|
+
#if GEA_CSS_TRANSFORMS
|
|
852
1222
|
n->render.transform_dirty = 1;
|
|
1223
|
+
#endif
|
|
1224
|
+
|
|
1225
|
+
#if GEA_CSS_TRANSFORMS
|
|
853
1226
|
state.transformScanSerial = ~0ull;
|
|
854
1227
|
state.transformScanValid = false; // a transform was added/changed → drop durable no-transform cache
|
|
1228
|
+
#endif
|
|
855
1229
|
}
|
|
856
1230
|
if (DisplayInvalidation::rebuildsNodeDisplayCommands(prop)) {
|
|
857
1231
|
const bool stayLocal = DisplayInvalidation::nodeDisplayChangeCanStayLocal(node);
|
|
@@ -868,13 +1242,13 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
868
1242
|
// [drawStart,drawEnd], which excludes the scope — which is why
|
|
869
1243
|
// canReplayDirectDirtyRegions still bails and we fall to the safe
|
|
870
1244
|
// full-per-rect replay. The record stays incremental either way.)
|
|
871
|
-
if (stayLocal && prevOpacity < 255 &&
|
|
872
|
-
DisplayList::instance().patchNodeAlpha(node, static_cast<uint8_t>(
|
|
1245
|
+
if (stayLocal && prevOpacity < 255 && style.opacity < 255 &&
|
|
1246
|
+
DisplayList::instance().patchNodeAlpha(node, static_cast<uint8_t>(style.opacity)))
|
|
873
1247
|
return;
|
|
874
1248
|
// Crossing the 255 boundary (scope appears/disappears) or a non-leaf:
|
|
875
1249
|
// a leaf toggling strictly 0↔255 re-records locally; otherwise rebuild.
|
|
876
1250
|
const bool toggleOnly = (prevOpacity == 0 || prevOpacity == 255) &&
|
|
877
|
-
(
|
|
1251
|
+
(style.opacity == 0 || style.opacity == 255);
|
|
878
1252
|
forceFull = !stayLocal || !toggleOnly;
|
|
879
1253
|
} else if (prop == Property::MaskRightFadeWidth ||
|
|
880
1254
|
prop == Property::FilterBlur ||
|
|
@@ -910,7 +1284,7 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
910
1284
|
// labels are NOT re-recorded). Every other size/layout/z-index change
|
|
911
1285
|
// reflows or reorders → full rebuild.
|
|
912
1286
|
const bool absLeafSize = (prop == Property::Width || prop == Property::Height) &&
|
|
913
|
-
|
|
1287
|
+
style.position == 1 && n->first_child < 0 && n->type != NodeType::Text;
|
|
914
1288
|
if (absLeafSize)
|
|
915
1289
|
tree.markNodeDisplayCommandsDirty(node);
|
|
916
1290
|
else
|
|
@@ -943,15 +1317,17 @@ void Tree::resetStyleForClassRecompute(int node)
|
|
|
943
1317
|
auto &state = treeState();
|
|
944
1318
|
if (node < 0 || node >= state.nodeCount) return;
|
|
945
1319
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
state.nodes[node].
|
|
949
|
-
|
|
1320
|
+
state.nodes[node].resetComputedStyle();
|
|
1321
|
+
#if GEA_UI_IMAGE_NODES
|
|
1322
|
+
state.nodes[node].image_id = -1;
|
|
1323
|
+
#endif
|
|
950
1324
|
if (state.styleInvalidationSuppressionDepth > 0) return;
|
|
951
1325
|
if (!nodeParticipatesInMountedTree(state, node)) return;
|
|
952
1326
|
state.nodes[node].render.dirty = 1;
|
|
953
1327
|
state.nodes[node].render.layout_dirty = 1;
|
|
1328
|
+
#if GEA_CSS_SCROLLING
|
|
954
1329
|
state.nodes[node].render.non_scroll_dirty = 1;
|
|
1330
|
+
#endif
|
|
955
1331
|
markDisplayListDirty();
|
|
956
1332
|
}
|
|
957
1333
|
|