@geastack/engine 0.1.21 → 0.1.23

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
@@ -2143,6 +2143,19 @@ static bool isInlineLevelTag(const char *tag)
2143
2143
  std::strcmp(tag, "mark") == 0;
2144
2144
  }
2145
2145
 
2146
+ // Tag ids are interned once and never reused, so the answer per id is fixed:
2147
+ // layout asks for every node on every pass, where the string test is up to 14
2148
+ // strcmps. Layout runs on one core, so the cache needs no lock.
2149
+ static bool isInlineLevelTagId(int16_t id)
2150
+ {
2151
+ static std::vector<std::int8_t> cache;
2152
+ if (id < 0) return isInlineLevelTag(tagFromId(id));
2153
+ const auto index = static_cast<std::size_t>(id);
2154
+ if (index >= cache.size()) cache.resize(index + 16, -1);
2155
+ if (cache[index] < 0) cache[index] = isInlineLevelTag(tagFromId(id)) ? 1 : 0;
2156
+ return cache[index] != 0;
2157
+ }
2158
+
2146
2159
  // Box-tree projection for inline ancestors split by in-flow blocks. The DOM
2147
2160
  // ancestry still owns inheritance, events, relative translation, and painting.
2148
2161
  // Visible inline decorations require fragments; keep those on their own path.
@@ -2150,7 +2163,7 @@ bool splitInlineWrapper(const Node *nodes, int id)
2150
2163
  {
2151
2164
  const Node &n = nodes[id];
2152
2165
  if (n.type != NodeType::View || n.computedStyle().display_explicit || n.computedStyle().display != kDisplayBlock ||
2153
- !isInlineLevelTag(tagFromId(n.tag_id)) || n.computedStyle().float_side || isOutOfFlowPosition(n.computedStyle().position) ||
2166
+ !isInlineLevelTagId(n.tag_id) || n.computedStyle().float_side || isOutOfFlowPosition(n.computedStyle().position) ||
2154
2167
  !FlexLayoutPass::paintsNoBox(n) || boxInsets(n.computedStyle(), true) || boxInsets(n.computedStyle(), false) ||
2155
2168
  n.computedStyle().margin[1] || n.computedStyle().margin[3] || n.computedStyle().opacity != 255 || overflowEstablishesContext(n.computedStyle())) return false;
2156
2169
  bool containsBlock = false;
@@ -2159,7 +2172,7 @@ bool splitInlineWrapper(const Node *nodes, int id)
2159
2172
  if (isLayoutExcluded(child)) continue;
2160
2173
  if (isOutOfFlowPosition(child.computedStyle().position)) return false;
2161
2174
  if (child.computedStyle().float_side) continue;
2162
- if (child.type == NodeType::View && (child.computedStyle().display_explicit || !isInlineLevelTag(tagFromId(child.tag_id)))) containsBlock = true;
2175
+ if (child.type == NodeType::View && (child.computedStyle().display_explicit || !isInlineLevelTagId(child.tag_id))) containsBlock = true;
2163
2176
  if (splitInlineWrapper(nodes, c)) containsBlock = true;
2164
2177
  }
2165
2178
  return containsBlock;
@@ -2416,7 +2429,7 @@ private:
2416
2429
  bool blockBox(const Node &n) const
2417
2430
  {
2418
2431
  return n.type == NodeType::View && !isLayoutExcluded(n) &&
2419
- (n.computedStyle().display_explicit || !isInlineLevelTag(tagFromId(n.tag_id)));
2432
+ (n.computedStyle().display_explicit || !isInlineLevelTagId(n.tag_id));
2420
2433
  }
2421
2434
 
2422
2435
  bool flowChild(int parent, int child) const
@@ -4112,7 +4125,7 @@ bool LayoutEngine::isInlineLevelNode(const Node &n)
4112
4125
  // into one row.
4113
4126
  if (n.computedStyle().margin[0] != 0 || n.computedStyle().margin[2] != 0) return false;
4114
4127
  if (n.type == NodeType::Text || n.type == NodeType::Image) return true;
4115
- return isInlineLevelTag(tagFromId(n.tag_id));
4128
+ return isInlineLevelTagId(n.tag_id);
4116
4129
  }
4117
4130
 
4118
4131
  bool LayoutEngine::isCssInlineLevelBox(const Node &n, bool hypothetical)
@@ -4124,7 +4137,7 @@ bool LayoutEngine::isCssInlineLevelBox(const Node &n, bool hypothetical)
4124
4137
  if (parent.computedStyle().display == kDisplayFlex || isDisplayGrid(parent.computedStyle())) return false;
4125
4138
  }
4126
4139
  if (n.type == NodeType::Text || n.type == NodeType::Image) return true;
4127
- return n.type == NodeType::View && isInlineLevelTag(tagFromId(n.tag_id));
4140
+ return n.type == NodeType::View && isInlineLevelTagId(n.tag_id);
4128
4141
  }
4129
4142
 
4130
4143
  int LayoutEngine::clampSize(int size, int minSize, int maxSize) const
@@ -4457,6 +4470,44 @@ bool LayoutEngine::layoutNodeScoped(int scope, int treeRoot)
4457
4470
  }
4458
4471
  return false;
4459
4472
  };
4473
+ // The scope's proper descendants in node-index order -- the order the
4474
+ // whole-tree scans below used to visit them in, at the cost of the subtree
4475
+ // rather than of every node in the tree (a ticking legend row re-lays
4476
+ // three nodes; scanning all of them, twice, cost more than its layout).
4477
+ constexpr int kMaxScopeDescendants = 64;
4478
+ int descendants[kMaxScopeDescendants];
4479
+ int descendantCount = 0;
4480
+ bool descendantsOverflow = false;
4481
+ {
4482
+ int stack[kMaxScopeDescendants];
4483
+ int depth = 0;
4484
+ for (int child = a.first_child; child >= 0 && child < nodeCount; child = nodes[child].next_sibling) {
4485
+ if (depth == kMaxScopeDescendants) { descendantsOverflow = true; break; }
4486
+ stack[depth++] = child;
4487
+ }
4488
+ while (depth > 0 && !descendantsOverflow) {
4489
+ const int id = stack[--depth];
4490
+ if (descendantCount == kMaxScopeDescendants) { descendantsOverflow = true; break; }
4491
+ descendants[descendantCount++] = id;
4492
+ for (int child = nodes[id].first_child; child >= 0 && child < nodeCount; child = nodes[child].next_sibling) {
4493
+ if (depth == kMaxScopeDescendants) { descendantsOverflow = true; break; }
4494
+ stack[depth++] = child;
4495
+ }
4496
+ }
4497
+ if (!descendantsOverflow) std::sort(descendants, descendants + descendantCount);
4498
+ }
4499
+ // Visits every proper descendant of the scope, in index order.
4500
+ auto forEachDescendant = [&](auto &&visit) {
4501
+ if (!descendantsOverflow) {
4502
+ for (int k = 0; k < descendantCount; ++k)
4503
+ if (!visit(descendants[k])) return;
4504
+ return;
4505
+ }
4506
+ for (int i = 0; i < nodeCount; ++i) {
4507
+ if (i == scope || !inScope(i)) continue;
4508
+ if (!visit(i)) return;
4509
+ }
4510
+ };
4460
4511
 
4461
4512
  // Absolute descendants positioned against a containing block OUTSIDE the
4462
4513
  // scope mix coordinate spaces (the global containing-block pass runs in
@@ -4465,17 +4516,19 @@ bool LayoutEngine::layoutNodeScoped(int scope, int treeRoot)
4465
4516
  // recomputed, and a size change is rejected by the dims check. Testing it
4466
4517
  // here refused every absolutely placed scope (Ember's temperature readout,
4467
4518
  // then its screen), so each tick of a number fell back to a full relayout.
4468
- for (int i = 0; i < nodeCount; ++i) {
4519
+ bool escapes = false;
4520
+ forEachDescendant([&](int i) {
4469
4521
  const Node &n = nodes[i];
4470
- if (i == scope) continue;
4471
- if (n.parent < 0 || !isOutOfFlowPosition(n.computedStyle().position) || isLayoutExcluded(n)) continue;
4472
- if (!inScope(i)) continue;
4522
+ if (n.parent < 0 || !isOutOfFlowPosition(n.computedStyle().position) || isLayoutExcluded(n)) return true;
4473
4523
  const int containing = containingBlockForAbsoluteNode(i, treeRoot, nodes);
4474
4524
  if (containing >= 0 && !inScope(containing)) {
4475
4525
  GEA_REFRESH_PERF(refreshPerfStatsMutable().treeScopedRejectNode = i);
4526
+ escapes = true;
4476
4527
  return false;
4477
4528
  }
4478
- }
4529
+ return true;
4530
+ });
4531
+ if (escapes) return false;
4479
4532
 
4480
4533
  const int prevX = a.layout.x;
4481
4534
  const int prevY = a.layout.y;
@@ -4531,13 +4584,12 @@ bool LayoutEngine::layoutNodeScoped(int scope, int treeRoot)
4531
4584
 
4532
4585
  // Scoped equivalent of the root containing-block pass (both the node and
4533
4586
  // its containing block are inside the scope, in the same relative space).
4534
- for (int i = 0; i < nodeCount; ++i) {
4535
- if (isLayoutExcluded(nodes[i]) || !isOutOfFlowPosition(nodes[i].computedStyle().position) || nodes[i].parent < 0) continue;
4536
- if (!inScope(i) || i == scope) continue;
4587
+ forEachDescendant([&](int i) {
4588
+ if (isLayoutExcluded(nodes[i]) || !isOutOfFlowPosition(nodes[i].computedStyle().position) || nodes[i].parent < 0) return true;
4537
4589
  const int containing = containingBlockForAbsoluteNode(i, scope, nodes);
4538
- if (containing < 0) continue;
4539
- positionAbsoluteNodeInContainingBlock(i, containing, nodes);
4540
- }
4590
+ if (containing >= 0) positionAbsoluteNodeInContainingBlock(i, containing, nodes);
4591
+ return true;
4592
+ });
4541
4593
 
4542
4594
  int childParentX = a.layout.x;
4543
4595
  int childParentY = a.layout.y;
@@ -5,92 +5,108 @@
5
5
 
6
6
  namespace gea::embedded::ui {
7
7
 
8
- void LayoutSnapshot::capture()
8
+ namespace {
9
+
10
+ // One node's half of capture(): its current layout becomes the previous one
11
+ // and its per-frame dirt is cleared.
12
+ void captureNode(int i, bool captureTransforms)
9
13
  {
10
14
  auto &state = treeState();
11
- // Snapshotting previous_transform_* costs ~15 pooled rstyle() reads per node. They
12
- // are ONLY read back when a transform is active (transformedBounds early-outs on
13
- // !anyTransformActive), and anyTransformActive checks both current and previous
14
- // transforms — so for a tree with no transforms (e.g. bouncing-balls) these reads
15
- // are pure per-frame waste and the stale previous_* values are never observed. Skip
16
- // them. The filter snapshot is independent and retained when filters are reachable.
17
- #if GEA_CSS_TRANSFORMS
18
- const bool captureTransforms = ViewRenderer::anyTransformActive();
19
- #endif
20
- for (int i = 0; i < state.nodeCount; i++) {
21
- state.nodes[i].layout.previous_x = state.nodes[i].layout.x;
22
- state.nodes[i].layout.previous_y = state.nodes[i].layout.y;
23
- state.nodes[i].layout.previous_width = state.nodes[i].layout.width;
24
- state.nodes[i].layout.previous_height = state.nodes[i].layout.height;
15
+ (void)captureTransforms;
16
+ state.nodes[i].layout.previous_x = state.nodes[i].layout.x;
17
+ state.nodes[i].layout.previous_y = state.nodes[i].layout.y;
18
+ state.nodes[i].layout.previous_width = state.nodes[i].layout.width;
19
+ state.nodes[i].layout.previous_height = state.nodes[i].layout.height;
25
20
  #if GEA_CSS_SCROLLING
26
- state.nodes[i].layout.previous_scroll_x = state.nodes[i].layout.scroll_x;
27
- state.nodes[i].layout.previous_scroll_y = state.nodes[i].layout.scroll_y;
28
- #endif
29
- // ONE RareStyle pool lookup per node, not ~16 — rstyle() is an out-of-line
30
- // deque index (separate cache line from the node). Per-field lookups here cost
31
- // ~1ms/frame on the spinning css-3d-cube (the "snap" phase); spine read these as
32
- // direct ComputedStyle fields. (Same regression class as the reproject path.)
33
- #if GEA_CSS_TRANSFORMS || GEA_CSS_FILTERS
34
- const RareStyle &rs = rstyle(state.nodes[i].computedStyle());
21
+ state.nodes[i].layout.previous_scroll_x = state.nodes[i].layout.scroll_x;
22
+ state.nodes[i].layout.previous_scroll_y = state.nodes[i].layout.scroll_y;
35
23
  #endif
24
+ // ONE RareStyle pool lookup per node, not ~16 — rstyle() is an out-of-line
25
+ // deque index (separate cache line from the node). Per-field lookups here cost
26
+ // ~1ms/frame on the spinning css-3d-cube (the "snap" phase); spine read these as
27
+ // direct ComputedStyle fields. (Same regression class as the reproject path.)
36
28
  #if GEA_CSS_TRANSFORMS
29
+ // previous_transformable_box is captured with the transforms it qualifies.
30
+ // Every reader ANDs it with a previous transform or perspective, and with
31
+ // no transform active those hold the identity this capture last wrote, so
32
+ // the stale box can't change an answer -- and the per-node box test (a
33
+ // style read) was most of this loop on a transform-free tree.
34
+ if (captureTransforms) {
35
+ const RareStyle &rs = rstyle(state.nodes[i].computedStyle());
37
36
  state.nodes[i].render.previous_transformable_box = ViewRenderer::isTransformableBox(state.nodes[i]);
38
- if (captureTransforms) {
39
- state.nodes[i].render.previous_rotate_angle = rs.rotate_angle;
40
- state.nodes[i].render.previous_rotate_axis_x = rs.rotate_axis_x;
41
- state.nodes[i].render.previous_rotate_axis_y = rs.rotate_axis_y;
42
- state.nodes[i].render.previous_rotate_axis_z = rs.rotate_axis_z;
43
- state.nodes[i].render.previous_scale_x = rs.scale_x;
44
- state.nodes[i].render.previous_scale_y = rs.scale_y;
45
- state.nodes[i].render.previous_scale_z = rs.scale_z;
37
+ state.nodes[i].render.previous_rotate_angle = rs.rotate_angle;
38
+ state.nodes[i].render.previous_rotate_axis_x = rs.rotate_axis_x;
39
+ state.nodes[i].render.previous_rotate_axis_y = rs.rotate_axis_y;
40
+ state.nodes[i].render.previous_rotate_axis_z = rs.rotate_axis_z;
41
+ state.nodes[i].render.previous_scale_x = rs.scale_x;
42
+ state.nodes[i].render.previous_scale_y = rs.scale_y;
43
+ state.nodes[i].render.previous_scale_z = rs.scale_z;
46
44
 
47
- state.nodes[i].render.previous_transform_rotate = rs.transform_rotate;
48
- state.nodes[i].render.previous_transform_rotate_x = rs.transform_rotate_x;
49
- state.nodes[i].render.previous_transform_rotate_y = rs.transform_rotate_y;
50
- state.nodes[i].render.previous_transform_translate_x = composedTranslateX(rs);
51
- state.nodes[i].render.previous_translate_x = rs.translate_x;
52
- state.nodes[i].render.previous_translate_y = rs.translate_y;
53
- state.nodes[i].render.previous_translate_z = rs.translate_z;
54
- state.nodes[i].render.previous_translate_x_percent = rs.translate_x_percent;
55
- state.nodes[i].render.previous_translate_y_percent = rs.translate_y_percent;
56
- state.nodes[i].render.previous_transform_translate_outer_axes = rs.transform_translate_outer_axes;
57
- state.nodes[i].render.previous_transform_translate_y = composedTranslateY(rs);
58
- state.nodes[i].render.previous_transform_translate_z = composedTranslateZ(rs);
59
- state.nodes[i].render.previous_transform_translate_x_percent = composedTranslateXPercent(rs);
60
- state.nodes[i].render.previous_transform_translate_y_percent = composedTranslateYPercent(rs);
61
- state.nodes[i].render.previous_transform_scale_x = rs.transform_scale_x;
62
- state.nodes[i].render.previous_transform_scale_y = rs.transform_scale_y;
63
- state.nodes[i].render.previous_transform_scale_z = rs.transform_scale_z;
64
- state.nodes[i].render.previous_transform_origin_x = rs.transform_origin_x;
65
- state.nodes[i].render.previous_transform_origin_y = rs.transform_origin_y;
66
- state.nodes[i].render.previous_perspective = rs.perspective;
67
- state.nodes[i].render.previous_perspective_origin_x = rs.perspective_origin_x;
68
- state.nodes[i].render.previous_perspective_origin_y = rs.perspective_origin_y;
69
- }
45
+ state.nodes[i].render.previous_transform_rotate = rs.transform_rotate;
46
+ state.nodes[i].render.previous_transform_rotate_x = rs.transform_rotate_x;
47
+ state.nodes[i].render.previous_transform_rotate_y = rs.transform_rotate_y;
48
+ state.nodes[i].render.previous_transform_translate_x = composedTranslateX(rs);
49
+ state.nodes[i].render.previous_translate_x = rs.translate_x;
50
+ state.nodes[i].render.previous_translate_y = rs.translate_y;
51
+ state.nodes[i].render.previous_translate_z = rs.translate_z;
52
+ state.nodes[i].render.previous_translate_x_percent = rs.translate_x_percent;
53
+ state.nodes[i].render.previous_translate_y_percent = rs.translate_y_percent;
54
+ state.nodes[i].render.previous_transform_translate_outer_axes = rs.transform_translate_outer_axes;
55
+ state.nodes[i].render.previous_transform_translate_y = composedTranslateY(rs);
56
+ state.nodes[i].render.previous_transform_translate_z = composedTranslateZ(rs);
57
+ state.nodes[i].render.previous_transform_translate_x_percent = composedTranslateXPercent(rs);
58
+ state.nodes[i].render.previous_transform_translate_y_percent = composedTranslateYPercent(rs);
59
+ state.nodes[i].render.previous_transform_scale_x = rs.transform_scale_x;
60
+ state.nodes[i].render.previous_transform_scale_y = rs.transform_scale_y;
61
+ state.nodes[i].render.previous_transform_scale_z = rs.transform_scale_z;
62
+ state.nodes[i].render.previous_transform_origin_x = rs.transform_origin_x;
63
+ state.nodes[i].render.previous_transform_origin_y = rs.transform_origin_y;
64
+ state.nodes[i].render.previous_perspective = rs.perspective;
65
+ state.nodes[i].render.previous_perspective_origin_x = rs.perspective_origin_x;
66
+ state.nodes[i].render.previous_perspective_origin_y = rs.perspective_origin_y;
67
+ }
70
68
  #endif
71
69
  #if GEA_CSS_FILTERS
72
- state.nodes[i].render.previous_filter_blur_radius = rs.filter_blur_radius;
70
+ state.nodes[i].render.previous_filter_blur_radius = rstyle(state.nodes[i].computedStyle()).filter_blur_radius;
73
71
  #endif
74
- state.nodes[i].render.dirty = 0;
75
- state.nodes[i].render.canvas_pixels_only_dirty = 0;
76
- state.nodes[i].render.layout_dirty = 0;
72
+ state.nodes[i].render.dirty = 0;
73
+ state.nodes[i].render.canvas_pixels_only_dirty = 0;
74
+ state.nodes[i].render.layout_dirty = 0;
77
75
  #if GEA_CSS_SCROLLING
78
- state.nodes[i].render.scroll_dirty = 0;
76
+ state.nodes[i].render.scroll_dirty = 0;
79
77
  #endif
80
78
  #if GEA_CSS_SCROLLING
81
- state.nodes[i].render.non_scroll_dirty = 0;
79
+ state.nodes[i].render.non_scroll_dirty = 0;
82
80
  #endif
83
81
  #if GEA_CSS_TRANSFORMS
84
- state.nodes[i].render.transform_dirty = 0;
82
+ state.nodes[i].render.transform_dirty = 0;
85
83
  #endif
86
- state.nodes[i].render.bg_recolor_pending = 0;
87
- state.nodes[i].render.text_layout_stable = 0;
88
- state.nodes[i].render.text_partial_dirty = 0;
89
- state.nodeCommandDirty[i] = 0;
90
- state.nodeCommandDirtyBoundsValid[i] = 0;
91
- state.nodeCommandDirtyCanOverpaint[i] = 0;
92
- if (state.nodes[i].type == NodeType::VirtualList) VirtualListRenderer::captureSnapshot(i);
93
- }
84
+ state.nodes[i].render.bg_recolor_pending = 0;
85
+ state.nodes[i].render.text_layout_stable = 0;
86
+ state.nodes[i].render.text_partial_dirty = 0;
87
+ state.nodeCommandDirty[i] = 0;
88
+ state.nodeCommandDirtyBoundsValid[i] = 0;
89
+ state.nodeCommandDirtyCanOverpaint[i] = 0;
90
+ if (state.nodes[i].type == NodeType::VirtualList) VirtualListRenderer::captureSnapshot(i);
91
+ }
92
+
93
+ } // namespace
94
+
95
+ void LayoutSnapshot::capture()
96
+ {
97
+ auto &state = treeState();
98
+ // Snapshotting previous_transform_* costs ~15 pooled rstyle() reads per node. They
99
+ // are ONLY read back when a transform is active (transformedBounds early-outs on
100
+ // !anyTransformActive), and anyTransformActive checks both current and previous
101
+ // transforms — so for a tree with no transforms (e.g. bouncing-balls) these reads
102
+ // are pure per-frame waste and the stale previous_* values are never observed. Skip
103
+ // them. The filter snapshot is independent and retained when filters are reachable.
104
+ #if GEA_CSS_TRANSFORMS
105
+ const bool captureTransforms = ViewRenderer::anyTransformActive();
106
+ #else
107
+ constexpr bool captureTransforms = false;
108
+ #endif
109
+ for (int i = 0; i < state.nodeCount; i++) captureNode(i, captureTransforms);
94
110
  #if GEA_CSS_SCROLLING
95
111
  for (int i = 0; i < kScrollDirtyWordCount; i++)
96
112
  state.scrollDirtyNodes[i] = 0;
@@ -105,6 +121,39 @@ void LayoutSnapshot::capture()
105
121
  #endif
106
122
  }
107
123
 
124
+ // capture() for a frame that touched only `ids` and the subtree of `subtreeRoot`
125
+ // (a scroll fast-path frame: no layout ran, so every other node's current and
126
+ // previous layout already agree and its dirt is clear). A pass over every node
127
+ // reads each one from PSRAM: ~2-3 ms of a CrowPanel scroll frame.
128
+ void LayoutSnapshot::captureNodes(const int *ids, int count, int subtreeRoot)
129
+ {
130
+ auto &state = treeState();
131
+ #if GEA_CSS_TRANSFORMS
132
+ if (ViewRenderer::anyTransformActive()) {
133
+ capture();
134
+ return;
135
+ }
136
+ #endif
137
+ constexpr bool captureTransforms = false;
138
+ for (int k = 0; k < count; k++) captureNode(ids[k], captureTransforms);
139
+ const Node *nodes = state.nodes;
140
+ for (int id = subtreeRoot; id >= 0;) {
141
+ captureNode(id, captureTransforms);
142
+ if (nodes[id].first_child >= 0) {
143
+ id = nodes[id].first_child;
144
+ continue;
145
+ }
146
+ while (id != subtreeRoot && nodes[id].next_sibling < 0) id = nodes[id].parent;
147
+ if (id == subtreeRoot) break;
148
+ id = nodes[id].next_sibling;
149
+ }
150
+ #if GEA_CSS_SCROLLING
151
+ for (int i = 0; i < kScrollDirtyWordCount; i++)
152
+ state.scrollDirtyNodes[i] = 0;
153
+ state.scrollDirtyAny = false;
154
+ #endif
155
+ }
156
+
108
157
  void LayoutSnapshot::markChangesDirty()
109
158
  {
110
159
  auto &state = treeState();
@@ -6,6 +6,7 @@ namespace gea::embedded::ui {
6
6
  class LayoutSnapshot {
7
7
  public:
8
8
  static void capture();
9
+ static void captureNodes(const int *ids, int count, int subtreeRoot);
9
10
  static void markChangesDirty();
10
11
  };
11
12
 
package/ui/node_model.h CHANGED
@@ -1357,7 +1357,12 @@ inline bool scrollsOverflowY(const ComputedStyle &style)
1357
1357
  inline bool hasSideBorder(const ComputedStyle &style)
1358
1358
  {
1359
1359
  #if GEA_CSS_SIDE_BORDERS
1360
- if (style.rare_style < 0) return false; // no RareStyle => no per-side borders
1360
+ #if !GEA_EMBEDDED_RARE_STYLE_INLINE
1361
+ // Pooled mode: no entry => no per-side borders. Inline mode never assigns a
1362
+ // handle (the fields live in the style itself), so the guard would drop every
1363
+ // side border there.
1364
+ if (style.rare_style < 0) return false;
1365
+ #endif
1361
1366
  const RareStyle &r = rstyle(style);
1362
1367
  return r.border_side_width[0] > 0 ||
1363
1368
  r.border_side_width[1] > 0 ||