@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/image_node.cpp CHANGED
@@ -19,16 +19,16 @@ class ImageFitResolver {
19
19
  public:
20
20
  static ImageFitRect resolve(const Node &node, int imageWidth, int imageHeight)
21
21
  {
22
- const int contentWidth = node.layout.width - boxInsets(node.style, true);
23
- const int contentHeight = node.layout.height - boxInsets(node.style, false);
22
+ const int contentWidth = node.layout.width - boxInsets(node.computedStyle(), true);
23
+ const int contentHeight = node.layout.height - boxInsets(node.computedStyle(), false);
24
24
  ImageFitRect rect{
25
- node.layout.x + boxInset(node.style, 3),
26
- node.layout.y + boxInset(node.style, 0),
25
+ node.layout.x + boxInset(node.computedStyle(), 3),
26
+ node.layout.y + boxInset(node.computedStyle(), 0),
27
27
  contentWidth,
28
28
  contentHeight,
29
29
  };
30
30
 
31
- if (node.style.image_fit == 1 || node.style.image_fit == 4) {
31
+ if (node.computedStyle().image_fit == 1 || node.computedStyle().image_fit == 4) {
32
32
  const int scaledWidth = (imageWidth * contentHeight) / imageHeight;
33
33
  const int scaledHeight = (imageHeight * contentWidth) / imageWidth;
34
34
  if (scaledWidth <= contentWidth) {
@@ -38,12 +38,12 @@ public:
38
38
  rect.width = contentWidth;
39
39
  rect.height = scaledHeight;
40
40
  }
41
- if (node.style.image_fit == 4 && rect.width >= imageWidth && rect.height >= imageHeight) {
41
+ if (node.computedStyle().image_fit == 4 && rect.width >= imageWidth && rect.height >= imageHeight) {
42
42
  rect.width = imageWidth;
43
43
  rect.height = imageHeight;
44
44
  }
45
45
  center(node, rect);
46
- } else if (node.style.image_fit == 2) {
46
+ } else if (node.computedStyle().image_fit == 2) {
47
47
  const int scaledWidth = (imageWidth * contentHeight) / imageHeight;
48
48
  const int scaledHeight = (imageHeight * contentWidth) / imageWidth;
49
49
  if (scaledWidth >= contentWidth) {
@@ -54,7 +54,7 @@ public:
54
54
  rect.height = scaledHeight;
55
55
  }
56
56
  center(node, rect);
57
- } else if (node.style.image_fit == 3) {
57
+ } else if (node.computedStyle().image_fit == 3) {
58
58
  rect.width = imageWidth;
59
59
  rect.height = imageHeight;
60
60
  center(node, rect);
@@ -66,25 +66,25 @@ public:
66
66
  private:
67
67
  static void center(const Node &node, ImageFitRect &rect)
68
68
  {
69
- rect.x = node.layout.x + boxInset(node.style, 3) + (node.layout.width - boxInsets(node.style, true) - rect.width) / 2;
70
- rect.y = node.layout.y + boxInset(node.style, 0) + (node.layout.height - boxInsets(node.style, false) - rect.height) / 2;
69
+ rect.x = node.layout.x + boxInset(node.computedStyle(), 3) + (node.layout.width - boxInsets(node.computedStyle(), true) - rect.width) / 2;
70
+ rect.y = node.layout.y + boxInset(node.computedStyle(), 0) + (node.layout.height - boxInsets(node.computedStyle(), false) - rect.height) / 2;
71
71
  }
72
72
  };
73
73
 
74
74
  bool hasImageRadius(const Node &node)
75
75
  {
76
- return node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)] > 0 ||
77
- node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)] > 0 ||
78
- node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)] > 0 ||
79
- node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)] > 0;
76
+ return node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(0)] > 0 ||
77
+ node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(1)] > 0 ||
78
+ node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(2)] > 0 ||
79
+ node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(3)] > 0;
80
80
  }
81
81
 
82
82
  void setScaledBlitRadius(DisplayCommand *cmd, const Node &node)
83
83
  {
84
- cmd->scaledBlit.tl = node.style.border_radius[GEA_CSS_RADIUS_INDEX(0)];
85
- cmd->scaledBlit.tr = node.style.border_radius[GEA_CSS_RADIUS_INDEX(1)];
86
- cmd->scaledBlit.br = node.style.border_radius[GEA_CSS_RADIUS_INDEX(2)];
87
- cmd->scaledBlit.bl = node.style.border_radius[GEA_CSS_RADIUS_INDEX(3)];
84
+ cmd->scaledBlit.tl = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(0)];
85
+ cmd->scaledBlit.tr = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(1)];
86
+ cmd->scaledBlit.br = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(2)];
87
+ cmd->scaledBlit.bl = node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(3)];
88
88
  }
89
89
 
90
90
  bool applyAxisAlignedTransform(const Node &node, ImageFitRect &rect)
@@ -112,12 +112,12 @@ void ImageRenderer::layout(int id)
112
112
  int iw = images.width(n->image_id);
113
113
  int ih = images.height(n->image_id);
114
114
 
115
- if (n->style.width == kUnset && n->style.width_percent == kUnset && n->style.width_expression < 0 && iw > 0)
116
- n->layout.width = iw + boxInsets(n->style, true);
117
- if (n->style.height == kUnset && n->style.height_percent == kUnset && n->style.height_expression < 0 && ih > 0)
118
- n->layout.height = ih + boxInsets(n->style, false);
119
- n->layout.width = clampBorderBoxSize(n->style, n->layout.width, true);
120
- n->layout.height = clampBorderBoxSize(n->style, n->layout.height, false);
115
+ if (n->computedStyle().width == kUnset && n->computedStyle().width_percent == kUnset && n->computedStyle().width_expression < 0 && iw > 0)
116
+ n->layout.width = iw + boxInsets(n->computedStyle(), true);
117
+ if (n->computedStyle().height == kUnset && n->computedStyle().height_percent == kUnset && n->computedStyle().height_expression < 0 && ih > 0)
118
+ n->layout.height = ih + boxInsets(n->computedStyle(), false);
119
+ n->layout.width = clampBorderBoxSize(n->computedStyle(), n->layout.width, true);
120
+ n->layout.height = clampBorderBoxSize(n->computedStyle(), n->layout.height, false);
121
121
  }
122
122
 
123
123
  void ImageRenderer::record(const Node &node)
package/ui/input.cpp CHANGED
@@ -128,12 +128,12 @@ public:
128
128
 
129
129
  Node &node = tree.nodes()[activeNodeId];
130
130
  activeTouchNode_ = activeNodeId;
131
- savedBackgroundColor_ = node.style.bg_color;
132
- savedHasBackground_ = node.style.has_bg;
133
- node.style.bg_color = node.style.has_active_bg ? node.style.active_bg_color : lightenRgb565(node.style.bg_color);
134
- node.style.has_bg = 1;
135
- activeBackgroundColor_ = node.style.bg_color;
136
- activeHasBackground_ = node.style.has_bg;
131
+ savedBackgroundColor_ = node.computedStyle().bg_color;
132
+ savedHasBackground_ = node.computedStyle().has_bg;
133
+ node.mutableStyle().bg_color = node.mutableStyle().has_active_bg ? node.mutableStyle().active_bg_color : lightenRgb565(node.mutableStyle().bg_color);
134
+ node.mutableStyle().has_bg = 1;
135
+ activeBackgroundColor_ = node.computedStyle().bg_color;
136
+ activeHasBackground_ = node.computedStyle().has_bg;
137
137
  node.render.dirty = 1; // paint-only: press highlight recolors in place
138
138
  #if GEA_CSS_SCROLLING
139
139
  node.render.non_scroll_dirty = 1;
@@ -281,7 +281,7 @@ public:
281
281
  const int count = tree.nodeCount();
282
282
  for (int id = 0; id < count; ++id) {
283
283
  Node &node = tree.nodes()[id];
284
- if (node.style.display == 1) continue; // display:none
284
+ if (node.computedStyle().display == 1) continue; // display:none
285
285
  if (!nodeCanScrollY(id, node)) continue;
286
286
  const int cur = scrollTop(id);
287
287
  int next = cur + dy;
@@ -443,20 +443,20 @@ private:
443
443
  int hitTestNodeId(int id, int x, int y, bool clipped = false, bool groupRoot = true, bool includePositioned = true)
444
444
  {
445
445
  Node &node = Tree::instance().nodes()[id];
446
- if (node.style.display == 1 || isCollapsedFlexSubtree(node)) return -1;
446
+ if (node.computedStyle().display == 1 || isCollapsedFlexSubtree(node)) return -1;
447
447
  // CSS `pointer-events: none` — this node and its subtree are never the
448
448
  // target of a pointer event, so the hit-test falls through to whatever is
449
449
  // painted behind it. Without this, a decorative overlay image positioned
450
450
  // over interactive controls (e.g. the weather hero art over the city rail)
451
451
  // swallows their clicks. Matches the browser/DOM build, which honors it.
452
- if (node.style.pointer_events == 1) return -1;
452
+ if (node.computedStyle().pointer_events == 1) return -1;
453
453
 
454
454
  const bool inside = pointInsideNodeHitArea(node, x, y);
455
455
  if (LayoutEngine::isViewportFixed(node)) clipped = false;
456
456
  int clipX, clipY, clipW, clipH;
457
457
  overflowClipBounds(node, clipX, clipY, clipW, clipH);
458
458
  const bool outsideClip = x < clipX || y < clipY || x >= clipX + clipW || y >= clipY + clipH;
459
- const bool childClipped = clipped || (outsideClip && node.style.overflow != 0);
459
+ const bool childClipped = clipped || (outsideClip && node.computedStyle().overflow != 0);
460
460
  if (childClipped && (!inside || clipped) && !LayoutEngine::containsViewportFixed(id)) return -1;
461
461
 
462
462
  const auto children = PaintOrder::collectChildren(id, groupRoot, includePositioned);
@@ -465,31 +465,31 @@ private:
465
465
  const Node *nodes = Tree::instance().nodes();
466
466
  for (int p = nodes[*child].parent; p >= 0 && p != id; p = nodes[p].parent) {
467
467
  const auto &ancestor = nodes[p];
468
- if (ancestor.style.pointer_events == 1) ignored = true;
468
+ if (ancestor.computedStyle().pointer_events == 1) ignored = true;
469
469
  int ax, ay, aw, ah;
470
470
  overflowClipBounds(ancestor, ax, ay, aw, ah);
471
- if (ancestor.style.overflow && (x < ax || y < ay || x >= ax + aw || y >= ay + ah)) inheritedClip = true;
471
+ if (ancestor.computedStyle().overflow && (x < ax || y < ay || x >= ax + aw || y >= ay + ah)) inheritedClip = true;
472
472
  }
473
473
  if (ignored) continue;
474
474
  const int result = hitTestNodeId(*child, x, y, inheritedClip, PaintOrder::isGroup(*child), PaintOrder::isContext(*child));
475
475
  if (result >= 0) return result;
476
476
  }
477
477
 
478
- if (!inside || clipped || node.style.visibility != 0) return -1;
478
+ if (!inside || clipped || node.computedStyle().visibility != 0) return -1;
479
479
  return id;
480
480
  }
481
481
 
482
482
  int findScrollNodeId(int id, int x, int y, bool clipped = false, bool groupRoot = true, bool includePositioned = true)
483
483
  {
484
484
  Node &node = Tree::instance().nodes()[id];
485
- if (node.style.display == 1 || isCollapsedFlexSubtree(node)) return -1;
485
+ if (node.computedStyle().display == 1 || isCollapsedFlexSubtree(node)) return -1;
486
486
 
487
487
  const bool inside = pointInsideNodeHitArea(node, x, y);
488
488
  if (LayoutEngine::isViewportFixed(node)) clipped = false;
489
489
  int clipX, clipY, clipW, clipH;
490
490
  overflowClipBounds(node, clipX, clipY, clipW, clipH);
491
491
  const bool outsideClip = x < clipX || y < clipY || x >= clipX + clipW || y >= clipY + clipH;
492
- const bool childClipped = clipped || (outsideClip && node.style.overflow != 0);
492
+ const bool childClipped = clipped || (outsideClip && node.computedStyle().overflow != 0);
493
493
  if (childClipped && (!inside || clipped) && !LayoutEngine::containsViewportFixed(id)) return -1;
494
494
 
495
495
  const auto children = PaintOrder::collectChildren(id, groupRoot, includePositioned);
@@ -501,14 +501,14 @@ private:
501
501
 
502
502
  int ax, ay, aw, ah;
503
503
  overflowClipBounds(ancestor, ax, ay, aw, ah);
504
- if (ancestor.style.overflow && (x < ax || y < ay || x >= ax + aw || y >= ay + ah)) inheritedClip = true;
504
+ if (ancestor.computedStyle().overflow && (x < ax || y < ay || x >= ax + aw || y >= ay + ah)) inheritedClip = true;
505
505
  }
506
506
  if (ignored) continue;
507
507
  const int result = findScrollNodeId(*child, x, y, inheritedClip, PaintOrder::isGroup(*child), PaintOrder::isContext(*child));
508
508
  if (result >= 0) return result;
509
509
  }
510
510
 
511
- if (!inside || clipped || node.style.visibility != 0) return -1;
511
+ if (!inside || clipped || node.computedStyle().visibility != 0) return -1;
512
512
  const bool scrollableVirtualList = node.type == NodeType::VirtualList && VirtualListRenderer::scrollMaxY(id) > 0;
513
513
  const bool scrollableView = node.type != NodeType::VirtualList && isViewLikeNodeType(node.type) &&
514
514
  (nodeCanScrollX(id, node) || nodeCanScrollY(id, node));
@@ -543,13 +543,13 @@ private:
543
543
  static bool nodeCanScrollX(int nodeId, const Node &node)
544
544
  {
545
545
  (void)nodeId;
546
- return node.type != NodeType::VirtualList && scrollsOverflowX(node.style) && ViewRenderer::scrollMaxX(node) > 0;
546
+ return node.type != NodeType::VirtualList && scrollsOverflowX(node.computedStyle()) && ViewRenderer::scrollMaxX(node) > 0;
547
547
  }
548
548
 
549
549
  static bool nodeCanScrollY(int nodeId, const Node &node)
550
550
  {
551
551
  if (node.type == NodeType::VirtualList) return VirtualListRenderer::scrollMaxY(nodeId) > 0;
552
- return scrollsOverflowY(node.style) && ViewRenderer::scrollMaxY(node) > 0;
552
+ return scrollsOverflowY(node.computedStyle()) && ViewRenderer::scrollMaxY(node) > 0;
553
553
  }
554
554
 
555
555
  static bool nodeCanScrollAxis(int nodeId, const Node &node, ScrollAxis axis)
@@ -618,7 +618,7 @@ private:
618
618
  Tree &tree = Tree::instance();
619
619
  for (int current = nodeId; current >= 0 && current < tree.nodeCount(); current = tree.node(current).parent) {
620
620
  const Node &node = tree.node(current);
621
- if (node.style.has_active_bg || (node.style.has_bg && isNativeButtonNodeType(node.type))) return current;
621
+ if (node.computedStyle().has_active_bg || (node.computedStyle().has_bg && isNativeButtonNodeType(node.type))) return current;
622
622
  }
623
623
  return -1;
624
624
  }
@@ -654,11 +654,11 @@ private:
654
654
 
655
655
  Node &node = Tree::instance().node(activeTouchNode_);
656
656
  const bool ownsActiveBackground =
657
- node.style.bg_color == activeBackgroundColor_ &&
658
- node.style.has_bg == activeHasBackground_;
657
+ node.computedStyle().bg_color == activeBackgroundColor_ &&
658
+ node.computedStyle().has_bg == activeHasBackground_;
659
659
  if (ownsActiveBackground) {
660
- node.style.bg_color = savedBackgroundColor_;
661
- node.style.has_bg = savedHasBackground_;
660
+ node.mutableStyle().bg_color = savedBackgroundColor_;
661
+ node.mutableStyle().has_bg = savedHasBackground_;
662
662
  node.render.dirty = 1; // paint-only: press highlight restore
663
663
  #if GEA_CSS_SCROLLING
664
664
  node.render.non_scroll_dirty = 1;
@@ -85,17 +85,17 @@ void InputRenderer::layout(int id, int)
85
85
  if (n.type != NodeType::View) return;
86
86
  if (std::strcmp(tagFromId(n.tag_id), "input") != 0) return;
87
87
 
88
- const char *content = inputContentText(id, nullptr, n.style.text_color);
88
+ const char *content = inputContentText(id, nullptr, n.computedStyle().text_color);
89
89
  const char *measureText = inputMeasureText(id);
90
- int width = TextRenderer::measureWidth(content, n.style.font_id, n.style.font_size, n.style.text_transform) + boxInset(n.style, 1) + boxInset(n.style, 3);
91
- int height = TextRenderer::measureHeight(measureText, n.style.font_id, n.style.font_size, n.style.text_transform, n.style.line_height) + boxInset(n.style, 0) + boxInset(n.style, 2);
92
-
93
- if (n.style.width != kUnset) width = contentSizeToBorderSize(n.style, n.style.width, true);
94
- else if ((n.style.width_percent != kUnset || n.style.width_expression >= 0) && n.layout.width > 0) width = n.layout.width;
95
- if (n.style.height != kUnset) height = contentSizeToBorderSize(n.style, n.style.height, false);
96
- else if ((n.style.height_percent != kUnset || n.style.height_expression >= 0) && n.layout.height > 0) height = n.layout.height;
97
- n.layout.width = clampBorderBoxSize(n.style, width, true);
98
- n.layout.height = clampBorderBoxSize(n.style, height, false);
90
+ int width = TextRenderer::measureWidth(content, n.computedStyle().font_id, n.computedStyle().font_size, n.computedStyle().text_transform) + boxInset(n.computedStyle(), 1) + boxInset(n.computedStyle(), 3);
91
+ int height = TextRenderer::measureHeight(measureText, n.computedStyle().font_id, n.computedStyle().font_size, n.computedStyle().text_transform, n.computedStyle().line_height) + boxInset(n.computedStyle(), 0) + boxInset(n.computedStyle(), 2);
92
+
93
+ if (n.computedStyle().width != kUnset) width = contentSizeToBorderSize(n.computedStyle(), n.computedStyle().width, true);
94
+ else if ((n.computedStyle().width_percent != kUnset || n.computedStyle().width_expression >= 0) && n.layout.width > 0) width = n.layout.width;
95
+ if (n.computedStyle().height != kUnset) height = contentSizeToBorderSize(n.computedStyle(), n.computedStyle().height, false);
96
+ else if ((n.computedStyle().height_percent != kUnset || n.computedStyle().height_expression >= 0) && n.layout.height > 0) height = n.layout.height;
97
+ n.layout.width = clampBorderBoxSize(n.computedStyle(), width, true);
98
+ n.layout.height = clampBorderBoxSize(n.computedStyle(), height, false);
99
99
  #if GEA_CSS_SCROLLING
100
100
  n.layout.scroll_content_height = n.layout.height;
101
101
  n.layout.scroll_y = 0;
@@ -111,17 +111,17 @@ void InputRenderer::record(int id)
111
111
  if (n.type != NodeType::View) return;
112
112
  if (std::strcmp(tagFromId(n.tag_id), "input") != 0) return;
113
113
 
114
- std::uint16_t color = n.style.text_color;
115
- const char *content = inputContentText(id, &color, n.style.text_color);
114
+ std::uint16_t color = n.computedStyle().text_color;
115
+ const char *content = inputContentText(id, &color, n.computedStyle().text_color);
116
116
 
117
117
  const int x = n.layout.x;
118
118
  const int y = n.layout.y;
119
119
  const int w = n.layout.width;
120
120
  const int h = n.layout.height;
121
- const int padLeft = boxInset(n.style, 3);
122
- const int padRight = boxInset(n.style, 1);
123
- const int padTop = boxInset(n.style, 0);
124
- const int padBottom = boxInset(n.style, 2);
121
+ const int padLeft = boxInset(n.computedStyle(), 3);
122
+ const int padRight = boxInset(n.computedStyle(), 1);
123
+ const int padTop = boxInset(n.computedStyle(), 0);
124
+ const int padBottom = boxInset(n.computedStyle(), 2);
125
125
  const int contentX = x + padLeft;
126
126
  const int contentY = y + padTop;
127
127
  int contentW = w - padLeft - padRight;
@@ -136,8 +136,8 @@ void InputRenderer::record(int id)
136
136
  // system rasterizes at font_size directly — but it still needs to
137
137
  // be non-zero to keep the bitmap path's math consistent for callers
138
138
  // without `font-family` set.
139
- const float textScale = n.style.font_size > 0
140
- ? static_cast<float>(n.style.font_size) / 16.0f
139
+ const float textScale = n.computedStyle().font_size > 0
140
+ ? static_cast<float>(n.computedStyle().font_size) / 16.0f
141
141
  : 1.0f;
142
142
 
143
143
  DisplayCommand *cmd = DisplayList::instance().append();
@@ -154,21 +154,21 @@ void InputRenderer::record(int id)
154
154
  // inputs are conventionally one line and the framework's text
155
155
  // renderer would otherwise top-align.
156
156
  // 16 = BitmapFont8x16::kHeight (default when no font_size set).
157
- const int fontSize = n.style.font_size > 0 ? n.style.font_size : 16;
157
+ const int fontSize = n.computedStyle().font_size > 0 ? n.computedStyle().font_size : 16;
158
158
  const int yCenter = contentY + (contentH - fontSize) / 2;
159
159
  cmd->text.y = yCenter > contentY ? yCenter : contentY;
160
160
  cmd->text.maxWidth = contentW;
161
161
  cmd->text.color = color;
162
162
  cmd->text.scale = textScale;
163
- cmd->text.align = n.style.text_align;
164
- cmd->text.textTransform = n.style.text_transform;
165
- cmd->text.lineHeight = n.style.line_height;
163
+ cmd->text.align = n.computedStyle().text_align;
164
+ cmd->text.textTransform = n.computedStyle().text_transform;
165
+ cmd->text.lineHeight = n.computedStyle().line_height;
166
166
  cmd->text.containerWidth = contentW;
167
- cmd->text.fontId = n.style.font_id;
167
+ cmd->text.fontId = n.computedStyle().font_id;
168
168
  // append() hands back uninitialized scratch — set these explicitly so
169
169
  // the deferred draw doesn't read stale white-space/text-overflow.
170
- cmd->text.whiteSpace = n.style.white_space;
171
- cmd->text.textOverflow = n.style.text_overflow;
170
+ cmd->text.whiteSpace = n.computedStyle().white_space;
171
+ cmd->text.textOverflow = n.computedStyle().text_overflow;
172
172
  cmd->text.maxHeight = 0;
173
173
  cmd->text.firstLineIndent = 0;
174
174
  }
@@ -192,14 +192,14 @@ void InputRenderer::record(int id)
192
192
  const bool hasValue = valueAttr && valueAttr[0];
193
193
  int caretX = contentX;
194
194
  if (hasValue) {
195
- const int textWidth = TextRenderer::measureWidth(valueAttr, n.style.font_id, n.style.font_size, n.style.text_transform);
195
+ const int textWidth = TextRenderer::measureWidth(valueAttr, n.computedStyle().font_id, n.computedStyle().font_size, n.computedStyle().text_transform);
196
196
  caretX += textWidth < contentW ? textWidth : contentW - kInputCaretWidth;
197
197
  if (caretX < contentX) caretX = contentX;
198
198
  }
199
199
  const int caretY = contentY + kInputCaretInsetY;
200
200
  int caretH = contentH - kInputCaretInsetY * 2;
201
201
  if (caretH < 4) caretH = contentH > 4 ? contentH - 2 : contentH;
202
- const std::uint16_t caretColor = n.style.text_color ? n.style.text_color : 0xFFFF;
202
+ const std::uint16_t caretColor = n.computedStyle().text_color ? n.computedStyle().text_color : 0xFFFF;
203
203
 
204
204
  DisplayCommand *cmd = DisplayList::instance().append();
205
205
  if (cmd) {
package/ui/internal.h CHANGED
@@ -431,6 +431,28 @@ void rootScrollImageHoldTick();
431
431
  // (LayoutBox::memo_pass). Must be called before each root layoutNode()
432
432
  // so memo hits never leak across passes/frames.
433
433
  void beginLayoutPass();
434
+ void endLayoutPass();
435
+ void invalidateMemo(int id);
436
+ void resetNodeLayoutState(int id);
437
+ void releasePersistentLayoutStorage();
438
+ static std::size_t persistentLayoutStorageBytes();
439
+ static std::size_t persistentLayoutHeapBytes();
440
+ static std::size_t persistentLayoutAllocationCount();
441
+ static std::size_t persistentLayoutPeakBytes();
442
+ static std::size_t persistentLayoutPeakAllocations();
443
+ static std::size_t persistentLayoutStaticBytes();
444
+ static std::size_t memoStorageBytes();
445
+ // ESP: allocator usable bytes, including slack; host: requested payload.
446
+ static std::size_t memoPeakHeapBytes();
447
+ class Pass {
448
+ public:
449
+ explicit Pass(bool active = true) : active_(active) { if (active_) instance().beginLayoutPass(); }
450
+ ~Pass() { if (active_) instance().endLayoutPass(); }
451
+ Pass(const Pass &) = delete;
452
+ Pass &operator=(const Pass &) = delete;
453
+ private:
454
+ bool active_;
455
+ };
434
456
  void layoutNode(int id, int availableWidth, int availableHeight, bool intrinsicBoxEdges = false);
435
457
  // Scoped relayout: re-lays ONLY `scope`'s subtree using the available box
436
458
  // remembered from its last layout, then resolves the subtree's absolute