@geastack/engine 0.1.15 → 0.1.17

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/layout.cpp CHANGED
@@ -209,6 +209,16 @@ public:
209
209
  return lines_ + depth * kMaxFlexLines;
210
210
  }
211
211
 
212
+ // Parallel to a depth's children slice: the width a zero-basis text item
213
+ // measured before applyFlexBasis zeroed it. Allocated on first use only.
214
+ int16_t *measuredWidthsFor(const int *children)
215
+ {
216
+ if (!children_ || !children) return nullptr;
217
+ if (!measuredWidths_) measuredWidths_ = static_cast<int16_t *>(allocate(sizeof(int16_t) * kScratchDepth * kMaxChildren));
218
+ if (!measuredWidths_) return nullptr;
219
+ return measuredWidths_ + (children - children_);
220
+ }
221
+
212
222
  private:
213
223
  static void *allocate(size_t size)
214
224
  {
@@ -218,6 +228,7 @@ private:
218
228
  int depth_ = 0;
219
229
  int *children_ = nullptr;
220
230
  FlexLine *lines_ = nullptr;
231
+ int16_t *measuredWidths_ = nullptr;
221
232
  };
222
233
 
223
234
  class ScratchFrame {
@@ -469,6 +480,28 @@ bool definiteFlexCrossSize(const Node &parent, const Node &child, bool row)
469
480
  (row ? hasExplicitHeight(parent) : hasExplicitWidth(parent));
470
481
  }
471
482
 
483
+ // CSS Flexbox 9.8.1: a single-line container's stretched item has a definite
484
+ // cross size when the container's cross size is definite — and that container
485
+ // may itself be a stretched item. definiteFlexCrossSize() above only accepts an
486
+ // AUTHORED container size, so a `display:flex` row stretched inside an auto-width
487
+ // column, inside a fixed-width app, read as indefinite: its `flex: 1` items kept
488
+ // their max-content width as basis instead of growing from zero (a long todo
489
+ // title overflowed its row). Walks only stretch links; anything else stays
490
+ // conservative (indefinite).
491
+ bool definiteStretchedSize(const Node &node, bool horizontal)
492
+ {
493
+ if (horizontal ? hasExplicitWidth(node) : hasExplicitHeight(node)) return true;
494
+ if (node.parent < 0 || isOutOfFlowPosition(node.computedStyle().position) || intrinsicSizeConstraint(node, horizontal) ||
495
+ isIntrinsicSizeExpression(horizontal ? node.computedStyle().width_expression : node.computedStyle().height_expression)) return false;
496
+ const Node &parent = Tree::instance().nodes()[node.parent];
497
+ if (parent.computedStyle().display != kDisplayFlex) return false;
498
+ const bool parentRow = flexRowDirection(parent.computedStyle()) != (writingMode(parent) != 0);
499
+ if (parentRow == horizontal) return false;
500
+ const int alignment = node.computedStyle().align_self >= 0 ? node.computedStyle().align_self : parent.computedStyle().align_items;
501
+ if (parent.computedStyle().flex_wrap != 0 || alignment != 0 || (node.computedStyle().margin_auto & (parentRow ? 5 : 10))) return false;
502
+ return definiteStretchedSize(parent, horizontal);
503
+ }
504
+
472
505
  void applyPreferredRatio(Node &node, int availableWidth, int availableHeight)
473
506
  {
474
507
  if (!preferredRatio(node) || (node.type != NodeType::View && node.type != NodeType::Image)) return;
@@ -632,7 +665,7 @@ public:
632
665
  engine_.layoutNode(child, childAvailWidth, childAvailHeight);
633
666
  }
634
667
  if (node_.computedStyle().display == kDisplayFlex) {
635
- applyFlexBasis(child);
668
+ applyFlexBasis(i, child);
636
669
  Node &item = Tree::instance().nodes()[child];
637
670
  // A growing item with a zero flex basis (`flex: 1`) starts from zero; its
638
671
  // automatic minimum floors the FINAL flexed size (growFlexChildren), not the
@@ -1293,6 +1326,7 @@ public:
1293
1326
  for (int lineIndex = 0; lineIndex < lineCount; lineIndex++) {
1294
1327
  FlexLine &line = lines_[lineIndex];
1295
1328
  int remaining = mainContentBox - line.mainSize;
1329
+ textReflowed_ = false;
1296
1330
 
1297
1331
  const int totalGrow = totalFlexGrowForLine(line, nodes);
1298
1332
  if (remaining > 0 && totalGrow > 0) {
@@ -1328,6 +1362,12 @@ public:
1328
1362
  if (childNode.computedStyle().flex <= 0) continue;
1329
1363
  const int mainSize = isRow_ ? childNode.layout.width : childNode.layout.height;
1330
1364
  if (mainSize == 0) {
1365
+ if (isRow_ && childNode.type == NodeType::Text) {
1366
+ if (!zeroBasisGrowItem(childNode)) continue;
1367
+ childNode.layout.width = clampInt16(clampFlexMainSize(childNode, textAutomaticMinimum(childNode)));
1368
+ reflowFlexedText(child, childNode, false);
1369
+ continue;
1370
+ }
1331
1371
  const int floor = automaticMinimumMainSize(childNode);
1332
1372
  if (floor > 0) (isRow_ ? childNode.layout.width : childNode.layout.height) = clampInt16(floor);
1333
1373
  engine_.repositionChildren(child);
@@ -1342,7 +1382,10 @@ public:
1342
1382
  measuredCross = std::max(measuredCross, isRow_ ? child.layout.height + child.computedStyle().margin[0] + child.computedStyle().margin[2]
1343
1383
  : child.layout.width + child.computedStyle().margin[1] + child.computedStyle().margin[3]);
1344
1384
  }
1345
- if (node_.computedStyle().display == kDisplayFlex && hasRatio && !definiteCross) {
1385
+ // A re-wrapped text item changes the line's cross size the same way. Only
1386
+ // while this container sizes itself from content: in an assigned pass the
1387
+ // parent already owns its cross size and has placed its siblings.
1388
+ if (node_.computedStyle().display == kDisplayFlex && (hasRatio || (textReflowed_ && !assignedSize_)) && !definiteCross) {
1346
1389
  line.crossSize = std::max(line.strutSize, baselineCrossSize(line.start, line.count, measuredCross));
1347
1390
  ratioCrossChanged = true;
1348
1391
  }
@@ -1480,6 +1523,7 @@ private:
1480
1523
  if (written > start && wrap) finish();
1481
1524
  main += childMain + (written > start ? mainGap_ : 0);
1482
1525
  cross = std::max(cross, childCross);
1526
+ if (measuredWidths_) measuredWidths_[written] = measuredWidths_[i];
1483
1527
  children_[written++] = id;
1484
1528
  }
1485
1529
  finish();
@@ -1517,7 +1561,15 @@ private:
1517
1561
  return count;
1518
1562
  }
1519
1563
 
1564
+ // Constant for the pass (node_, axis and assignedSize_ are fixed), but asked
1565
+ // per item and the stretch walk climbs ancestors: resolve it once.
1520
1566
  int flexPercentageBasis() const
1567
+ {
1568
+ if (percentageBasis_ == kUnresolvedBasis) percentageBasis_ = resolveFlexPercentageBasis();
1569
+ return percentageBasis_;
1570
+ }
1571
+
1572
+ int resolveFlexPercentageBasis() const
1521
1573
  {
1522
1574
  if (isRow_ ? hasExplicitWidth(node_) : hasExplicitHeight(node_)) return mainAvail_;
1523
1575
  // A normal block's automatic inline size fills its containing block.
@@ -1529,7 +1581,7 @@ private:
1529
1581
  const Node &parent = Tree::instance().nodes()[node_.parent];
1530
1582
  if (parent.computedStyle().display == kDisplayFlex) {
1531
1583
  const bool parentRow = flexRowDirection(parent.computedStyle()) != (writingMode(parent) != 0);
1532
- if (isRow_ != parentRow ? definiteFlexCrossSize(parent, node_, parentRow)
1584
+ if (isRow_ != parentRow ? definiteStretchedSize(node_, isRow_)
1533
1585
  : (isRow_ ? hasExplicitWidth(parent) : hasExplicitHeight(parent))) return mainAvail_;
1534
1586
  }
1535
1587
  }
@@ -1540,18 +1592,29 @@ private:
1540
1592
  bool zeroBasisGrowItem(const Node &childNode) const
1541
1593
  {
1542
1594
  if (hasFlexBasis(childNode) || childNode.computedStyle().flex <= 0) return false;
1595
+ if (flexPercentageBasis() < 0) return false;
1543
1596
  return !(isRow_ ? hasExplicitWidth(childNode) : hasExplicitHeight(childNode));
1544
1597
  }
1545
1598
 
1546
- void applyFlexBasis(int child)
1599
+ void applyFlexBasis(int index, int child)
1547
1600
  {
1548
1601
  Node &childNode = Tree::instance().nodes()[child];
1549
1602
  // Authored bases were measured on the physical main axis above. Preserve
1550
1603
  // that result, including content sizing for an indefinite percentage.
1551
1604
  if (hasFlexBasis(childNode)) return;
1552
1605
  if (childNode.computedStyle().flex <= 0) return;
1606
+ // The shorthand's zero percentage basis resolves to content when the
1607
+ // container's main size is indefinite, including auto-height columns.
1608
+ if (flexPercentageBasis() < 0) return;
1553
1609
  if (isRow_) {
1554
1610
  if (hasExplicitWidth(childNode)) return;
1611
+ if (childNode.type == NodeType::Text) {
1612
+ // Keep the width this text just measured (wrapped at mainAvail_):
1613
+ // a final width at least this wide keeps every line break, so the
1614
+ // grow needs no second measurement (reflowFlexedText).
1615
+ if (!measuredWidths_) measuredWidths_ = LayoutScratch::instance().measuredWidthsFor(children_);
1616
+ if (measuredWidths_) measuredWidths_[index] = childNode.layout.width;
1617
+ }
1555
1618
  if (childNode.layout.width == 0) return;
1556
1619
  childNode.layout.width = 0;
1557
1620
  } else {
@@ -1643,21 +1706,20 @@ private:
1643
1706
  {
1644
1707
  if (totalGrow <= 0 || delta <= 0) return;
1645
1708
  int applied = 0;
1646
- int lastGrowChild = -1;
1709
+ int lastGrow = -1;
1710
+ for (int i = 0; i < line.count; i++)
1711
+ if (nodes[children_[line.start + i]].computedStyle().flex > 0) lastGrow = i;
1647
1712
 
1648
- for (int i = 0; i < line.count; i++) {
1713
+ for (int i = 0; i <= lastGrow; i++) {
1649
1714
  const int child = children_[line.start + i];
1650
1715
  Node &childNode = nodes[child];
1651
1716
  if (childNode.computedStyle().flex <= 0) continue;
1652
- lastGrowChild = child;
1653
- const int change = (delta * childNode.computedStyle().flex) / totalGrow;
1654
- applied += applyFlexMainSizeDelta(child, childNode, change);
1655
- }
1656
-
1657
- const int remainder = delta - applied;
1658
- if (remainder > 0 && lastGrowChild >= 0) {
1659
- Node &childNode = nodes[lastGrowChild];
1660
- applyFlexMainSizeDelta(lastGrowChild, childNode, remainder);
1717
+ // The last growing item also takes the integer remainder (and whatever
1718
+ // earlier items could not absorb) in the same resize, so its subtree —
1719
+ // or its text re-wrap — is laid out once, not twice.
1720
+ const int share = (delta * childNode.computedStyle().flex) / totalGrow;
1721
+ const int change = i == lastGrow ? std::max(share, delta - applied) : share;
1722
+ applied += applyFlexMainSizeDelta(child, childNode, change, line.start + i);
1661
1723
  }
1662
1724
  }
1663
1725
 
@@ -1730,13 +1792,54 @@ private:
1730
1792
  return extent;
1731
1793
  }
1732
1794
 
1733
- int applyFlexMainSizeDelta(int child, Node &childNode, int delta)
1795
+ // CSS `min-width: auto` for a row's text item: its MIN-CONTENT width — the
1796
+ // longest unbreakable run ("stopwatch"), never the whole single line. Same
1797
+ // exemptions as automaticMinimumMainSize: an authored min-width replaces it,
1798
+ // a scroll container has none, and max-width caps it.
1799
+ int textAutomaticMinimum(const Node &text) const
1800
+ {
1801
+ const ComputedStyle &style = text.computedStyle();
1802
+ if (style.min_width != kUnset || isScrollableOverflow(overflowX(style))) return 0;
1803
+ int extent = TextRenderer::minContentWidth(text) + boxInsets(style, true);
1804
+ if (style.max_width != kUnset) extent = std::min(extent, contentSizeToBorderSize(style, style.max_width, true));
1805
+ return extent;
1806
+ }
1807
+
1808
+ // A text leaf's height IS its wrapped content height (see
1809
+ // childMainSizeIsShrinkable), so a row that flexes its width must re-wrap
1810
+ // it — once, at the final width. A zero-basis item is also floored at its
1811
+ // min-content width (Flexbox 4.5), checked only when that one measurement
1812
+ // reports an unbreakable run wider than the box. Returns the final width.
1813
+ int reflowFlexedText(int child, Node &text, bool floorAtMinContent, int measuredWidth = -1)
1814
+ {
1815
+ // Wrapping at no less than the measured width (and no more than the width it
1816
+ // was measured against) breaks every line in the same place: the height
1817
+ // stands and min-content <= measured width, so no second measurement.
1818
+ if (measuredWidth >= 0 && text.layout.width >= measuredWidth && text.layout.width <= mainAvail_) return text.layout.width;
1819
+ const int previousHeight = text.layout.height;
1820
+ const int widest = TextRenderer::reflowToBoxWidth(child);
1821
+ if (floorAtMinContent && widest > text.layout.width) {
1822
+ const int floor = textAutomaticMinimum(text);
1823
+ if (floor > text.layout.width) {
1824
+ text.layout.width = clampInt16(floor);
1825
+ TextRenderer::reflowToBoxWidth(child);
1826
+ }
1827
+ }
1828
+ if (text.layout.height != previousHeight) textReflowed_ = true;
1829
+ return text.layout.width;
1830
+ }
1831
+
1832
+ int applyFlexMainSizeDelta(int child, Node &childNode, int delta, int index = -1)
1734
1833
  {
1735
1834
  if (delta == 0) return 0;
1736
1835
  const int before = isRow_ ? childNode.layout.width : childNode.layout.height;
1737
1836
  int after = before + delta;
1738
1837
  after = clampFlexMainSize(childNode, after);
1739
- if (delta > 0 && zeroBasisGrowItem(childNode)) {
1838
+ const bool zeroBasisGrow = delta > 0 && zeroBasisGrowItem(childNode);
1839
+ const bool rowText = isRow_ && childNode.type == NodeType::Text;
1840
+ // A row's text item takes its min-content floor in reflowFlexedText, from
1841
+ // the same measurement that re-wraps it.
1842
+ if (zeroBasisGrow && !rowText) {
1740
1843
  const int autoMin = automaticMinimumMainSize(childNode);
1741
1844
  if (after < autoMin) after = autoMin;
1742
1845
  }
@@ -1750,6 +1853,9 @@ private:
1750
1853
  if (after == before) return 0;
1751
1854
  if (isRow_) childNode.layout.width = after;
1752
1855
  else childNode.layout.height = after;
1856
+ // A grown-from-zero text item may now be narrower than the width it was
1857
+ // measured (and wrapped) at.
1858
+ if (rowText && zeroBasisGrow) after = reflowFlexedText(child, childNode, true, index >= 0 && measuredWidths_ ? measuredWidths_[index] : -1);
1753
1859
  if (preferredRatio(childNode) > 0 && !(isRow_ ? hasExplicitHeight(childNode) : hasExplicitWidth(childNode)) &&
1754
1860
  !definiteFlexCrossSize(node_, childNode, isRow_)) {
1755
1861
  int16_t &cross = isRow_ ? childNode.layout.height : childNode.layout.width;
@@ -1989,6 +2095,13 @@ private:
1989
2095
  std::vector<FlexLine> extraLines_;
1990
2096
  int mainGap_ = 0;
1991
2097
  int crossGap_ = 0;
2098
+ static constexpr int kUnresolvedBasis = INT_MIN;
2099
+ mutable int percentageBasis_ = kUnresolvedBasis;
2100
+ // LayoutScratch slice parallel to children_; see applyFlexBasis.
2101
+ int16_t *measuredWidths_ = nullptr;
2102
+ // Set when flexing a row's text item re-wrapped it to a different height,
2103
+ // so the line's cross size has to be re-derived (see positionLines).
2104
+ bool textReflowed_ = false;
1992
2105
  };
1993
2106
 
1994
2107
  // CSS inline-level classification. Browsers flow inline-level boxes (text,
@@ -72,6 +72,7 @@ void LayoutSnapshot::capture()
72
72
  state.nodes[i].render.previous_filter_blur_radius = rs.filter_blur_radius;
73
73
  #endif
74
74
  state.nodes[i].render.dirty = 0;
75
+ state.nodes[i].render.canvas_pixels_only_dirty = 0;
75
76
  state.nodes[i].render.layout_dirty = 0;
76
77
  #if GEA_CSS_SCROLLING
77
78
  state.nodes[i].render.scroll_dirty = 0;
package/ui/node.h CHANGED
@@ -58,6 +58,10 @@ public:
58
58
  // generated `__gea_type_X __gea_out{};`.
59
59
  NodeHandle() : NodeHandle(-1) {}
60
60
  explicit NodeHandle(int id) : id_(id), nodeType{id} {}
61
+ // Event targets and DOM elements are two views of the same tree identity.
62
+ // Pointer/touch event targets declared as Element therefore project to a
63
+ // full node handle without boxing or losing the source node id.
64
+ NodeHandle(const gea::framework::events::EventTarget &target) : NodeHandle(target.id()) {}
61
65
  // Implicit build from a boxed node value (record carrying "__gea_node_id"),
62
66
  // so the compiled-component emitters' `NodeHandle x = <gea_cpp_value>` copy-
63
67
  // inits and NodeHandle-typed args accept a boxed node. SFINAE'd on
@@ -349,6 +349,12 @@ void Node::resetComputedStyle() { NodeLifecycle::resetStyle(style); }
349
349
 
350
350
  void NodeLifecycle::init(Node *n, NodeType type)
351
351
  {
352
+ #if defined(GEA_NATIVE_DEBUGGER) && GEA_NATIVE_DEBUGGER
353
+ static uint32_t nextDebuggerIdentity = 0;
354
+ // Two protocol ids per native node (element and optional text child).
355
+ if (nextDebuggerIdentity >= 0x3fffffff) std::abort();
356
+ n->debugger_identity = ++nextDebuggerIdentity;
357
+ #endif
352
358
  n->type = type;
353
359
  #if GEA_EMBEDDED_SHARED_STYLES && !GEA_CSS_CUSTOM_PROPERTIES
354
360
  n->class_style_tracked = false;
@@ -421,6 +427,7 @@ void NodeLifecycle::init(Node *n, NodeType type)
421
427
  #endif
422
428
  n->render.inline_baseline = 0;
423
429
  n->render.dirty = 0;
430
+ n->render.canvas_pixels_only_dirty = 0;
424
431
  #if GEA_CSS_SCROLLING
425
432
  n->render.scroll_dirty = 0;
426
433
  #endif
package/ui/node_model.h CHANGED
@@ -36,6 +36,21 @@ inline constexpr int kMaxNodes = GEA_EMBEDDED_MAX_NODES;
36
36
  inline constexpr int kUnset = -32768;
37
37
  // Internal value carrier for CSS z-index:auto; numeric stack levels stay int16.
38
38
  inline constexpr int kZIndexAuto = INT32_MIN;
39
+ // Origins keep percentage permille values unchanged; absolute pixel lengths
40
+ // occupy a tagged range outside the former int16 representation.
41
+ inline constexpr int kAbsoluteOriginTag = 1 << 30;
42
+
43
+ inline int absoluteOriginPixels(int pixels)
44
+ {
45
+ return kAbsoluteOriginTag + std::clamp(pixels, -(1 << 29), (1 << 29) - 1);
46
+ }
47
+
48
+ inline float resolveOriginOffset(int origin, int extent)
49
+ {
50
+ return origin >= (1 << 29) ? static_cast<float>(origin - kAbsoluteOriginTag)
51
+ : static_cast<float>(extent) * origin * 0.001f;
52
+ }
53
+
39
54
  // Dimension expression slots use nonnegative values for pooled expressions,
40
55
  // -1 for no expression, and these tags for intrinsic sizing keywords.
41
56
  inline constexpr int kSizeMinContent = -2;
@@ -248,11 +263,11 @@ struct RareStyle {
248
263
  int16_t transform_scale_x = 1000;
249
264
  int16_t transform_scale_y = 1000;
250
265
  int16_t transform_scale_z = 1000;
251
- int16_t transform_origin_x = 500;
252
- int16_t transform_origin_y = 500;
266
+ int32_t transform_origin_x = 500;
267
+ int32_t transform_origin_y = 500;
253
268
  int16_t perspective = 0;
254
- int16_t perspective_origin_x = 500;
255
- int16_t perspective_origin_y = 500;
269
+ int32_t perspective_origin_x = 500;
270
+ int32_t perspective_origin_y = 500;
256
271
 
257
272
  #else
258
273
  static constexpr uint8_t transform_present = 0;
@@ -277,11 +292,11 @@ struct RareStyle {
277
292
  static constexpr int16_t transform_scale_x = 1000;
278
293
  static constexpr int16_t transform_scale_y = 1000;
279
294
  static constexpr int16_t transform_scale_z = 1000;
280
- static constexpr int16_t transform_origin_x = 500;
281
- static constexpr int16_t transform_origin_y = 500;
295
+ static constexpr int32_t transform_origin_x = 500;
296
+ static constexpr int32_t transform_origin_y = 500;
282
297
  static constexpr int16_t perspective = 0;
283
- static constexpr int16_t perspective_origin_x = 500;
284
- static constexpr int16_t perspective_origin_y = 500;
298
+ static constexpr int32_t perspective_origin_x = 500;
299
+ static constexpr int32_t perspective_origin_y = 500;
285
300
  #endif
286
301
  #if GEA_CSS_FILTERS
287
302
  uint8_t filter_present = 0;
@@ -1421,11 +1436,11 @@ struct RenderState {
1421
1436
  int16_t previous_transform_scale_x;
1422
1437
  int16_t previous_transform_scale_y;
1423
1438
  int16_t previous_transform_scale_z;
1424
- int16_t previous_transform_origin_x;
1425
- int16_t previous_transform_origin_y;
1439
+ int32_t previous_transform_origin_x;
1440
+ int32_t previous_transform_origin_y;
1426
1441
  int16_t previous_perspective;
1427
- int16_t previous_perspective_origin_x;
1428
- int16_t previous_perspective_origin_y;
1442
+ int32_t previous_perspective_origin_x;
1443
+ int32_t previous_perspective_origin_y;
1429
1444
  uint8_t previous_transformable_box;
1430
1445
  #else
1431
1446
  static constexpr int16_t previous_rotate_angle = 0;
@@ -1452,11 +1467,11 @@ struct RenderState {
1452
1467
  static constexpr int16_t previous_transform_scale_x = 1000;
1453
1468
  static constexpr int16_t previous_transform_scale_y = 1000;
1454
1469
  static constexpr int16_t previous_transform_scale_z = 1000;
1455
- static constexpr int16_t previous_transform_origin_x = 500;
1456
- static constexpr int16_t previous_transform_origin_y = 500;
1470
+ static constexpr int32_t previous_transform_origin_x = 500;
1471
+ static constexpr int32_t previous_transform_origin_y = 500;
1457
1472
  static constexpr int16_t previous_perspective = 0;
1458
- static constexpr int16_t previous_perspective_origin_x = 500;
1459
- static constexpr int16_t previous_perspective_origin_y = 500;
1473
+ static constexpr int32_t previous_perspective_origin_x = 500;
1474
+ static constexpr int32_t previous_perspective_origin_y = 500;
1460
1475
  static constexpr uint8_t previous_transformable_box = 0;
1461
1476
  #endif
1462
1477
  #if GEA_CSS_FILTERS
@@ -1466,6 +1481,8 @@ struct RenderState {
1466
1481
  #endif
1467
1482
 
1468
1483
  uint8_t dirty : 1;
1484
+ // Only owned canvas pixels changed; style and geometry invalidation clear this.
1485
+ uint8_t canvas_pixels_only_dirty : 1;
1469
1486
  #if GEA_CSS_SCROLLING
1470
1487
  uint8_t scroll_dirty : 1;
1471
1488
  #else
@@ -1556,6 +1573,11 @@ public:
1556
1573
  #endif
1557
1574
 
1558
1575
  struct Node {
1576
+ #if defined(GEA_NATIVE_DEBUGGER) && GEA_NATIVE_DEBUGGER
1577
+ // Debug-only lifetime identity: recycled engine slots must never retarget
1578
+ // a DevTools node handle. Production node size is unchanged.
1579
+ uint32_t debugger_identity = 0;
1580
+ #endif
1559
1581
  #if GEA_EMBEDDED_SHARED_STYLES
1560
1582
  NodeStyleStorage sharedStyle_;
1561
1583
  // Group the four-byte ownership handles before the two-byte fields.