@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/canvas.cpp +59 -24
- package/css/engine.h +1 -0
- package/package.json +4 -3
- package/ui/absolute_leaf_refresh.cpp +65 -52
- package/ui/core.cpp +4 -4
- package/ui/css_features.h +87 -0
- package/ui/document.cpp +11 -0
- package/ui/image_node.cpp +24 -24
- package/ui/input.cpp +24 -24
- package/ui/input_render.cpp +27 -27
- package/ui/internal.h +22 -0
- package/ui/layout.cpp +771 -573
- package/ui/layout_snapshot.cpp +1 -1
- package/ui/node_features.h +18 -0
- package/ui/node_lifecycle.cpp +167 -1
- package/ui/node_model.h +216 -56
- package/ui/node_text.h +2 -0
- package/ui/refresh_perf.h +19 -17
- package/ui/render.cpp +203 -189
- package/ui/renderer_features.h +5 -0
- package/ui/root_scroll_refresh.cpp +65 -65
- package/ui/storage_usage.h +45 -0
- package/ui/style.cpp +432 -146
- package/ui/style_values.h +2 -2
- package/ui/text.cpp +151 -153
- package/ui/tree_events.cpp +86 -0
- package/ui/tree_events.h +16 -0
- package/ui/tree_nodes.cpp +21 -17
- package/ui/tree_render.cpp +127 -123
- package/ui/tree_scroll_mirror.cpp +4 -4
- package/ui/tree_state.cpp +78 -6
- package/ui/tree_state.h +49 -4
- package/ui/tree_style.cpp +409 -300
- package/ui/view.cpp +207 -207
- package/ui/virtual_keyboard.cpp +11 -11
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 ?
|
|
297
|
-
const uint8_t previousHasBg = isBgColorChange ?
|
|
298
|
-
const uint8_t previousBgAlpha = isBgColorChange ?
|
|
299
|
-
const int8_t previousBgFill = isBgColorChange ?
|
|
300
|
-
const uint8_t previousBgGradientHasMid = isBgColorChange ? rstyle(
|
|
301
|
-
const uint8_t previousBgOverlayGradient = isBgColorChange ? rstyle(
|
|
302
|
-
const uint8_t previousBgRadialGradient = isBgColorChange ? rstyle(
|
|
303
|
-
const uint8_t previousBgGridAxes = isBgColorChange ? rstyle(
|
|
297
|
+
const style_color_t previousBgColor = isBgColorChange ? style.bg_color : style_color_t{};
|
|
298
|
+
const uint8_t previousHasBg = isBgColorChange ? style.has_bg : 0;
|
|
299
|
+
const uint8_t previousBgAlpha = isBgColorChange ? style.bg_alpha : 0;
|
|
300
|
+
const int8_t previousBgFill = isBgColorChange ? style.bg_fill : 0;
|
|
301
|
+
const uint8_t previousBgGradientHasMid = isBgColorChange ? rstyle(style).bg_gradient_has_mid : 0;
|
|
302
|
+
const uint8_t previousBgOverlayGradient = isBgColorChange ? rstyle(style).bg_overlay_gradient : 0;
|
|
303
|
+
const uint8_t previousBgRadialGradient = isBgColorChange ? rstyle(style).bg_radial_gradient : 0;
|
|
304
|
+
const uint8_t previousBgGridAxes = isBgColorChange ? rstyle(style).bg_grid_axes : 0;
|
|
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
|
-
|
|
310
|
-
if (
|
|
310
|
+
#if GEA_CSS_DISPLAY_EXPLICIT
|
|
311
|
+
if (!style.display_explicit) { style.display_explicit = 1; changed = 1; }
|
|
312
|
+
#endif
|
|
313
|
+
if (style.display != value) { style.display = value; changed = 1; }
|
|
311
314
|
break;
|
|
315
|
+
#if GEA_CSS_FLEX_DIRECTION
|
|
312
316
|
case Property::FlexDirection:
|
|
313
|
-
if (!
|
|
314
|
-
|
|
317
|
+
if (!style.flex_direction_explicit) {
|
|
318
|
+
style.flex_direction_explicit = 1;
|
|
315
319
|
changed = 1;
|
|
316
320
|
}
|
|
317
|
-
if (
|
|
318
|
-
|
|
321
|
+
if (style.flex_direction != value) {
|
|
322
|
+
style.flex_direction = value;
|
|
319
323
|
changed = 1;
|
|
320
324
|
}
|
|
321
325
|
break;
|
|
322
|
-
|
|
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 (
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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 (
|
|
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 (
|
|
343
|
-
case Property::WritingMode: if (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
353
|
-
case Property::ColumnGapPercent: if (
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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:
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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(
|
|
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(
|
|
409
|
-
case Property::GridColumnStart: if (rstyle(
|
|
410
|
-
case Property::GridRowEnd: if (rstyle(
|
|
411
|
-
case Property::GridColumnEnd: if (rstyle(
|
|
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 (
|
|
415
|
-
|
|
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
|
-
|
|
457
|
+
style.row_gap = style.column_gap = kUnset;
|
|
418
458
|
#endif
|
|
419
459
|
#if GEA_CSS_PERCENT_GAP
|
|
420
|
-
|
|
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
|
-
|
|
427
|
-
if (
|
|
428
|
-
|
|
429
|
-
|
|
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 (
|
|
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
|
-
|
|
445
|
-
if (
|
|
446
|
-
|
|
447
|
-
|
|
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 (
|
|
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
|
-
|
|
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 (
|
|
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 (
|
|
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(
|
|
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 (
|
|
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(
|
|
482
|
-
rstyleMut(
|
|
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
|
-
|
|
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(
|
|
552
|
+
if (rstyle(style).padding_expression[0] >= 0) { rstyleMut(style).padding_expression[0] = -1; changed = 1; }
|
|
493
553
|
#endif
|
|
494
|
-
if (
|
|
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(
|
|
557
|
+
if (rstyle(style).padding_expression[1] >= 0) { rstyleMut(style).padding_expression[1] = -1; changed = 1; }
|
|
498
558
|
#endif
|
|
499
|
-
if (
|
|
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(
|
|
562
|
+
if (rstyle(style).padding_expression[2] >= 0) { rstyleMut(style).padding_expression[2] = -1; changed = 1; }
|
|
503
563
|
#endif
|
|
504
|
-
if (
|
|
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(
|
|
567
|
+
if (rstyle(style).padding_expression[3] >= 0) { rstyleMut(style).padding_expression[3] = -1; changed = 1; }
|
|
508
568
|
#endif
|
|
509
|
-
if (
|
|
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(
|
|
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
|
-
|
|
581
|
+
changed = 1;
|
|
582
|
+
} break;
|
|
515
583
|
case Property::MarginRight:
|
|
516
584
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
517
|
-
if (rstyle(
|
|
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
|
-
|
|
592
|
+
changed = 1;
|
|
593
|
+
} break;
|
|
520
594
|
case Property::MarginBottom:
|
|
521
595
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
522
|
-
if (rstyle(
|
|
596
|
+
if (rstyle(style).margin_expression[2] >= 0) { rstyleMut(style).margin_expression[2] = -1; changed = 1; }
|
|
523
597
|
#endif
|
|
524
|
-
if (
|
|
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(
|
|
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
|
-
|
|
530
|
-
|
|
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(
|
|
534
|
-
GEA_CSS_POSITION_PX_0(
|
|
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(
|
|
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(
|
|
545
|
-
GEA_CSS_POSITION_PX_1(
|
|
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(
|
|
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(
|
|
556
|
-
GEA_CSS_POSITION_PX_2(
|
|
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(
|
|
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(
|
|
567
|
-
GEA_CSS_POSITION_PX_3(
|
|
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(
|
|
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(
|
|
578
|
-
GEA_CSS_POSITION_PERCENT_0(
|
|
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(
|
|
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(
|
|
589
|
-
GEA_CSS_POSITION_PERCENT_1(
|
|
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(
|
|
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(
|
|
600
|
-
GEA_CSS_POSITION_PERCENT_2(
|
|
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(
|
|
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(
|
|
611
|
-
GEA_CSS_POSITION_PERCENT_3(
|
|
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(
|
|
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 (
|
|
624
|
-
|
|
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 (
|
|
632
|
-
if (
|
|
718
|
+
if (style.bg_color != next) { style.bg_color = next; changed = 1; }
|
|
719
|
+
if (style.bg_alpha != 255) { style.bg_alpha = 255; changed = 1; }
|
|
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 (
|
|
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(
|
|
642
|
-
case Property::BackgroundSizeList: if (rstyle(
|
|
643
|
-
case Property::BackgroundPositionList: if (rstyle(
|
|
644
|
-
case Property::BackgroundRepeatList: if (rstyle(
|
|
645
|
-
case Property::BackgroundAttachmentList: if (rstyle(
|
|
646
|
-
case Property::BackgroundOriginList: if (rstyle(
|
|
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(
|
|
737
|
+
changed = StyleValues::applyBackgroundImage(style, value, node);
|
|
651
738
|
break;
|
|
652
|
-
case Property::HasBackground: if (
|
|
739
|
+
case Property::HasBackground: if (style.has_bg != value) { style.has_bg = value; changed = 1; } break;
|
|
740
|
+
#if GEA_CSS_ACTIVE_BACKGROUND
|
|
653
741
|
case Property::ActiveBackgroundColor: {
|
|
654
742
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
655
|
-
if (
|
|
743
|
+
if (style.active_bg_color != next) { style.active_bg_color = next; changed = 1; }
|
|
656
744
|
break;
|
|
657
745
|
}
|
|
658
|
-
|
|
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 (
|
|
752
|
+
if (style.text_color != next) { style.text_color = next; changed = 1; }
|
|
662
753
|
#if GEA_CSS_TEXT_ALPHA
|
|
663
|
-
if (
|
|
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 (
|
|
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 (
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
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 (
|
|
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 (
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
814
|
+
changed |= setBorderColorBinding(style, -1, false);
|
|
723
815
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
724
|
-
if (
|
|
816
|
+
if (style.border_color != next) { style.border_color = next; changed = 1; }
|
|
725
817
|
#if GEA_CSS_BORDER_ALPHA
|
|
726
|
-
if (
|
|
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(
|
|
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(
|
|
742
|
-
rstyleMut(
|
|
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(
|
|
750
|
-
case Property::BorderBottomWidth: changed |= setComputedBorderWidth(
|
|
751
|
-
case Property::BorderLeftWidth: changed |= setComputedBorderWidth(
|
|
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(
|
|
846
|
+
changed |= setBorderColorBinding(style, 0, false);
|
|
754
847
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
755
|
-
if (rstyle(
|
|
756
|
-
if (rstyle(
|
|
848
|
+
if (rstyle(style).border_side_color[0] != next) { rstyleMut(style).border_side_color[0] = next; changed = 1; }
|
|
849
|
+
if (rstyle(style).border_side_alpha[0] != 255) { rstyleMut(style).border_side_alpha[0] = 255; changed = 1; }
|
|
757
850
|
break;
|
|
758
851
|
}
|
|
759
852
|
case Property::BorderRightColor: {
|
|
760
|
-
changed |= setBorderColorBinding(
|
|
853
|
+
changed |= setBorderColorBinding(style, 1, false);
|
|
761
854
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
762
|
-
if (rstyle(
|
|
763
|
-
if (rstyle(
|
|
855
|
+
if (rstyle(style).border_side_color[1] != next) { rstyleMut(style).border_side_color[1] = next; changed = 1; }
|
|
856
|
+
if (rstyle(style).border_side_alpha[1] != 255) { rstyleMut(style).border_side_alpha[1] = 255; changed = 1; }
|
|
764
857
|
break;
|
|
765
858
|
}
|
|
766
859
|
case Property::BorderBottomColor: {
|
|
767
|
-
changed |= setBorderColorBinding(
|
|
860
|
+
changed |= setBorderColorBinding(style, 2, false);
|
|
768
861
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
769
|
-
if (rstyle(
|
|
770
|
-
if (rstyle(
|
|
862
|
+
if (rstyle(style).border_side_color[2] != next) { rstyleMut(style).border_side_color[2] = next; changed = 1; }
|
|
863
|
+
if (rstyle(style).border_side_alpha[2] != 255) { rstyleMut(style).border_side_alpha[2] = 255; changed = 1; }
|
|
771
864
|
break;
|
|
772
865
|
}
|
|
773
866
|
case Property::BorderLeftColor: {
|
|
774
|
-
changed |= setBorderColorBinding(
|
|
867
|
+
changed |= setBorderColorBinding(style, 3, false);
|
|
775
868
|
style_color_t next = StyleValues::pixelFromStyleValue(value);
|
|
776
|
-
if (rstyle(
|
|
777
|
-
if (rstyle(
|
|
869
|
+
if (rstyle(style).border_side_color[3] != next) { rstyleMut(style).border_side_color[3] = next; changed = 1; }
|
|
870
|
+
if (rstyle(style).border_side_alpha[3] != 255) { rstyleMut(style).border_side_alpha[3] = 255; changed = 1; }
|
|
778
871
|
break;
|
|
779
872
|
}
|
|
780
873
|
#endif
|
|
781
874
|
case Property::BorderRadiusTopLeft:
|
|
782
|
-
if (
|
|
783
|
-
|
|
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
|
-
|
|
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 (
|
|
792
|
-
|
|
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
|
-
|
|
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 (
|
|
801
|
-
|
|
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
|
-
|
|
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 (
|
|
810
|
-
|
|
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
|
-
|
|
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 (
|
|
820
|
-
|
|
821
|
-
|
|
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 (
|
|
827
|
-
|
|
828
|
-
|
|
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 (
|
|
834
|
-
|
|
835
|
-
|
|
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 (
|
|
841
|
-
|
|
842
|
-
|
|
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 (
|
|
848
|
-
case Property::FontSize: if (
|
|
849
|
-
|
|
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
|
-
|
|
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(
|
|
951
|
+
if (rstyle(style).line_height_expression >= 0) { rstyleMut(style).line_height_expression = -1; changed = 1; }
|
|
854
952
|
#endif
|
|
855
|
-
if (
|
|
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
|
-
|
|
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(
|
|
861
|
-
rstyleMut(
|
|
960
|
+
if (rstyle(style).line_height_expression != value || style.line_height != height) {
|
|
961
|
+
rstyleMut(style).line_height_expression = value; style.line_height = height; changed = 1;
|
|
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(
|
|
969
|
+
if (rstyle(style).line_height_expression >= 0) { rstyleMut(style).line_height_expression = -1; changed = 1; }
|
|
869
970
|
#endif
|
|
870
|
-
if (
|
|
871
|
-
|
|
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
|
-
|
|
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 (
|
|
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 (
|
|
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(
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
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,
|
|
909
|
-
if (
|
|
910
|
-
|
|
911
|
-
|
|
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(
|
|
919
|
-
if (
|
|
920
|
-
|
|
921
|
-
|
|
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 (
|
|
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 (
|
|
939
|
-
|
|
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 (
|
|
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(
|
|
953
|
-
case Property::RotateAngle: if (rstyle(
|
|
954
|
-
case Property::RotateAxisX: if (rstyle(
|
|
955
|
-
case Property::RotateAxisY: if (rstyle(
|
|
956
|
-
case Property::RotateAxisZ: if (rstyle(
|
|
957
|
-
case Property::ScaleX: if (rstyle(
|
|
958
|
-
case Property::ScaleY: if (rstyle(
|
|
959
|
-
case Property::ScaleZ: if (rstyle(
|
|
960
|
-
case Property::TranslatePresent: if (rstyle(
|
|
961
|
-
case Property::TranslateX: if (rstyle(
|
|
962
|
-
case Property::TranslateY: if (rstyle(
|
|
963
|
-
case Property::TranslateZ: if (rstyle(
|
|
964
|
-
case Property::TranslateXPercent: if (rstyle(
|
|
965
|
-
case Property::TranslateYPercent: if (rstyle(
|
|
966
|
-
case Property::TransformPresent: if (rstyle(
|
|
967
|
-
case Property::RotatePresent: if (rstyle(
|
|
968
|
-
case Property::ScalePresent: if (rstyle(
|
|
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(
|
|
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(
|
|
976
|
-
rstyleMut(
|
|
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(
|
|
981
|
-
case Property::TransformRotateY: if (rstyle(
|
|
982
|
-
case Property::TransformTranslateX: if (rstyle(
|
|
983
|
-
case Property::TransformTranslateY: if (rstyle(
|
|
984
|
-
case Property::TransformTranslateZ: if (rstyle(
|
|
985
|
-
case Property::TransformTranslateXPercent: if (rstyle(
|
|
986
|
-
case Property::TransformTranslateYPercent: if (rstyle(
|
|
987
|
-
case Property::TransformScaleX: if (rstyle(
|
|
988
|
-
case Property::TransformScaleY: if (rstyle(
|
|
989
|
-
case Property::TransformScaleZ: if (rstyle(
|
|
990
|
-
case Property::TransformOriginX: if (rstyle(
|
|
991
|
-
case Property::TransformOriginY: if (rstyle(
|
|
992
|
-
case Property::Perspective: if (rstyle(
|
|
993
|
-
case Property::PerspectiveOriginX: if (rstyle(
|
|
994
|
-
case Property::PerspectiveOriginY: if (rstyle(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
(
|
|
1072
|
-
(
|
|
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
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
rstyle(
|
|
1094
|
-
rstyle(
|
|
1095
|
-
rstyle(
|
|
1096
|
-
rstyle(
|
|
1097
|
-
previousBgColor !=
|
|
1199
|
+
style.has_bg &&
|
|
1200
|
+
style.bg_alpha == 255 &&
|
|
1201
|
+
style.bg_fill == 0 &&
|
|
1202
|
+
rstyle(style).bg_gradient_has_mid == 0 &&
|
|
1203
|
+
rstyle(style).bg_overlay_gradient == 0 &&
|
|
1204
|
+
rstyle(style).bg_radial_gradient == 0 &&
|
|
1205
|
+
rstyle(style).bg_grid_axes == 0 &&
|
|
1206
|
+
previousBgColor != style.bg_color) {
|
|
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 &&
|
|
1137
|
-
DisplayList::instance().patchNodeAlpha(node, static_cast<uint8_t>(
|
|
1245
|
+
if (stayLocal && prevOpacity < 255 && style.opacity < 255 &&
|
|
1246
|
+
DisplayList::instance().patchNodeAlpha(node, static_cast<uint8_t>(style.opacity)))
|
|
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
|
-
(
|
|
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
|
-
|
|
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
|
-
|
|
1320
|
+
state.nodes[node].resetComputedStyle();
|
|
1212
1321
|
#if GEA_UI_IMAGE_NODES
|
|
1213
1322
|
state.nodes[node].image_id = -1;
|
|
1214
1323
|
#endif
|