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