@geastack/engine 0.1.6 → 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 +52 -30
- package/css/declarative.h +6 -0
- package/css/engine.h +19 -0
- package/image_store.cpp +136 -33
- package/package.json +2 -2
- package/ui/CSS_FEATURES.md +261 -0
- package/ui/absolute_leaf_refresh.cpp +15 -13
- package/ui/core.cpp +23 -0
- package/ui/css_atom.cpp +6 -0
- package/ui/css_atom.h +2 -0
- package/ui/css_features.h +282 -0
- package/ui/image_node.cpp +9 -8
- package/ui/input.cpp +22 -2
- package/ui/input_render.cpp +4 -0
- package/ui/layout.cpp +171 -83
- package/ui/layout_snapshot.cpp +28 -1
- package/ui/node_features.h +18 -0
- package/ui/node_lifecycle.cpp +192 -84
- package/ui/node_lifecycle.h +1 -0
- package/ui/node_model.h +631 -71
- package/ui/node_text.h +82 -0
- package/ui/render.cpp +155 -87
- package/ui/renderer_features.h +19 -0
- package/ui/root_scroll_refresh.cpp +31 -14
- package/ui/style.cpp +991 -228
- package/ui/text.cpp +24 -4
- package/ui/tree_events.cpp +135 -95
- package/ui/tree_events.h +28 -20
- package/ui/tree_inspection.h +15 -0
- package/ui/tree_nodes.cpp +32 -4
- package/ui/tree_render.cpp +48 -19
- package/ui/tree_scroll_mirror.cpp +26 -0
- package/ui/tree_state.cpp +261 -114
- package/ui/tree_state.h +69 -18
- package/ui/tree_style.cpp +339 -72
- package/ui/view.cpp +122 -62
- package/ui/virtual_keyboard.cpp +10 -3
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:
|
|
@@ -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)
|
|
@@ -300,48 +320,105 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
300
320
|
}
|
|
301
321
|
break;
|
|
302
322
|
case Property::BoxSizing: if (n->style.box_sizing != value) { n->style.box_sizing = value; changed = 1; } break;
|
|
323
|
+
#if GEA_CSS_FLOATS
|
|
303
324
|
case Property::Float: if (n->style.float_side != value) { n->style.float_side = value; changed = 1; } break;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
case Property::
|
|
307
|
-
|
|
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
|
|
308
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
|
|
309
342
|
case Property::Direction: if (n->style.direction != value) { n->style.direction = value; changed = 1; } break;
|
|
310
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
|
|
311
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
|
|
312
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
|
|
313
352
|
case Property::RowGapPercent: if (n->style.row_gap_percent != value) { n->style.row_gap_percent = value; changed = 1; } break;
|
|
314
353
|
case Property::ColumnGapPercent: if (n->style.column_gap_percent != value) { n->style.column_gap_percent = value; changed = 1; } break;
|
|
354
|
+
#endif
|
|
315
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; }
|
|
316
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; }
|
|
317
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; }
|
|
318
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
|
|
319
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
|
|
320
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
|
|
321
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
|
|
322
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
|
|
323
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
|
|
324
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
|
|
325
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
|
|
326
381
|
case Property::PaddingLeftExpression: if (rstyle(n->style).padding_expression[3] != value) { rstyleMut(n->style).padding_expression[3] = value; changed = 1; } break;
|
|
382
|
+
#endif
|
|
327
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
|
|
328
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
|
|
329
388
|
case Property::Order: if (n->style.order != value) { n->style.order = value; changed = 1; } break;
|
|
389
|
+
#endif
|
|
390
|
+
#if GEA_CSS_FLEX_WRAP
|
|
330
391
|
case Property::FlexWrap: if (n->style.flex_wrap != value) { n->style.flex_wrap = value; changed = 1; } break;
|
|
392
|
+
#endif
|
|
331
393
|
case Property::JustifyContent: if (n->style.justify_content != value) { n->style.justify_content = value; changed = 1; } break;
|
|
332
394
|
case Property::AlignItems: if (n->style.align_items != value) { n->style.align_items = value; changed = 1; } break;
|
|
395
|
+
#if GEA_CSS_JUSTIFY_ITEMS
|
|
333
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
|
|
334
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
|
|
335
402
|
case Property::AlignSelf: if (n->style.align_self != value) { n->style.align_self = value; changed = 1; } break;
|
|
336
|
-
|
|
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
|
|
337
408
|
case Property::GridRowStart: if (rstyle(n->style).grid_line[0] != value) { rstyleMut(n->style).grid_line[0] = value; changed = 1; } break;
|
|
338
409
|
case Property::GridColumnStart: if (rstyle(n->style).grid_line[1] != value) { rstyleMut(n->style).grid_line[1] = value; changed = 1; } break;
|
|
339
410
|
case Property::GridRowEnd: if (rstyle(n->style).grid_line[2] != value) { rstyleMut(n->style).grid_line[2] = value; changed = 1; } break;
|
|
340
411
|
case Property::GridColumnEnd: if (rstyle(n->style).grid_line[3] != value) { rstyleMut(n->style).grid_line[3] = value; changed = 1; } break;
|
|
412
|
+
#endif
|
|
341
413
|
case Property::Gap:
|
|
342
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) {
|
|
343
415
|
n->style.gap = value;
|
|
344
|
-
|
|
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
|
|
345
422
|
changed = 1;
|
|
346
423
|
}
|
|
347
424
|
break;
|
|
@@ -354,7 +431,9 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
354
431
|
}
|
|
355
432
|
break;
|
|
356
433
|
case Property::Height:
|
|
434
|
+
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
357
435
|
if (n->style.height_expression != -1) { n->style.height_expression = -1; changed = 1; }
|
|
436
|
+
#endif
|
|
358
437
|
if (n->style.height != value || n->style.height_percent != kUnset) {
|
|
359
438
|
n->style.height = value;
|
|
360
439
|
n->style.height_percent = kUnset;
|
|
@@ -370,91 +449,174 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
370
449
|
}
|
|
371
450
|
break;
|
|
372
451
|
case Property::HeightPercent:
|
|
452
|
+
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
373
453
|
if (n->style.height_expression != -1) { n->style.height_expression = -1; changed = 1; }
|
|
454
|
+
#endif
|
|
374
455
|
if (n->style.height_percent != value || n->style.height != kUnset) {
|
|
375
456
|
n->style.height_percent = value;
|
|
376
457
|
n->style.height = kUnset;
|
|
377
458
|
changed = 1;
|
|
378
459
|
}
|
|
379
460
|
break;
|
|
461
|
+
#if GEA_CSS_MIN_WIDTH
|
|
380
462
|
case Property::MinWidth: if (n->style.min_width != value) { n->style.min_width = value; changed = 1; } break;
|
|
463
|
+
#endif
|
|
381
464
|
case Property::MinHeight: if (n->style.min_height != value) { n->style.min_height = value; changed = 1; } break;
|
|
382
465
|
case Property::MaxWidth: if (n->style.max_width != value) { n->style.max_width = value; changed = 1; } break;
|
|
466
|
+
#if GEA_CSS_MAX_HEIGHT
|
|
383
467
|
case Property::MaxHeight: if (n->style.max_height != value) { n->style.max_height = value; changed = 1; } break;
|
|
468
|
+
#endif
|
|
384
469
|
case Property::Flex: if (n->style.flex != value) { n->style.flex = value; changed = 1; } break;
|
|
385
470
|
case Property::FlexShrink: if (n->style.flex_shrink != value) { n->style.flex_shrink = value; changed = 1; } break;
|
|
386
471
|
case Property::FlexBasis:
|
|
472
|
+
#if GEA_CSS_FLEX_BASIS_EXPRESSIONS
|
|
387
473
|
if (rstyle(n->style).flex_basis_expression >= 0) { rstyleMut(n->style).flex_basis_expression = -1; changed = 1; }
|
|
388
|
-
|
|
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
|
|
389
480
|
case Property::FlexBasisExpression:
|
|
390
481
|
if (rstyle(n->style).flex_basis_expression != value || n->style.flex_basis != kUnset) {
|
|
391
|
-
rstyleMut(n->style).flex_basis_expression = value;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
case Property::
|
|
400
|
-
|
|
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;
|
|
401
530
|
case Property::Position: if (value == kPositionFixed) state.fixedPositionUsed = true; if (n->style.position != value) { n->style.position = value; changed = 1; } break;
|
|
402
531
|
case Property::Top:
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
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
|
|
406
538
|
changed = 1;
|
|
407
539
|
}
|
|
540
|
+
#endif
|
|
408
541
|
break;
|
|
409
542
|
case Property::Right:
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
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
|
|
413
549
|
changed = 1;
|
|
414
550
|
}
|
|
551
|
+
#endif
|
|
415
552
|
break;
|
|
416
553
|
case Property::Bottom:
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
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
|
|
420
560
|
changed = 1;
|
|
421
561
|
}
|
|
562
|
+
#endif
|
|
422
563
|
break;
|
|
423
564
|
case Property::Left:
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
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
|
|
427
571
|
changed = 1;
|
|
428
572
|
}
|
|
573
|
+
#endif
|
|
429
574
|
break;
|
|
430
575
|
case Property::TopPercent:
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
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
|
|
434
582
|
changed = 1;
|
|
435
583
|
}
|
|
584
|
+
#endif
|
|
436
585
|
break;
|
|
437
586
|
case Property::RightPercent:
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
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
|
|
441
593
|
changed = 1;
|
|
442
594
|
}
|
|
595
|
+
#endif
|
|
443
596
|
break;
|
|
444
597
|
case Property::BottomPercent:
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
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
|
|
448
604
|
changed = 1;
|
|
449
605
|
}
|
|
606
|
+
#endif
|
|
450
607
|
break;
|
|
451
608
|
case Property::LeftPercent:
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
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
|
|
455
615
|
changed = 1;
|
|
456
616
|
}
|
|
617
|
+
#endif
|
|
457
618
|
break;
|
|
619
|
+
#if GEA_CSS_Z_INDEX
|
|
458
620
|
case Property::ZIndex: {
|
|
459
621
|
const bool automatic = value == kZIndexAuto;
|
|
460
622
|
const int level = automatic ? 0 : std::clamp(value, -32768, 32767);
|
|
@@ -463,6 +625,7 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
463
625
|
}
|
|
464
626
|
break;
|
|
465
627
|
}
|
|
628
|
+
#endif
|
|
466
629
|
case Property::BackgroundColor: {
|
|
467
630
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
468
631
|
if (n->style.bg_color != next) { n->style.bg_color = next; changed = 1; }
|
|
@@ -474,6 +637,7 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
474
637
|
if (n->style.bg_alpha != alpha) { n->style.bg_alpha = alpha; changed = 1; }
|
|
475
638
|
break;
|
|
476
639
|
}
|
|
640
|
+
#if GEA_CSS_BACKGROUND_LAYERS
|
|
477
641
|
case Property::BackgroundClip: if (rstyle(n->style).bg_clip != value) { rstyleMut(n->style).bg_clip = value; changed = 1; } break;
|
|
478
642
|
case Property::BackgroundSizeList: if (rstyle(n->style).bg_size_list != value) { rstyleMut(n->style).bg_size_list = value; changed = 1; } break;
|
|
479
643
|
case Property::BackgroundPositionList: if (rstyle(n->style).bg_position_list != value) { rstyleMut(n->style).bg_position_list = value; changed = 1; } break;
|
|
@@ -481,6 +645,7 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
481
645
|
case Property::BackgroundAttachmentList: if (rstyle(n->style).bg_attachment_list != value) { rstyleMut(n->style).bg_attachment_list = value; changed = 1; } break;
|
|
482
646
|
case Property::BackgroundOriginList: if (rstyle(n->style).bg_origin_list != value) { rstyleMut(n->style).bg_origin_list = value; changed = 1; } break;
|
|
483
647
|
|
|
648
|
+
#endif
|
|
484
649
|
case Property::BackgroundImage:
|
|
485
650
|
changed = StyleValues::applyBackgroundImage(n->style, value, node);
|
|
486
651
|
break;
|
|
@@ -494,14 +659,19 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
494
659
|
case Property::Color: {
|
|
495
660
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
496
661
|
if (n->style.text_color != next) { n->style.text_color = next; changed = 1; }
|
|
662
|
+
#if GEA_CSS_TEXT_ALPHA
|
|
497
663
|
if (n->style.text_alpha != 255) { n->style.text_alpha = 255; changed = 1; }
|
|
664
|
+
#endif
|
|
498
665
|
break;
|
|
499
666
|
}
|
|
667
|
+
#if GEA_CSS_OPACITY
|
|
500
668
|
case Property::Opacity: {
|
|
501
669
|
uint8_t next = (uint8_t)value;
|
|
502
670
|
if (n->style.opacity != next) { prevOpacity = n->style.opacity; n->style.opacity = next; changed = 1; }
|
|
503
671
|
break;
|
|
504
672
|
}
|
|
673
|
+
#endif
|
|
674
|
+
#if GEA_CSS_BLINK
|
|
505
675
|
case Property::BlinkInterval:
|
|
506
676
|
value = value > 0 ? value : 0;
|
|
507
677
|
if (n->style.blink_interval_ms != value) {
|
|
@@ -511,16 +681,22 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
511
681
|
changed = 1;
|
|
512
682
|
}
|
|
513
683
|
break;
|
|
684
|
+
#endif
|
|
514
685
|
case Property::ColorAlpha: {
|
|
686
|
+
#if GEA_CSS_TEXT_ALPHA
|
|
515
687
|
const uint8_t alpha = static_cast<uint8_t>(std::clamp(value, 0, 255));
|
|
516
688
|
if (n->style.text_alpha != alpha) { n->style.text_alpha = alpha; changed = 1; }
|
|
689
|
+
#endif
|
|
517
690
|
break;
|
|
518
691
|
}
|
|
519
692
|
case Property::BorderAlpha: {
|
|
693
|
+
#if GEA_CSS_BORDER_ALPHA
|
|
520
694
|
const uint8_t alpha = static_cast<uint8_t>(std::clamp(value, 0, 255));
|
|
521
695
|
if (n->style.border_alpha != alpha) { n->style.border_alpha = alpha; changed = 1; }
|
|
696
|
+
#endif
|
|
522
697
|
break;
|
|
523
698
|
}
|
|
699
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
524
700
|
case Property::BorderTopAlpha:
|
|
525
701
|
case Property::BorderRightAlpha:
|
|
526
702
|
case Property::BorderBottomAlpha:
|
|
@@ -531,22 +707,30 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
531
707
|
if (rstyle(n->style).border_side_alpha[side] != alpha) { rstyleMut(n->style).border_side_alpha[side] = alpha; changed = 1; }
|
|
532
708
|
break;
|
|
533
709
|
}
|
|
710
|
+
#endif
|
|
534
711
|
case Property::BorderColorCurrent: changed |= setBorderColorBinding(n->style, -1, value != 0); break;
|
|
712
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
535
713
|
case Property::BorderTopColorCurrent:
|
|
536
714
|
case Property::BorderRightColorCurrent:
|
|
537
715
|
case Property::BorderBottomColorCurrent:
|
|
538
716
|
case Property::BorderLeftColorCurrent:
|
|
539
717
|
changed |= setBorderColorBinding(n->style, static_cast<int>(prop) - static_cast<int>(Property::BorderTopColorCurrent), value != 0);
|
|
540
718
|
break;
|
|
719
|
+
#endif
|
|
541
720
|
case Property::BorderWidth: changed |= setComputedBorderWidth(n->style, -1, value, n->parent >= 0 ? &state.nodes[n->parent].style : nullptr); break;
|
|
542
721
|
case Property::BorderColor: {
|
|
543
722
|
changed |= setBorderColorBinding(n->style, -1, false);
|
|
544
723
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
545
724
|
if (n->style.border_color != next) { n->style.border_color = next; changed = 1; }
|
|
725
|
+
#if GEA_CSS_BORDER_ALPHA
|
|
546
726
|
if (n->style.border_alpha != 255) { n->style.border_alpha = 255; changed = 1; }
|
|
727
|
+
#endif
|
|
547
728
|
break;
|
|
548
729
|
}
|
|
730
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
549
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
|
|
550
734
|
case Property::BorderRelief:
|
|
551
735
|
case Property::BorderTopRelief:
|
|
552
736
|
case Property::BorderRightRelief:
|
|
@@ -560,6 +744,8 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
560
744
|
}
|
|
561
745
|
}
|
|
562
746
|
break;
|
|
747
|
+
#endif
|
|
748
|
+
#if GEA_CSS_SIDE_BORDERS
|
|
563
749
|
case Property::BorderRightWidth: changed |= setComputedBorderWidth(n->style, 1, value, n->parent >= 0 ? &state.nodes[n->parent].style : nullptr); break;
|
|
564
750
|
case Property::BorderBottomWidth: changed |= setComputedBorderWidth(n->style, 2, value, n->parent >= 0 ? &state.nodes[n->parent].style : nullptr); break;
|
|
565
751
|
case Property::BorderLeftWidth: changed |= setComputedBorderWidth(n->style, 3, value, n->parent >= 0 ? &state.nodes[n->parent].style : nullptr); break;
|
|
@@ -591,69 +777,83 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
591
777
|
if (rstyle(n->style).border_side_alpha[3] != 255) { rstyleMut(n->style).border_side_alpha[3] = 255; changed = 1; }
|
|
592
778
|
break;
|
|
593
779
|
}
|
|
780
|
+
#endif
|
|
594
781
|
case Property::BorderRadiusTopLeft:
|
|
595
|
-
if (n->style.border_radius[0] != value || n->style.border_radius_percent[0] != kUnset) {
|
|
596
|
-
n->style.border_radius[0] = value;
|
|
597
|
-
|
|
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
|
|
598
787
|
changed = 1;
|
|
599
788
|
}
|
|
600
789
|
break;
|
|
601
790
|
case Property::BorderRadiusTopRight:
|
|
602
|
-
if (n->style.border_radius[1] != value || n->style.border_radius_percent[1] != kUnset) {
|
|
603
|
-
n->style.border_radius[1] = value;
|
|
604
|
-
|
|
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
|
|
605
796
|
changed = 1;
|
|
606
797
|
}
|
|
607
798
|
break;
|
|
608
799
|
case Property::BorderRadiusBottomRight:
|
|
609
|
-
if (n->style.border_radius[2] != value || n->style.border_radius_percent[2] != kUnset) {
|
|
610
|
-
n->style.border_radius[2] = value;
|
|
611
|
-
|
|
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
|
|
612
805
|
changed = 1;
|
|
613
806
|
}
|
|
614
807
|
break;
|
|
615
808
|
case Property::BorderRadiusBottomLeft:
|
|
616
|
-
if (n->style.border_radius[3] != value || n->style.border_radius_percent[3] != kUnset) {
|
|
617
|
-
n->style.border_radius[3] = value;
|
|
618
|
-
|
|
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
|
|
619
814
|
changed = 1;
|
|
620
815
|
}
|
|
621
816
|
break;
|
|
817
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
622
818
|
case Property::BorderRadiusTopLeftPercent:
|
|
623
|
-
if (n->style.border_radius_percent[0] != value || n->style.border_radius[0] != 0) {
|
|
624
|
-
n->style.border_radius_percent[0] = value;
|
|
625
|
-
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;
|
|
626
822
|
changed = 1;
|
|
627
823
|
}
|
|
628
824
|
break;
|
|
629
825
|
case Property::BorderRadiusTopRightPercent:
|
|
630
|
-
if (n->style.border_radius_percent[1] != value || n->style.border_radius[1] != 0) {
|
|
631
|
-
n->style.border_radius_percent[1] = value;
|
|
632
|
-
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;
|
|
633
829
|
changed = 1;
|
|
634
830
|
}
|
|
635
831
|
break;
|
|
636
832
|
case Property::BorderRadiusBottomRightPercent:
|
|
637
|
-
if (n->style.border_radius_percent[2] != value || n->style.border_radius[2] != 0) {
|
|
638
|
-
n->style.border_radius_percent[2] = value;
|
|
639
|
-
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;
|
|
640
836
|
changed = 1;
|
|
641
837
|
}
|
|
642
838
|
break;
|
|
643
839
|
case Property::BorderRadiusBottomLeftPercent:
|
|
644
|
-
if (n->style.border_radius_percent[3] != value || n->style.border_radius[3] != 0) {
|
|
645
|
-
n->style.border_radius_percent[3] = value;
|
|
646
|
-
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;
|
|
647
843
|
changed = 1;
|
|
648
844
|
}
|
|
649
845
|
break;
|
|
846
|
+
#endif
|
|
650
847
|
case Property::FontId: if (n->style.font_id != value) { n->style.font_id = value; changed = 1; } break;
|
|
651
848
|
case Property::FontSize: if (n->style.font_size != value) { n->style.font_size = value; changed = 1; } break;
|
|
652
849
|
case Property::FontWeight: if (n->style.font_weight != value) { n->style.font_weight = value; changed = 1; } break;
|
|
653
850
|
case Property::LineHeight:
|
|
654
851
|
if (n->style.line_height_multiplier >= 0) { n->style.line_height_multiplier = -1; changed = 1; }
|
|
852
|
+
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
655
853
|
if (rstyle(n->style).line_height_expression >= 0) { rstyleMut(n->style).line_height_expression = -1; changed = 1; }
|
|
854
|
+
#endif
|
|
656
855
|
if (n->style.line_height != value) { n->style.line_height = value; changed = 1; } break;
|
|
856
|
+
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
657
857
|
case Property::LineHeightExpression: {
|
|
658
858
|
if (n->style.line_height_multiplier >= 0) { n->style.line_height_multiplier = -1; changed = 1; }
|
|
659
859
|
const int height = resolveLineHeightExpression(node, value);
|
|
@@ -661,22 +861,38 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
661
861
|
rstyleMut(n->style).line_height_expression = value; n->style.line_height = height; changed = 1;
|
|
662
862
|
} break;
|
|
663
863
|
}
|
|
864
|
+
#endif
|
|
664
865
|
case Property::LineHeightMultiplier: {
|
|
665
866
|
const int height = resolveLineHeightMultiplier(node, value);
|
|
867
|
+
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
666
868
|
if (rstyle(n->style).line_height_expression >= 0) { rstyleMut(n->style).line_height_expression = -1; changed = 1; }
|
|
869
|
+
#endif
|
|
667
870
|
if (n->style.line_height_multiplier != value || n->style.line_height != height) {
|
|
668
871
|
n->style.line_height_multiplier = value; n->style.line_height = height; changed = 1;
|
|
669
872
|
} break;
|
|
670
873
|
}
|
|
671
874
|
case Property::TextAlign: if (n->style.text_align != value) { n->style.text_align = value; changed = 1; } break;
|
|
875
|
+
#if GEA_CSS_TEXT_DECORATION
|
|
672
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
|
|
673
879
|
case Property::TextTransform: if (n->style.text_transform != value) { n->style.text_transform = value; changed = 1; } break;
|
|
880
|
+
#endif
|
|
674
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;
|
|
675
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
|
|
676
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
|
|
677
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
|
|
678
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
|
|
679
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
|
|
680
896
|
case Property::Overflow: {
|
|
681
897
|
const int8_t next = static_cast<int8_t>(value);
|
|
682
898
|
if (n->style.overflow != next || n->style.overflow_x != next || n->style.overflow_y != next) {
|
|
@@ -707,6 +923,16 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
707
923
|
}
|
|
708
924
|
break;
|
|
709
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
|
|
710
936
|
case Property::MaskRightFadeWidth: {
|
|
711
937
|
const int16_t next = static_cast<int16_t>(value < 0 ? 0 : value > 32767 ? 32767 : value);
|
|
712
938
|
if (n->style.mask_right_fade_width != next) {
|
|
@@ -715,8 +941,14 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
715
941
|
}
|
|
716
942
|
break;
|
|
717
943
|
}
|
|
944
|
+
#endif
|
|
945
|
+
#if GEA_UI_IMAGE_NODES
|
|
718
946
|
case Property::ImageId: if (n->image_id != value) { n->image_id = value; changed = 1; } break;
|
|
947
|
+
#endif
|
|
948
|
+
#if GEA_CSS_IMAGE_FIT
|
|
719
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
|
|
720
952
|
case Property::TransformTranslateOuterAxes: if (rstyle(n->style).transform_translate_outer_axes != value) { rstyleMut(n->style).transform_translate_outer_axes = value; changed = 1; } break;
|
|
721
953
|
case Property::RotateAngle: if (rstyle(n->style).rotate_angle != value) { rstyleMut(n->style).rotate_angle = value; changed = 1; } break;
|
|
722
954
|
case Property::RotateAxisX: if (rstyle(n->style).rotate_axis_x != value) { rstyleMut(n->style).rotate_axis_x = value; changed = 1; } break;
|
|
@@ -734,7 +966,11 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
734
966
|
case Property::TransformPresent: if (rstyle(n->style).transform_present != (value != 0)) { rstyleMut(n->style).transform_present = value != 0; changed = 1; } break;
|
|
735
967
|
case Property::RotatePresent: if (rstyle(n->style).rotate_present != (value != 0)) { rstyleMut(n->style).rotate_present = value != 0; changed = 1; } break;
|
|
736
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
|
|
737
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
|
|
738
974
|
case Property::TransformRotate:
|
|
739
975
|
if (rstyle(n->style).transform_rotate != value) {
|
|
740
976
|
rstyleMut(n->style).transform_rotate = value;
|
|
@@ -756,26 +992,43 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
756
992
|
case Property::Perspective: if (rstyle(n->style).perspective != value) { rstyleMut(n->style).perspective = value; changed = 1; } break;
|
|
757
993
|
case Property::PerspectiveOriginX: if (rstyle(n->style).perspective_origin_x != value) { rstyleMut(n->style).perspective_origin_x = value; changed = 1; } break;
|
|
758
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
|
|
759
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
|
|
760
1000
|
case Property::BoxShadowInset: {
|
|
761
1001
|
const uint8_t next = value != 0 ? 1 : 0;
|
|
762
1002
|
if (rstyle(n->style).box_shadow_inset != next) { rstyleMut(n->style).box_shadow_inset = next; changed = 1; }
|
|
763
1003
|
break;
|
|
764
1004
|
}
|
|
1005
|
+
#endif
|
|
1006
|
+
#if GEA_CSS_BOX_SHADOW
|
|
765
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
|
|
766
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
|
|
767
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
|
|
768
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
|
|
769
1019
|
case Property::BoxShadowColor: {
|
|
770
1020
|
const style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
771
1021
|
if (rstyle(n->style).box_shadow_color != next) { rstyleMut(n->style).box_shadow_color = next; changed = 1; }
|
|
772
1022
|
break;
|
|
773
1023
|
}
|
|
1024
|
+
#endif
|
|
1025
|
+
#if GEA_CSS_BOX_SHADOW
|
|
774
1026
|
case Property::BoxShadowAlpha: {
|
|
775
1027
|
const uint8_t next = static_cast<uint8_t>(value < 0 ? 0 : value > 255 ? 255 : value);
|
|
776
1028
|
if (rstyle(n->style).box_shadow_alpha != next) { rstyleMut(n->style).box_shadow_alpha = next; changed = 1; }
|
|
777
1029
|
break;
|
|
778
1030
|
}
|
|
1031
|
+
#endif
|
|
779
1032
|
default:
|
|
780
1033
|
perf.treeSetStyleNoop++;
|
|
781
1034
|
return;
|
|
@@ -793,6 +1046,10 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
793
1046
|
perf.treeSetStylePaintChanged++;
|
|
794
1047
|
if (state.styleInvalidationSuppressionDepth > 0) return;
|
|
795
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;
|
|
796
1053
|
if (prop == Property::Visibility || prop == Property::Backface || prop == Property::TransformStyle)
|
|
797
1054
|
tree.markDisplayListDirty();
|
|
798
1055
|
const int documentRoot = state.mountedRoot;
|
|
@@ -815,12 +1072,14 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
815
1072
|
(n->style.height != kUnset || n->style.height_percent != kUnset);
|
|
816
1073
|
if (fixedBox) {
|
|
817
1074
|
n->render.dirty = 1;
|
|
1075
|
+
#if GEA_CSS_SCROLLING
|
|
818
1076
|
n->render.non_scroll_dirty = 1;
|
|
1077
|
+
#endif
|
|
819
1078
|
tree.markNodeDisplayCommandsDirty(node);
|
|
820
1079
|
return;
|
|
821
1080
|
}
|
|
822
1081
|
}
|
|
823
|
-
if (prop == Property::BackgroundColor &&
|
|
1082
|
+
if (canRecolor && prop == Property::BackgroundColor &&
|
|
824
1083
|
previousHasBg &&
|
|
825
1084
|
previousBgAlpha == 255 &&
|
|
826
1085
|
previousBgFill == 0 &&
|
|
@@ -836,9 +1095,8 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
836
1095
|
rstyle(n->style).bg_radial_gradient == 0 &&
|
|
837
1096
|
rstyle(n->style).bg_grid_axes == 0 &&
|
|
838
1097
|
previousBgColor != n->style.bg_color) {
|
|
1098
|
+
if (!hadRecolor) n->render.bg_recolor_from = previousBgColor;
|
|
839
1099
|
n->render.bg_recolor_pending = 1;
|
|
840
|
-
n->render.bg_recolor_from = previousBgColor;
|
|
841
|
-
n->render.bg_recolor_to = n->style.bg_color;
|
|
842
1100
|
}
|
|
843
1101
|
n->render.dirty = 1;
|
|
844
1102
|
// Paint-only properties (background, colors, shadows, ...) repaint in
|
|
@@ -847,11 +1105,18 @@ void setStyleValue(Tree &tree, int node, Property prop, int value, bool recordIn
|
|
|
847
1105
|
// not let a retained transform update suppress the required relayout.
|
|
848
1106
|
if (isLayoutProperty(prop) || (isTransformProperty(prop) && state.fixedPositionUsed))
|
|
849
1107
|
n->render.layout_dirty = 1;
|
|
1108
|
+
#if GEA_CSS_SCROLLING
|
|
850
1109
|
n->render.non_scroll_dirty = 1;
|
|
1110
|
+
#endif
|
|
851
1111
|
if (isTransformProperty(prop)) {
|
|
1112
|
+
#if GEA_CSS_TRANSFORMS
|
|
852
1113
|
n->render.transform_dirty = 1;
|
|
1114
|
+
#endif
|
|
1115
|
+
|
|
1116
|
+
#if GEA_CSS_TRANSFORMS
|
|
853
1117
|
state.transformScanSerial = ~0ull;
|
|
854
1118
|
state.transformScanValid = false; // a transform was added/changed → drop durable no-transform cache
|
|
1119
|
+
#endif
|
|
855
1120
|
}
|
|
856
1121
|
if (DisplayInvalidation::rebuildsNodeDisplayCommands(prop)) {
|
|
857
1122
|
const bool stayLocal = DisplayInvalidation::nodeDisplayChangeCanStayLocal(node);
|
|
@@ -943,15 +1208,17 @@ void Tree::resetStyleForClassRecompute(int node)
|
|
|
943
1208
|
auto &state = treeState();
|
|
944
1209
|
if (node < 0 || node >= state.nodeCount) return;
|
|
945
1210
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
state.nodes[node].
|
|
949
|
-
|
|
1211
|
+
NodeLifecycle::resetStyle(state.nodes[node].style);
|
|
1212
|
+
#if GEA_UI_IMAGE_NODES
|
|
1213
|
+
state.nodes[node].image_id = -1;
|
|
1214
|
+
#endif
|
|
950
1215
|
if (state.styleInvalidationSuppressionDepth > 0) return;
|
|
951
1216
|
if (!nodeParticipatesInMountedTree(state, node)) return;
|
|
952
1217
|
state.nodes[node].render.dirty = 1;
|
|
953
1218
|
state.nodes[node].render.layout_dirty = 1;
|
|
1219
|
+
#if GEA_CSS_SCROLLING
|
|
954
1220
|
state.nodes[node].render.non_scroll_dirty = 1;
|
|
1221
|
+
#endif
|
|
955
1222
|
markDisplayListDirty();
|
|
956
1223
|
}
|
|
957
1224
|
|