@geastack/engine 0.1.6 → 0.1.7
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/README.md +70 -0
- package/canvas.cpp +52 -30
- package/css/declarative.h +6 -0
- package/css/engine.h +19 -0
- package/image_store.cpp +136 -33
- package/package.json +2 -2
- package/ui/CSS_FEATURES.md +261 -0
- package/ui/absolute_leaf_refresh.cpp +15 -13
- package/ui/core.cpp +23 -0
- package/ui/css_atom.cpp +6 -0
- package/ui/css_atom.h +2 -0
- package/ui/css_features.h +282 -0
- package/ui/image_node.cpp +9 -8
- package/ui/input.cpp +22 -2
- package/ui/input_render.cpp +4 -0
- package/ui/layout.cpp +171 -83
- package/ui/layout_snapshot.cpp +28 -1
- package/ui/node_features.h +18 -0
- package/ui/node_lifecycle.cpp +192 -84
- package/ui/node_lifecycle.h +1 -0
- package/ui/node_model.h +631 -71
- package/ui/node_text.h +82 -0
- package/ui/render.cpp +155 -87
- package/ui/renderer_features.h +19 -0
- package/ui/root_scroll_refresh.cpp +31 -14
- package/ui/style.cpp +991 -228
- package/ui/text.cpp +24 -4
- package/ui/tree_events.cpp +135 -95
- package/ui/tree_events.h +28 -20
- package/ui/tree_inspection.h +15 -0
- package/ui/tree_nodes.cpp +32 -4
- package/ui/tree_render.cpp +48 -19
- package/ui/tree_scroll_mirror.cpp +26 -0
- package/ui/tree_state.cpp +261 -114
- package/ui/tree_state.h +69 -18
- package/ui/tree_style.cpp +339 -72
- package/ui/view.cpp +122 -62
- package/ui/virtual_keyboard.cpp +10 -3
package/ui/tree_nodes.cpp
CHANGED
|
@@ -104,7 +104,9 @@ void resetNodeSlot(TreeState &state, int id)
|
|
|
104
104
|
// gap before the next record reads freed memory.
|
|
105
105
|
if (!state.nodes[id].text.empty()) DisplayList::instance().scrubNodeText(state.nodes[id].text.c_str());
|
|
106
106
|
releaseRareData(id); // frees the rare-data block: attributes, listeners, custom props, virtual-list
|
|
107
|
+
#if GEA_CSS_RARE_STYLE
|
|
107
108
|
releaseRareStyle(state.nodes[id].style.rare_style); // frees the cold-style block
|
|
109
|
+
#endif
|
|
108
110
|
state.classLists[id].clear();
|
|
109
111
|
state.canvases.remove(id);
|
|
110
112
|
state.nodeCommandDirty[id] = 0;
|
|
@@ -134,8 +136,8 @@ bool localAbsoluteLeafTreeMutation(const TreeState &state, int child)
|
|
|
134
136
|
if (node.first_child >= 0) return false;
|
|
135
137
|
if (node.type == NodeType::Text || node.type == NodeType::Canvas || node.type == NodeType::VirtualList) return false;
|
|
136
138
|
if (!isViewLikeNodeType(node.type) && node.type != NodeType::Image) return false;
|
|
137
|
-
if (rstyle(node.style).filter_blur_radius > 0 || node.style.mask_right_fade_width > 0) return false;
|
|
138
|
-
if (rstyle(node.style).box_shadow_alpha > 0) return false;
|
|
139
|
+
if ((GEA_CSS_FILTERS ? rstyle(node.style).filter_blur_radius : 0) > 0 || node.style.mask_right_fade_width > 0) return false;
|
|
140
|
+
if ((GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_alpha : 0) > 0) return false;
|
|
139
141
|
return true;
|
|
140
142
|
}
|
|
141
143
|
|
|
@@ -184,9 +186,11 @@ void Tree::clear()
|
|
|
184
186
|
std::memset(state.nodeCommandDirty, 0, sizeof(state.nodeCommandDirty));
|
|
185
187
|
std::memset(state.nodeCommandDirtyBoundsValid, 0, sizeof(state.nodeCommandDirtyBoundsValid));
|
|
186
188
|
std::memset(state.nodeCommandDirtyCanOverpaint, 0, sizeof(state.nodeCommandDirtyCanOverpaint));
|
|
189
|
+
#if GEA_CSS_SCROLLING
|
|
187
190
|
std::memset(state.scrollDirtyNodes, 0, sizeof(state.scrollDirtyNodes));
|
|
188
191
|
state.scrollDirtyAny = false;
|
|
189
192
|
state.pendingScrollIntoViewNode = -1;
|
|
193
|
+
#endif
|
|
190
194
|
// Drop display-list commands and growable render scratch from the previous app.
|
|
191
195
|
// Per-frame DisplayList::clear() keeps capacity for reuse; app/tree reset is the
|
|
192
196
|
// point where a large app should stop poisoning a smaller app's memory shape.
|
|
@@ -243,15 +247,19 @@ int Tree::cloneNode(int sourceId, bool deep)
|
|
|
243
247
|
clone.style = source.style;
|
|
244
248
|
// clone.style copied source's rare_style HANDLE (shared pool entry). Give the
|
|
245
249
|
// clone its own entry with the same contents, so mutating one never aliases.
|
|
250
|
+
#if GEA_CSS_RARE_STYLE
|
|
246
251
|
clone.style.rare_style = -1;
|
|
247
252
|
if (source.style.rare_style >= 0) rstyleMut(clone.style) = rstyle(source.style);
|
|
253
|
+
#endif
|
|
248
254
|
clone.text = source.text;
|
|
255
|
+
#if GEA_UI_IMAGE_NODES
|
|
249
256
|
clone.image_id = source.image_id;
|
|
257
|
+
#endif
|
|
250
258
|
clone.tag_id = source.tag_id; // interned tag id — just copy the handle
|
|
251
259
|
// Copy attributes + custom properties (DOM cloneNode semantics) but NOT
|
|
252
260
|
// listeners or virtual-list state. All live in the rare-data block; allocate
|
|
253
|
-
// one for the clone only if the source has any. (rareDataFor returns
|
|
254
|
-
//
|
|
261
|
+
// one for the clone only if the source has any. (rareDataFor returns an owned
|
|
262
|
+
// record whose address is stable across the ensureRareData growth below, so
|
|
255
263
|
// srcRd stays valid.)
|
|
256
264
|
if (const NodeRareData *srcRd = rareDataFor(sourceId)) {
|
|
257
265
|
NodeRareData &cloneRd = ensureRareData(id);
|
|
@@ -260,9 +268,11 @@ int Tree::cloneNode(int sourceId, bool deep)
|
|
|
260
268
|
cloneRd.defaultStyles = srcRd->defaultStyles;
|
|
261
269
|
cloneRd.inlineStyles = srcRd->inlineStyles;
|
|
262
270
|
cloneRd.inlineCustomProperties = srcRd->inlineCustomProperties;
|
|
271
|
+
#if GEA_CSS_GRID
|
|
263
272
|
cloneRd.inlineGridTemplates[0] = srcRd->inlineGridTemplates[0];
|
|
264
273
|
cloneRd.inlineGridTemplates[1] = srcRd->inlineGridTemplates[1];
|
|
265
274
|
cloneRd.inlineGridShorthandMask = srcRd->inlineGridShorthandMask;
|
|
275
|
+
#endif
|
|
266
276
|
}
|
|
267
277
|
state.classLists[id] = state.classLists[sourceId];
|
|
268
278
|
// Listeners deliberately NOT copied (DOM cloneNode semantics) — compiled
|
|
@@ -466,7 +476,9 @@ void Tree::markCanvasDirty(int id)
|
|
|
466
476
|
if (surface && surface->displayBacked()) return;
|
|
467
477
|
state.nodes[id].render.dirty = 1;
|
|
468
478
|
state.nodes[id].render.layout_dirty = 1;
|
|
479
|
+
#if GEA_CSS_SCROLLING
|
|
469
480
|
state.nodes[id].render.non_scroll_dirty = 1;
|
|
481
|
+
#endif
|
|
470
482
|
// Content-only repaint: the canvas's BlitImage command is unchanged frame
|
|
471
483
|
// to frame (same surface pointer, same rect) — only the pixels it points
|
|
472
484
|
// at were redrawn. The in-place refresh path re-records and emits a flush
|
|
@@ -513,7 +525,9 @@ void Tree::setParent(int child, int parent)
|
|
|
513
525
|
if (!localMutation) {
|
|
514
526
|
old_parent->render.dirty = 1;
|
|
515
527
|
old_parent->render.layout_dirty = 1;
|
|
528
|
+
#if GEA_CSS_SCROLLING
|
|
516
529
|
old_parent->render.non_scroll_dirty = 1;
|
|
530
|
+
#endif
|
|
517
531
|
}
|
|
518
532
|
}
|
|
519
533
|
if (c->prev_sibling >= 0) state.nodes[c->prev_sibling].next_sibling = c->next_sibling;
|
|
@@ -530,11 +544,15 @@ void Tree::setParent(int child, int parent)
|
|
|
530
544
|
if (!localMutation) {
|
|
531
545
|
state.nodes[parent].render.dirty = 1;
|
|
532
546
|
state.nodes[parent].render.layout_dirty = 1;
|
|
547
|
+
#if GEA_CSS_SCROLLING
|
|
533
548
|
state.nodes[parent].render.non_scroll_dirty = 1;
|
|
549
|
+
#endif
|
|
534
550
|
}
|
|
535
551
|
c->render.dirty = 1;
|
|
536
552
|
c->render.layout_dirty = 1;
|
|
553
|
+
#if GEA_CSS_SCROLLING
|
|
537
554
|
c->render.non_scroll_dirty = 1;
|
|
555
|
+
#endif
|
|
538
556
|
if (localMutation)
|
|
539
557
|
markDisplayListContentDirty();
|
|
540
558
|
else
|
|
@@ -566,7 +584,9 @@ void Tree::insertBefore(int child, int parent, int reference)
|
|
|
566
584
|
if (!localMutation) {
|
|
567
585
|
old_parent->render.dirty = 1;
|
|
568
586
|
old_parent->render.layout_dirty = 1;
|
|
587
|
+
#if GEA_CSS_SCROLLING
|
|
569
588
|
old_parent->render.non_scroll_dirty = 1;
|
|
589
|
+
#endif
|
|
570
590
|
}
|
|
571
591
|
}
|
|
572
592
|
if (c->prev_sibling >= 0) state.nodes[c->prev_sibling].next_sibling = c->next_sibling;
|
|
@@ -585,11 +605,15 @@ void Tree::insertBefore(int child, int parent, int reference)
|
|
|
585
605
|
if (!localMutation) {
|
|
586
606
|
state.nodes[parent].render.dirty = 1;
|
|
587
607
|
state.nodes[parent].render.layout_dirty = 1;
|
|
608
|
+
#if GEA_CSS_SCROLLING
|
|
588
609
|
state.nodes[parent].render.non_scroll_dirty = 1;
|
|
610
|
+
#endif
|
|
589
611
|
}
|
|
590
612
|
c->render.dirty = 1;
|
|
591
613
|
c->render.layout_dirty = 1;
|
|
614
|
+
#if GEA_CSS_SCROLLING
|
|
592
615
|
c->render.non_scroll_dirty = 1;
|
|
616
|
+
#endif
|
|
593
617
|
if (localMutation)
|
|
594
618
|
markDisplayListContentDirty();
|
|
595
619
|
else
|
|
@@ -610,12 +634,16 @@ void Tree::removeNode(int id)
|
|
|
610
634
|
markDisplayListDirty();
|
|
611
635
|
n->render.dirty = 1;
|
|
612
636
|
n->render.layout_dirty = 1;
|
|
637
|
+
#if GEA_CSS_SCROLLING
|
|
613
638
|
n->render.non_scroll_dirty = 1;
|
|
639
|
+
#endif
|
|
614
640
|
if (n->parent >= 0) {
|
|
615
641
|
Node *p = &state.nodes[n->parent];
|
|
616
642
|
p->render.dirty = 1;
|
|
617
643
|
p->render.layout_dirty = 1;
|
|
644
|
+
#if GEA_CSS_SCROLLING
|
|
618
645
|
p->render.non_scroll_dirty = 1;
|
|
646
|
+
#endif
|
|
619
647
|
if (p->first_child == id) p->first_child = n->next_sibling;
|
|
620
648
|
if (p->last_child == id) p->last_child = n->prev_sibling;
|
|
621
649
|
}
|
package/ui/tree_render.cpp
CHANGED
|
@@ -135,6 +135,7 @@ namespace gea::embedded::ui
|
|
|
135
135
|
}
|
|
136
136
|
#endif
|
|
137
137
|
|
|
138
|
+
#if GEA_CSS_SCROLLING
|
|
138
139
|
struct PreservedScrollOffset
|
|
139
140
|
{
|
|
140
141
|
int32_t x = 0;
|
|
@@ -213,6 +214,8 @@ namespace gea::embedded::ui
|
|
|
213
214
|
}
|
|
214
215
|
}
|
|
215
216
|
|
|
217
|
+
#endif
|
|
218
|
+
|
|
216
219
|
int dirtyRectArea(const DirtyRegions::Rect &r)
|
|
217
220
|
{
|
|
218
221
|
if (r.x0 > r.x1 || r.y0 > r.y1)
|
|
@@ -244,10 +247,12 @@ namespace gea::embedded::ui
|
|
|
244
247
|
{
|
|
245
248
|
for (int i = 0; i < 4; ++i)
|
|
246
249
|
{
|
|
247
|
-
if (style.border_radius[i] > 0)
|
|
250
|
+
if (style.border_radius[GEA_CSS_RADIUS_INDEX(i)] > 0)
|
|
248
251
|
return true;
|
|
249
|
-
|
|
252
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
253
|
+
if (style.border_radius_percent[GEA_CSS_RADIUS_INDEX(i)] != kUnset && style.border_radius_percent[GEA_CSS_RADIUS_INDEX(i)] > 0)
|
|
250
254
|
return true;
|
|
255
|
+
#endif
|
|
251
256
|
}
|
|
252
257
|
return false;
|
|
253
258
|
}
|
|
@@ -256,11 +261,11 @@ namespace gea::embedded::ui
|
|
|
256
261
|
{
|
|
257
262
|
if (hasAnyBorder(node.style))
|
|
258
263
|
return true;
|
|
259
|
-
if (rstyle(node.style).filter_blur_radius > 0 || node.render.previous_filter_blur_radius > 0)
|
|
264
|
+
if ((GEA_CSS_FILTERS ? rstyle(node.style).filter_blur_radius : 0) > 0 || node.render.previous_filter_blur_radius > 0)
|
|
260
265
|
return true;
|
|
261
266
|
if (node.style.mask_right_fade_width > 0)
|
|
262
267
|
return true;
|
|
263
|
-
if (rstyle(node.style).box_shadow_alpha > 0)
|
|
268
|
+
if ((GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_alpha : 0) > 0)
|
|
264
269
|
return true;
|
|
265
270
|
return node.style.has_bg && (styleHasRoundedRasterEdge(node.style) || node.style.bg_alpha < 255);
|
|
266
271
|
}
|
|
@@ -510,15 +515,17 @@ namespace gea::embedded::ui
|
|
|
510
515
|
double ry[4]{};
|
|
511
516
|
for (int i = 0; i < 4; ++i)
|
|
512
517
|
{
|
|
513
|
-
|
|
518
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
519
|
+
if (node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(i)] != kUnset)
|
|
514
520
|
{
|
|
515
|
-
const double p = static_cast<double>(node.style.border_radius_percent[i]) / 1000.0;
|
|
521
|
+
const double p = static_cast<double>(node.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(i)]) / 1000.0;
|
|
516
522
|
rx[i] = std::max(0.0, width * p);
|
|
517
523
|
ry[i] = std::max(0.0, height * p);
|
|
518
524
|
}
|
|
519
525
|
else
|
|
526
|
+
#endif
|
|
520
527
|
{
|
|
521
|
-
const double r = static_cast<double>(std::max(0, static_cast<int>(node.style.border_radius[i])));
|
|
528
|
+
const double r = static_cast<double>(std::max(0, static_cast<int>(node.style.border_radius[GEA_CSS_RADIUS_INDEX(i)])));
|
|
522
529
|
rx[i] = r;
|
|
523
530
|
ry[i] = r;
|
|
524
531
|
}
|
|
@@ -646,7 +653,7 @@ namespace gea::embedded::ui
|
|
|
646
653
|
return true;
|
|
647
654
|
if (node.style.has_bg || hasAnyBorder(node.style))
|
|
648
655
|
return true;
|
|
649
|
-
if (rstyle(node.style).box_shadow_alpha > 0 || rstyle(node.style).filter_blur_radius > 0)
|
|
656
|
+
if ((GEA_CSS_BOX_SHADOW ? rstyle(node.style).box_shadow_alpha : 0) > 0 || (GEA_CSS_FILTERS ? rstyle(node.style).filter_blur_radius : 0) > 0)
|
|
650
657
|
return true;
|
|
651
658
|
if (node.style.mask_right_fade_width > 0)
|
|
652
659
|
return true;
|
|
@@ -905,7 +912,7 @@ namespace gea::embedded::ui
|
|
|
905
912
|
|
|
906
913
|
int filterBlurRadiusForNode(const Node &node, bool usePrevious)
|
|
907
914
|
{
|
|
908
|
-
return usePrevious ? node.render.previous_filter_blur_radius : rstyle(node.style).filter_blur_radius;
|
|
915
|
+
return usePrevious ? node.render.previous_filter_blur_radius : (GEA_CSS_FILTERS ? rstyle(node.style).filter_blur_radius : 0);
|
|
909
916
|
}
|
|
910
917
|
|
|
911
918
|
DirtyRegions::Rect filterBlurBoundsRect(const Node &node, bool usePrevious, int origin)
|
|
@@ -1205,18 +1212,20 @@ namespace gea::embedded::ui
|
|
|
1205
1212
|
return false;
|
|
1206
1213
|
for (int r = 0; r < 4; r++)
|
|
1207
1214
|
{
|
|
1208
|
-
if (n.style.border_radius[r] != 0)
|
|
1215
|
+
if (n.style.border_radius[GEA_CSS_RADIUS_INDEX(r)] != 0)
|
|
1209
1216
|
return false;
|
|
1210
|
-
|
|
1217
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
1218
|
+
if (n.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(r)] != kUnset && n.style.border_radius_percent[GEA_CSS_RADIUS_INDEX(r)] != 0)
|
|
1211
1219
|
return false;
|
|
1220
|
+
#endif
|
|
1212
1221
|
}
|
|
1213
|
-
if (rstyle(n.style).filter_blur_radius > 0)
|
|
1222
|
+
if ((GEA_CSS_FILTERS ? rstyle(n.style).filter_blur_radius : 0) > 0)
|
|
1214
1223
|
return false;
|
|
1215
1224
|
if (n.style.mask_right_fade_width > 0)
|
|
1216
1225
|
return false;
|
|
1217
|
-
if (rstyle(n.style).box_shadow_alpha > 0 &&
|
|
1218
|
-
(rstyle(n.style).box_shadow_offset_x != 0 || rstyle(n.style).box_shadow_offset_y != 0 ||
|
|
1219
|
-
rstyle(n.style).box_shadow_blur_radius != 0 || rstyle(n.style).box_shadow_spread != 0))
|
|
1226
|
+
if ((GEA_CSS_BOX_SHADOW ? rstyle(n.style).box_shadow_alpha : 0) > 0 &&
|
|
1227
|
+
((GEA_CSS_BOX_SHADOW ? rstyle(n.style).box_shadow_offset_x : 0) != 0 || (GEA_CSS_BOX_SHADOW ? rstyle(n.style).box_shadow_offset_y : 0) != 0 ||
|
|
1228
|
+
(GEA_CSS_BOX_SHADOW ? rstyle(n.style).box_shadow_blur_radius : 0) != 0 || (GEA_CSS_BOX_SHADOW ? rstyle(n.style).box_shadow_spread : 0) != 0))
|
|
1220
1229
|
return false;
|
|
1221
1230
|
if (n.style.has_bg)
|
|
1222
1231
|
{
|
|
@@ -1716,11 +1725,15 @@ namespace gea::embedded::ui
|
|
|
1716
1725
|
}
|
|
1717
1726
|
else
|
|
1718
1727
|
{
|
|
1728
|
+
#if GEA_CSS_SCROLLING
|
|
1719
1729
|
PreservedScrollOffset scrollOffsets[kMaxNodes];
|
|
1720
1730
|
preserveScrollOffsets(scrollOffsets, kMaxNodes);
|
|
1731
|
+
#endif
|
|
1721
1732
|
LayoutEngine::instance().beginLayoutPass();
|
|
1722
1733
|
LayoutEngine::instance().layoutNode(root, width, height);
|
|
1734
|
+
#if GEA_CSS_SCROLLING
|
|
1723
1735
|
restoreScrollOffsetsAfterLayout(scrollOffsets, kMaxNodes);
|
|
1736
|
+
#endif
|
|
1724
1737
|
applyPendingScrollIntoView();
|
|
1725
1738
|
LayoutEngine::instance().resolveAbsoluteCoords(root, 0, 0);
|
|
1726
1739
|
noteLaidOutViewport(root, width, height);
|
|
@@ -1923,8 +1936,10 @@ namespace gea::embedded::ui
|
|
|
1923
1936
|
}
|
|
1924
1937
|
else
|
|
1925
1938
|
{
|
|
1939
|
+
#if GEA_CSS_SCROLLING
|
|
1926
1940
|
PreservedScrollOffset scrollOffsets[kMaxNodes];
|
|
1927
1941
|
preserveScrollOffsets(scrollOffsets, kMaxNodes);
|
|
1942
|
+
#endif
|
|
1928
1943
|
// Scoped relayout: when every dirty node sits under a box-stable
|
|
1929
1944
|
// ancestor (e.g. a city-name text growing inside a fixed-size header),
|
|
1930
1945
|
// re-lay only that subtree — the memoized available box makes the
|
|
@@ -1975,7 +1990,9 @@ namespace gea::embedded::ui
|
|
|
1975
1990
|
LayoutEngine::instance().beginLayoutPass();
|
|
1976
1991
|
LayoutEngine::instance().layoutNode(root, width, height);
|
|
1977
1992
|
}
|
|
1993
|
+
#if GEA_CSS_SCROLLING
|
|
1978
1994
|
restoreScrollOffsetsAfterLayout(scrollOffsets, kMaxNodes);
|
|
1995
|
+
#endif
|
|
1979
1996
|
applyPendingScrollIntoView();
|
|
1980
1997
|
if (!scoped)
|
|
1981
1998
|
LayoutEngine::instance().resolveAbsoluteCoords(root, 0, 0);
|
|
@@ -2018,7 +2035,9 @@ namespace gea::embedded::ui
|
|
|
2018
2035
|
}
|
|
2019
2036
|
n.render.dirty = 1;
|
|
2020
2037
|
n.render.layout_dirty = 1;
|
|
2038
|
+
#if GEA_CSS_SCROLLING
|
|
2021
2039
|
n.render.non_scroll_dirty = 1;
|
|
2040
|
+
#endif
|
|
2022
2041
|
}
|
|
2023
2042
|
} // anyLayoutDirty
|
|
2024
2043
|
}
|
|
@@ -2404,7 +2423,7 @@ namespace gea::embedded::ui
|
|
|
2404
2423
|
py0 = state.nodeCommandDirtyY0[i];
|
|
2405
2424
|
py1 = state.nodeCommandDirtyY1[i];
|
|
2406
2425
|
}
|
|
2407
|
-
DirtyRegions::Rect partial{n->render.
|
|
2426
|
+
DirtyRegions::Rect partial{n->render.text_dirty.x0, py0, n->render.text_dirty.x1, py1, i};
|
|
2408
2427
|
partial = expandDirtyRect(partial, GEA_EMBEDDED_TEXT_DIRTY_GUARD_PX);
|
|
2409
2428
|
partial = dirtyRectWithRasterGuard(*n, partial);
|
|
2410
2429
|
addDirtyRegion(rects, &rect_count, partial, width, height);
|
|
@@ -2419,8 +2438,8 @@ namespace gea::embedded::ui
|
|
|
2419
2438
|
n->first_child < 0 &&
|
|
2420
2439
|
!hasAnyBorder(n->style) &&
|
|
2421
2440
|
n->style.opacity == 255 &&
|
|
2422
|
-
rstyle(n->style).filter_blur_radius <= 0 &&
|
|
2423
|
-
rstyle(n->style).box_shadow_blur_radius <= 0 &&
|
|
2441
|
+
(GEA_CSS_FILTERS ? rstyle(n->style).filter_blur_radius : 0) <= 0 &&
|
|
2442
|
+
(GEA_CSS_BOX_SHADOW ? rstyle(n->style).box_shadow_blur_radius : 0) <= 0 &&
|
|
2424
2443
|
n->layout.x == n->layout.previous_x &&
|
|
2425
2444
|
n->layout.y == n->layout.previous_y &&
|
|
2426
2445
|
n->layout.width == n->layout.previous_width &&
|
|
@@ -2433,7 +2452,7 @@ namespace gea::embedded::ui
|
|
|
2433
2452
|
int recolorY1 = -1;
|
|
2434
2453
|
if (DisplayList::instance().recolorRetainedSolidBackground(i,
|
|
2435
2454
|
n->render.bg_recolor_from,
|
|
2436
|
-
n->
|
|
2455
|
+
n->style.bg_color,
|
|
2437
2456
|
&recolorX0,
|
|
2438
2457
|
&recolorY0,
|
|
2439
2458
|
&recolorX1,
|
|
@@ -2483,7 +2502,9 @@ namespace gea::embedded::ui
|
|
|
2483
2502
|
perf.treeBgRecolorPixels += recolorPixels;
|
|
2484
2503
|
n->render.dirty = 0;
|
|
2485
2504
|
n->render.layout_dirty = 0;
|
|
2505
|
+
#if GEA_CSS_SCROLLING
|
|
2486
2506
|
n->render.non_scroll_dirty = 0;
|
|
2507
|
+
#endif
|
|
2487
2508
|
n->render.bg_recolor_pending = 0;
|
|
2488
2509
|
continue;
|
|
2489
2510
|
}
|
|
@@ -3105,6 +3126,7 @@ namespace gea::embedded::ui
|
|
|
3105
3126
|
tickInputCaret(timestamp_ms);
|
|
3106
3127
|
|
|
3107
3128
|
int changed = 0;
|
|
3129
|
+
#if GEA_CSS_BLINK
|
|
3108
3130
|
for (int i = 0; i < state.nodeCount; i++)
|
|
3109
3131
|
{
|
|
3110
3132
|
Node *n = &state.nodes[i];
|
|
@@ -3115,7 +3137,9 @@ namespace gea::embedded::ui
|
|
|
3115
3137
|
n->style.blink_visible = 1;
|
|
3116
3138
|
n->render.dirty = 1;
|
|
3117
3139
|
n->render.layout_dirty = 1;
|
|
3140
|
+
#if GEA_CSS_SCROLLING
|
|
3118
3141
|
n->render.non_scroll_dirty = 1;
|
|
3142
|
+
#endif
|
|
3119
3143
|
changed = 1;
|
|
3120
3144
|
}
|
|
3121
3145
|
continue;
|
|
@@ -3130,10 +3154,13 @@ namespace gea::embedded::ui
|
|
|
3130
3154
|
n->style.blink_visible = visible;
|
|
3131
3155
|
n->render.dirty = 1;
|
|
3132
3156
|
n->render.layout_dirty = 1;
|
|
3157
|
+
#if GEA_CSS_SCROLLING
|
|
3133
3158
|
n->render.non_scroll_dirty = 1;
|
|
3159
|
+
#endif
|
|
3134
3160
|
markDisplayListDirty();
|
|
3135
3161
|
changed = 1;
|
|
3136
3162
|
}
|
|
3163
|
+
#endif
|
|
3137
3164
|
|
|
3138
3165
|
// Live <camera> preview: while a camera is streaming, repaint each camera
|
|
3139
3166
|
// leaf every frame so fresh frames reach the panel — the same idea as the
|
|
@@ -3165,7 +3192,9 @@ namespace gea::embedded::ui
|
|
|
3165
3192
|
}
|
|
3166
3193
|
n->render.dirty = 1;
|
|
3167
3194
|
n->render.layout_dirty = 1;
|
|
3195
|
+
#if GEA_CSS_SCROLLING
|
|
3168
3196
|
n->render.non_scroll_dirty = 1;
|
|
3197
|
+
#endif
|
|
3169
3198
|
// Content-only: the camera's blit command is unchanged frame to frame —
|
|
3170
3199
|
// only the surface pixels it points at are refreshed — so there's no
|
|
3171
3200
|
// draw-order change. Using the structural markDisplayListDirty() forced a
|
|
@@ -14,33 +14,49 @@ Mirror &Mirror::instance()
|
|
|
14
14
|
|
|
15
15
|
bool Mirror::scrollDirtyAny() const
|
|
16
16
|
{
|
|
17
|
+
#if GEA_CSS_SCROLLING
|
|
17
18
|
return treeState().scrollDirtyAny;
|
|
19
|
+
#else
|
|
20
|
+
return false;
|
|
21
|
+
#endif
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
void Mirror::copyScrollDirty(uint64_t *dst, int word_count) const
|
|
21
25
|
{
|
|
26
|
+
#if GEA_CSS_SCROLLING
|
|
22
27
|
if (!dst || word_count <= 0) return;
|
|
23
28
|
auto &state = treeState();
|
|
24
29
|
for (int i = 0; i < word_count; i++)
|
|
25
30
|
dst[i] = i < kScrollDirtyWordCount ? state.scrollDirtyNodes[i] : 0;
|
|
31
|
+
#else
|
|
32
|
+
if (dst && word_count > 0) std::fill_n(dst, word_count, uint64_t{0});
|
|
33
|
+
#endif
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
void Mirror::clearScrollDirty() const
|
|
29
37
|
{
|
|
38
|
+
#if GEA_CSS_SCROLLING
|
|
30
39
|
auto &state = treeState();
|
|
31
40
|
for (int i = 0; i < kScrollDirtyWordCount; i++)
|
|
32
41
|
state.scrollDirtyNodes[i] = 0;
|
|
33
42
|
state.scrollDirtyAny = false;
|
|
43
|
+
#else
|
|
44
|
+
|
|
45
|
+
#endif
|
|
34
46
|
}
|
|
35
47
|
|
|
36
48
|
bool Mirror::nodeIsScrollable(int node) const
|
|
37
49
|
{
|
|
50
|
+
#if GEA_CSS_SCROLLING
|
|
38
51
|
auto &state = treeState();
|
|
39
52
|
if (node < 0 || node >= state.nodeCount) return false;
|
|
40
53
|
Node *n = &state.nodes[node];
|
|
41
54
|
return isViewLikeNodeType(n->type) &&
|
|
42
55
|
((n->type != NodeType::VirtualList && scrollsOverflowX(n->style) && ViewRenderer::scrollMaxX(*n) > 0) ||
|
|
43
56
|
((n->type == NodeType::VirtualList || scrollsOverflowY(n->style)) && ViewRenderer::scrollMaxY(*n) > 0));
|
|
57
|
+
#else
|
|
58
|
+
(void)node; return false;
|
|
59
|
+
#endif
|
|
44
60
|
}
|
|
45
61
|
|
|
46
62
|
int Mirror::scrollX(int node) const
|
|
@@ -52,6 +68,7 @@ int Mirror::scrollX(int node) const
|
|
|
52
68
|
|
|
53
69
|
void Mirror::setScrollX(int node, int scroll_x) const
|
|
54
70
|
{
|
|
71
|
+
#if GEA_CSS_SCROLLING
|
|
55
72
|
auto &state = treeState();
|
|
56
73
|
if (node < 0 || node >= state.nodeCount) return;
|
|
57
74
|
Node *n = &state.nodes[node];
|
|
@@ -65,10 +82,15 @@ void Mirror::setScrollX(int node, int scroll_x) const
|
|
|
65
82
|
n->layout.scroll_x = scroll_x;
|
|
66
83
|
n->render.dirty = 1;
|
|
67
84
|
n->render.layout_dirty = 1;
|
|
85
|
+
#if GEA_CSS_SCROLLING
|
|
68
86
|
n->render.non_scroll_dirty = 1;
|
|
87
|
+
#endif
|
|
69
88
|
n->render.scroll_dirty = 1;
|
|
70
89
|
state.scrollDirtyNodes[node / 64] |= (1ull << (node % 64));
|
|
71
90
|
state.scrollDirtyAny = true;
|
|
91
|
+
#else
|
|
92
|
+
(void)node; (void)scroll_x;
|
|
93
|
+
#endif
|
|
72
94
|
}
|
|
73
95
|
|
|
74
96
|
int Mirror::scrollY(int node) const
|
|
@@ -80,6 +102,7 @@ int Mirror::scrollY(int node) const
|
|
|
80
102
|
|
|
81
103
|
void Mirror::setScrollY(int node, int scroll_y) const
|
|
82
104
|
{
|
|
105
|
+
#if GEA_CSS_SCROLLING
|
|
83
106
|
auto &state = treeState();
|
|
84
107
|
if (node < 0 || node >= state.nodeCount) return;
|
|
85
108
|
Node *n = &state.nodes[node];
|
|
@@ -96,6 +119,9 @@ void Mirror::setScrollY(int node, int scroll_y) const
|
|
|
96
119
|
n->render.scroll_dirty = 1;
|
|
97
120
|
state.scrollDirtyNodes[node / 64] |= (1ull << (node % 64));
|
|
98
121
|
state.scrollDirtyAny = true;
|
|
122
|
+
#else
|
|
123
|
+
(void)node; (void)scroll_y;
|
|
124
|
+
#endif
|
|
99
125
|
}
|
|
100
126
|
|
|
101
127
|
} // namespace gea::embedded::ui
|