@geastack/engine 0.1.6 → 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/README.md +70 -0
- package/canvas.cpp +105 -48
- package/css/declarative.h +6 -0
- package/css/engine.h +20 -0
- package/image_store.cpp +136 -33
- package/package.json +4 -3
- package/ui/CSS_FEATURES.md +261 -0
- package/ui/absolute_leaf_refresh.cpp +77 -62
- package/ui/core.cpp +26 -3
- package/ui/css_atom.cpp +6 -0
- package/ui/css_atom.h +2 -0
- package/ui/css_features.h +369 -0
- package/ui/document.cpp +11 -0
- package/ui/image_node.cpp +25 -24
- package/ui/input.cpp +46 -26
- package/ui/input_render.cpp +31 -27
- package/ui/internal.h +22 -0
- package/ui/layout.cpp +899 -613
- package/ui/layout_snapshot.cpp +29 -2
- package/ui/node_features.h +36 -0
- package/ui/node_lifecycle.cpp +358 -84
- package/ui/node_lifecycle.h +1 -0
- package/ui/node_model.h +816 -96
- package/ui/node_text.h +84 -0
- package/ui/refresh_perf.h +19 -17
- package/ui/render.cpp +341 -259
- package/ui/renderer_features.h +24 -0
- package/ui/root_scroll_refresh.cpp +86 -69
- package/ui/storage_usage.h +45 -0
- package/ui/style.cpp +1398 -349
- package/ui/style_values.h +2 -2
- package/ui/text.cpp +172 -154
- package/ui/tree_events.cpp +218 -92
- package/ui/tree_events.h +44 -20
- package/ui/tree_inspection.h +15 -0
- package/ui/tree_nodes.cpp +51 -19
- package/ui/tree_render.cpp +159 -126
- package/ui/tree_scroll_mirror.cpp +30 -4
- package/ui/tree_state.cpp +334 -115
- package/ui/tree_state.h +118 -22
- package/ui/tree_style.cpp +679 -303
- package/ui/view.cpp +268 -208
- package/ui/virtual_keyboard.cpp +18 -11
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;
|
|
@@ -175,13 +176,13 @@ namespace gea::embedded::ui
|
|
|
175
176
|
node.layout.scroll_y = static_cast<int32_t>(y);
|
|
176
177
|
continue;
|
|
177
178
|
}
|
|
178
|
-
if (node.
|
|
179
|
+
if (node.computedStyle().overflow != 2)
|
|
179
180
|
{
|
|
180
181
|
node.layout.scroll_x = 0;
|
|
181
182
|
node.layout.scroll_y = 0;
|
|
182
183
|
continue;
|
|
183
184
|
}
|
|
184
|
-
if (scrollsOverflowX(node.
|
|
185
|
+
if (scrollsOverflowX(node.computedStyle()))
|
|
185
186
|
{
|
|
186
187
|
int x = offsets[i].x;
|
|
187
188
|
const int maxX = ViewRenderer::scrollMaxX(node);
|
|
@@ -196,7 +197,7 @@ namespace gea::embedded::ui
|
|
|
196
197
|
node.layout.scroll_x = 0;
|
|
197
198
|
}
|
|
198
199
|
|
|
199
|
-
if (scrollsOverflowY(node.
|
|
200
|
+
if (scrollsOverflowY(node.computedStyle()))
|
|
200
201
|
{
|
|
201
202
|
int y = offsets[i].y;
|
|
202
203
|
const int maxY = ViewRenderer::scrollMaxY(node);
|
|
@@ -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,25 +247,27 @@ 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
|
}
|
|
254
259
|
|
|
255
260
|
bool dirtyRectNeedsRasterGuard(const Node &node)
|
|
256
261
|
{
|
|
257
|
-
if (hasAnyBorder(node.
|
|
262
|
+
if (hasAnyBorder(node.computedStyle()))
|
|
258
263
|
return true;
|
|
259
|
-
if (rstyle(node.
|
|
264
|
+
if ((GEA_CSS_FILTERS ? rstyle(node.computedStyle()).filter_blur_radius : 0) > 0 || node.render.previous_filter_blur_radius > 0)
|
|
260
265
|
return true;
|
|
261
|
-
if (node.
|
|
266
|
+
if (node.computedStyle().mask_right_fade_width > 0)
|
|
262
267
|
return true;
|
|
263
|
-
if (rstyle(node.
|
|
268
|
+
if ((GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_alpha : 0) > 0)
|
|
264
269
|
return true;
|
|
265
|
-
return node.
|
|
270
|
+
return node.computedStyle().has_bg && (styleHasRoundedRasterEdge(node.computedStyle()) || node.computedStyle().bg_alpha < 255);
|
|
266
271
|
}
|
|
267
272
|
|
|
268
273
|
constexpr int kRetainedMoveDirtyGuardPx = GEA_EMBEDDED_RETAINED_MOVE_DIRTY_GUARD_PX;
|
|
@@ -402,12 +407,12 @@ namespace gea::embedded::ui
|
|
|
402
407
|
|
|
403
408
|
int nodeBoxRotation(const Node &node, bool usePrevious)
|
|
404
409
|
{
|
|
405
|
-
return usePrevious ? node.render.previous_transform_rotate : rstyle(node.
|
|
410
|
+
return usePrevious ? node.render.previous_transform_rotate : rstyle(node.computedStyle()).transform_rotate;
|
|
406
411
|
}
|
|
407
412
|
|
|
408
413
|
bool hasTransformState(const Node &node)
|
|
409
414
|
{
|
|
410
|
-
const RareStyle &rs = rstyle(node.
|
|
415
|
+
const RareStyle &rs = rstyle(node.computedStyle()); // one pool lookup, not 11
|
|
411
416
|
return hasIndividualLinearTransform(rs) || hadIndividualLinearTransform(node.render) ||
|
|
412
417
|
rs.transform_rotate != 0 ||
|
|
413
418
|
node.render.previous_transform_rotate != 0 ||
|
|
@@ -437,17 +442,17 @@ namespace gea::embedded::ui
|
|
|
437
442
|
|
|
438
443
|
bool hasThreeDimensionalTransformState(const Node &node)
|
|
439
444
|
{
|
|
440
|
-
const auto &r = rstyle(node.
|
|
445
|
+
const auto &r = rstyle(node.computedStyle());
|
|
441
446
|
return ((r.rotate_angle % 3600) && (r.rotate_axis_x || r.rotate_axis_y)) ||
|
|
442
447
|
((node.render.previous_rotate_angle % 3600) && (node.render.previous_rotate_axis_x || node.render.previous_rotate_axis_y)) ||
|
|
443
448
|
r.scale_z != 1000 || node.render.previous_scale_z != 1000 ||
|
|
444
|
-
rstyle(node.
|
|
449
|
+
rstyle(node.computedStyle()).transform_rotate_x != 0 ||
|
|
445
450
|
node.render.previous_transform_rotate_x != 0 ||
|
|
446
|
-
rstyle(node.
|
|
451
|
+
rstyle(node.computedStyle()).transform_rotate_y != 0 ||
|
|
447
452
|
node.render.previous_transform_rotate_y != 0 ||
|
|
448
|
-
composedTranslateZ(rstyle(node.
|
|
453
|
+
composedTranslateZ(rstyle(node.computedStyle())) != 0 ||
|
|
449
454
|
node.render.previous_transform_translate_z != 0 ||
|
|
450
|
-
rstyle(node.
|
|
455
|
+
rstyle(node.computedStyle()).perspective > 0 ||
|
|
451
456
|
node.render.previous_perspective > 0;
|
|
452
457
|
}
|
|
453
458
|
|
|
@@ -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.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(i)] != kUnset)
|
|
514
520
|
{
|
|
515
|
-
const double p = static_cast<double>(node.
|
|
521
|
+
const double p = static_cast<double>(node.computedStyle().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.
|
|
528
|
+
const double r = static_cast<double>(std::max(0, static_cast<int>(node.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(i)])));
|
|
522
529
|
rx[i] = r;
|
|
523
530
|
ry[i] = r;
|
|
524
531
|
}
|
|
@@ -623,9 +630,9 @@ namespace gea::embedded::ui
|
|
|
623
630
|
{
|
|
624
631
|
return isViewLikeNodeType(node.type) &&
|
|
625
632
|
node.first_child < 0 &&
|
|
626
|
-
node.
|
|
627
|
-
node.
|
|
628
|
-
!hasAnyBorder(node.
|
|
633
|
+
node.computedStyle().display != 1 &&
|
|
634
|
+
node.computedStyle().has_bg &&
|
|
635
|
+
!hasAnyBorder(node.computedStyle()) &&
|
|
629
636
|
hasTransformState(node);
|
|
630
637
|
}
|
|
631
638
|
|
|
@@ -644,11 +651,11 @@ namespace gea::embedded::ui
|
|
|
644
651
|
node.type == NodeType::Image ||
|
|
645
652
|
node.type == NodeType::Canvas)
|
|
646
653
|
return true;
|
|
647
|
-
if (node.
|
|
654
|
+
if (node.computedStyle().has_bg || hasAnyBorder(node.computedStyle()))
|
|
648
655
|
return true;
|
|
649
|
-
if (rstyle(node.
|
|
656
|
+
if ((GEA_CSS_BOX_SHADOW ? rstyle(node.computedStyle()).box_shadow_alpha : 0) > 0 || (GEA_CSS_FILTERS ? rstyle(node.computedStyle()).filter_blur_radius : 0) > 0)
|
|
650
657
|
return true;
|
|
651
|
-
if (node.
|
|
658
|
+
if (node.computedStyle().mask_right_fade_width > 0)
|
|
652
659
|
return true;
|
|
653
660
|
return false;
|
|
654
661
|
}
|
|
@@ -860,7 +867,7 @@ namespace gea::embedded::ui
|
|
|
860
867
|
if (node < 0 || node >= state.nodeCount)
|
|
861
868
|
return;
|
|
862
869
|
Node &n = state.nodes[node];
|
|
863
|
-
if (n.
|
|
870
|
+
if (n.computedStyle().display != 1 && n.layout.width > 0 && n.layout.height > 0)
|
|
864
871
|
{
|
|
865
872
|
int nx0, ny0, nx1, ny1;
|
|
866
873
|
ViewRenderer::transformedBounds(n, usePrevious, &nx0, &ny0, &nx1, &ny1);
|
|
@@ -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.
|
|
915
|
+
return usePrevious ? node.render.previous_filter_blur_radius : (GEA_CSS_FILTERS ? rstyle(node.computedStyle()).filter_blur_radius : 0);
|
|
909
916
|
}
|
|
910
917
|
|
|
911
918
|
DirtyRegions::Rect filterBlurBoundsRect(const Node &node, bool usePrevious, int origin)
|
|
@@ -928,7 +935,7 @@ namespace gea::embedded::ui
|
|
|
928
935
|
for (int i = 0; i < state.nodeCount; i++)
|
|
929
936
|
{
|
|
930
937
|
const Node &node = state.nodes[i];
|
|
931
|
-
if (node.
|
|
938
|
+
if (node.computedStyle().display == 1)
|
|
932
939
|
continue;
|
|
933
940
|
for (int pass = 0; pass < 2; pass++)
|
|
934
941
|
{
|
|
@@ -1165,18 +1172,18 @@ namespace gea::embedded::ui
|
|
|
1165
1172
|
|
|
1166
1173
|
bool panNodeHasTransform(const Node &n)
|
|
1167
1174
|
{
|
|
1168
|
-
return hasIndividualLinearTransform(rstyle(n.
|
|
1169
|
-
rstyle(n.
|
|
1170
|
-
rstyle(n.
|
|
1171
|
-
rstyle(n.
|
|
1172
|
-
composedTranslateX(rstyle(n.
|
|
1173
|
-
composedTranslateY(rstyle(n.
|
|
1174
|
-
composedTranslateZ(rstyle(n.
|
|
1175
|
-
composedTranslateXPercent(rstyle(n.
|
|
1176
|
-
composedTranslateYPercent(rstyle(n.
|
|
1177
|
-
rstyle(n.
|
|
1178
|
-
rstyle(n.
|
|
1179
|
-
rstyle(n.
|
|
1175
|
+
return hasIndividualLinearTransform(rstyle(n.computedStyle())) || hadIndividualLinearTransform(n.render) ||
|
|
1176
|
+
rstyle(n.computedStyle()).transform_rotate != 0 || n.render.previous_transform_rotate != 0 ||
|
|
1177
|
+
rstyle(n.computedStyle()).transform_rotate_x != 0 || n.render.previous_transform_rotate_x != 0 ||
|
|
1178
|
+
rstyle(n.computedStyle()).transform_rotate_y != 0 || n.render.previous_transform_rotate_y != 0 ||
|
|
1179
|
+
composedTranslateX(rstyle(n.computedStyle())) != 0 || n.render.previous_transform_translate_x != 0 ||
|
|
1180
|
+
composedTranslateY(rstyle(n.computedStyle())) != 0 || n.render.previous_transform_translate_y != 0 ||
|
|
1181
|
+
composedTranslateZ(rstyle(n.computedStyle())) != 0 || n.render.previous_transform_translate_z != 0 ||
|
|
1182
|
+
composedTranslateXPercent(rstyle(n.computedStyle())) != 0 || n.render.previous_transform_translate_x_percent != 0 ||
|
|
1183
|
+
composedTranslateYPercent(rstyle(n.computedStyle())) != 0 || n.render.previous_transform_translate_y_percent != 0 ||
|
|
1184
|
+
rstyle(n.computedStyle()).transform_scale_x != 1000 || n.render.previous_transform_scale_x != 1000 ||
|
|
1185
|
+
rstyle(n.computedStyle()).transform_scale_y != 1000 || rstyle(n.computedStyle()).transform_scale_z != 1000 || n.render.previous_transform_scale_y != 1000 || n.render.previous_transform_scale_z != 1000 ||
|
|
1186
|
+
rstyle(n.computedStyle()).perspective > 0 || n.render.previous_perspective > 0;
|
|
1180
1187
|
}
|
|
1181
1188
|
|
|
1182
1189
|
bool panIsDescendantOf(int node, int ancestor)
|
|
@@ -1199,41 +1206,43 @@ namespace gea::embedded::ui
|
|
|
1199
1206
|
{
|
|
1200
1207
|
if (n.type != NodeType::View)
|
|
1201
1208
|
return false;
|
|
1202
|
-
if (n.
|
|
1209
|
+
if (n.computedStyle().opacity != 255)
|
|
1203
1210
|
return false;
|
|
1204
|
-
if (hasAnyBorder(n.
|
|
1211
|
+
if (hasAnyBorder(n.computedStyle()))
|
|
1205
1212
|
return false;
|
|
1206
1213
|
for (int r = 0; r < 4; r++)
|
|
1207
1214
|
{
|
|
1208
|
-
if (n.
|
|
1215
|
+
if (n.computedStyle().border_radius[GEA_CSS_RADIUS_INDEX(r)] != 0)
|
|
1209
1216
|
return false;
|
|
1210
|
-
|
|
1217
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
1218
|
+
if (n.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(r)] != kUnset && n.computedStyle().border_radius_percent[GEA_CSS_RADIUS_INDEX(r)] != 0)
|
|
1211
1219
|
return false;
|
|
1220
|
+
#endif
|
|
1212
1221
|
}
|
|
1213
|
-
if (rstyle(n.
|
|
1222
|
+
if ((GEA_CSS_FILTERS ? rstyle(n.computedStyle()).filter_blur_radius : 0) > 0)
|
|
1214
1223
|
return false;
|
|
1215
|
-
if (n.
|
|
1224
|
+
if (n.computedStyle().mask_right_fade_width > 0)
|
|
1216
1225
|
return false;
|
|
1217
|
-
if (rstyle(n.
|
|
1218
|
-
(rstyle(n.
|
|
1219
|
-
rstyle(n.
|
|
1226
|
+
if ((GEA_CSS_BOX_SHADOW ? rstyle(n.computedStyle()).box_shadow_alpha : 0) > 0 &&
|
|
1227
|
+
((GEA_CSS_BOX_SHADOW ? rstyle(n.computedStyle()).box_shadow_offset_x : 0) != 0 || (GEA_CSS_BOX_SHADOW ? rstyle(n.computedStyle()).box_shadow_offset_y : 0) != 0 ||
|
|
1228
|
+
(GEA_CSS_BOX_SHADOW ? rstyle(n.computedStyle()).box_shadow_blur_radius : 0) != 0 || (GEA_CSS_BOX_SHADOW ? rstyle(n.computedStyle()).box_shadow_spread : 0) != 0))
|
|
1220
1229
|
return false;
|
|
1221
|
-
if (n.
|
|
1230
|
+
if (n.computedStyle().has_bg)
|
|
1222
1231
|
{
|
|
1223
1232
|
// A narrow solid rectangle still has horizontal edges: scrolling
|
|
1224
1233
|
// it creates a ghost just like scrolling text or a rounded control.
|
|
1225
|
-
if (n.
|
|
1234
|
+
if (n.computedStyle().bg_alpha != 255 || panNodeHasTransform(n) ||
|
|
1226
1235
|
n.layout.x > viewportX || n.layout.x + n.layout.width < viewportX + viewportWidth)
|
|
1227
1236
|
return false;
|
|
1228
1237
|
for (int parent = n.parent; parent >= 0; parent = treeState().nodes[parent].parent) {
|
|
1229
1238
|
const Node &clip = treeState().nodes[parent];
|
|
1230
|
-
if (panNodeHasTransform(clip) || (clip.
|
|
1239
|
+
if (panNodeHasTransform(clip) || (clip.computedStyle().overflow &&
|
|
1231
1240
|
(clip.layout.x > viewportX || clip.layout.x + clip.layout.width < viewportX + viewportWidth)))
|
|
1232
1241
|
return false;
|
|
1233
1242
|
}
|
|
1234
|
-
if (styleHasBackgroundImage(n.
|
|
1243
|
+
if (styleHasBackgroundImage(n.computedStyle()))
|
|
1235
1244
|
return false; // gradient fill (linear/radial/overlay)
|
|
1236
|
-
if (rstyle(n.
|
|
1245
|
+
if (rstyle(n.computedStyle()).bg_grid_axes != 0)
|
|
1237
1246
|
return false; // grid overlay
|
|
1238
1247
|
}
|
|
1239
1248
|
return true;
|
|
@@ -1248,7 +1257,7 @@ namespace gea::embedded::ui
|
|
|
1248
1257
|
gea::platform::display::Display::resetClip();
|
|
1249
1258
|
gea::platform::display::Display::setAlpha(255);
|
|
1250
1259
|
DisplayList::instance().replayDirectDirtyRegion(rx, ry, rx + rw - 1, ry + rh - 1, origin);
|
|
1251
|
-
refreshPerfStatsMutable().treePanRepaintArea += rw * rh;
|
|
1260
|
+
GEA_REFRESH_PERF(refreshPerfStatsMutable().treePanRepaintArea += rw * rh);
|
|
1252
1261
|
return true;
|
|
1253
1262
|
}
|
|
1254
1263
|
|
|
@@ -1312,14 +1321,14 @@ namespace gea::embedded::ui
|
|
|
1312
1321
|
Node *n = &state.nodes[i];
|
|
1313
1322
|
if (!n->render.dirty)
|
|
1314
1323
|
continue;
|
|
1315
|
-
if (n->
|
|
1324
|
+
if (n->computedStyle().display == kDisplayNone)
|
|
1316
1325
|
continue;
|
|
1317
1326
|
if (n->first_child < 0)
|
|
1318
1327
|
continue;
|
|
1319
1328
|
if (n->parent < 0)
|
|
1320
1329
|
continue;
|
|
1321
1330
|
Node *p = &state.nodes[n->parent];
|
|
1322
|
-
if (p->
|
|
1331
|
+
if (p->computedStyle().overflow != 1)
|
|
1323
1332
|
continue; // parent must clip (overflow:hidden)
|
|
1324
1333
|
const int dx = n->layout.x - n->layout.previous_x;
|
|
1325
1334
|
const int dy = n->layout.y - n->layout.previous_y;
|
|
@@ -1331,7 +1340,7 @@ namespace gea::embedded::ui
|
|
|
1331
1340
|
continue;
|
|
1332
1341
|
if (n->layout.previous_width <= 0 || n->layout.previous_height <= 0)
|
|
1333
1342
|
continue;
|
|
1334
|
-
if (n->
|
|
1343
|
+
if (n->computedStyle().opacity != 255)
|
|
1335
1344
|
continue;
|
|
1336
1345
|
if (panNodeHasTransform(*n))
|
|
1337
1346
|
continue;
|
|
@@ -1450,7 +1459,7 @@ namespace gea::embedded::ui
|
|
|
1450
1459
|
panCoverageWrapperX = W->layout.x;
|
|
1451
1460
|
panCoveragePadding = kPanRecordPadding;
|
|
1452
1461
|
panCoverageSerial = DisplayList::instance().recordSerial();
|
|
1453
|
-
refreshPerfStatsMutable().treeRecordNodeUs += refreshPerfNowUs() - rebuildStartUs;
|
|
1462
|
+
GEA_REFRESH_PERF(refreshPerfStatsMutable().treeRecordNodeUs += refreshPerfNowUs() - rebuildStartUs);
|
|
1454
1463
|
}
|
|
1455
1464
|
|
|
1456
1465
|
// ---- Commit: shift the framebuffer and repaint only what the shift can't. ----
|
|
@@ -1480,7 +1489,7 @@ namespace gea::embedded::ui
|
|
|
1480
1489
|
for (int i = 0; i < state.nodeCount; i++)
|
|
1481
1490
|
{
|
|
1482
1491
|
Node *n = &state.nodes[i];
|
|
1483
|
-
if (n->
|
|
1492
|
+
if (n->computedStyle().display == kDisplayNone)
|
|
1484
1493
|
continue;
|
|
1485
1494
|
if (i == wrapper || panIsDescendantOf(i, wrapper))
|
|
1486
1495
|
continue;
|
|
@@ -1541,9 +1550,9 @@ namespace gea::embedded::ui
|
|
|
1541
1550
|
state.canvases.forEach([](CanvasSurfaceState &surface)
|
|
1542
1551
|
{
|
|
1543
1552
|
if (auto *canvas = surface.canvas()) canvas->resetDirty(); });
|
|
1544
|
-
refreshPerfStatsMutable().treePanReplayCalls
|
|
1553
|
+
GEA_REFRESH_PERF(refreshPerfStatsMutable().treePanReplayCalls++);
|
|
1545
1554
|
if (directRegions > 0)
|
|
1546
|
-
refreshPerfStatsMutable().treeDirectReplayCalls
|
|
1555
|
+
GEA_REFRESH_PERF(refreshPerfStatsMutable().treeDirectReplayCalls++);
|
|
1547
1556
|
return true;
|
|
1548
1557
|
}
|
|
1549
1558
|
|
|
@@ -1646,10 +1655,12 @@ namespace gea::embedded::ui
|
|
|
1646
1655
|
gea::platform::display::Display::resetClip();
|
|
1647
1656
|
gea::platform::display::Display::setAlpha(255);
|
|
1648
1657
|
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1658
|
+
{
|
|
1659
|
+
LayoutEngine::Pass layoutPass;
|
|
1660
|
+
LayoutEngine::instance().layoutNode(root, width, height);
|
|
1661
|
+
applyPendingScrollIntoView();
|
|
1662
|
+
LayoutEngine::instance().resolveAbsoluteCoords(root, 0, 0);
|
|
1663
|
+
}
|
|
1653
1664
|
noteLaidOutViewport(root, width, height);
|
|
1654
1665
|
state.refreshSerial++;
|
|
1655
1666
|
if (state.refreshSerial == 0)
|
|
@@ -1716,11 +1727,15 @@ namespace gea::embedded::ui
|
|
|
1716
1727
|
}
|
|
1717
1728
|
else
|
|
1718
1729
|
{
|
|
1730
|
+
#if GEA_CSS_SCROLLING
|
|
1719
1731
|
PreservedScrollOffset scrollOffsets[kMaxNodes];
|
|
1720
1732
|
preserveScrollOffsets(scrollOffsets, kMaxNodes);
|
|
1721
|
-
|
|
1733
|
+
#endif
|
|
1734
|
+
LayoutEngine::Pass layoutPass;
|
|
1722
1735
|
LayoutEngine::instance().layoutNode(root, width, height);
|
|
1736
|
+
#if GEA_CSS_SCROLLING
|
|
1723
1737
|
restoreScrollOffsetsAfterLayout(scrollOffsets, kMaxNodes);
|
|
1738
|
+
#endif
|
|
1724
1739
|
applyPendingScrollIntoView();
|
|
1725
1740
|
LayoutEngine::instance().resolveAbsoluteCoords(root, 0, 0);
|
|
1726
1741
|
noteLaidOutViewport(root, width, height);
|
|
@@ -1822,7 +1837,7 @@ namespace gea::embedded::ui
|
|
|
1822
1837
|
const bool dimsStable = a.layout.width == a.layout.previous_width &&
|
|
1823
1838
|
a.layout.height == a.layout.previous_height &&
|
|
1824
1839
|
a.layout.width > 0 && a.layout.height > 0;
|
|
1825
|
-
if (dimsStable && a.
|
|
1840
|
+
if (dimsStable && a.computedStyle().display != kDisplayNone)
|
|
1826
1841
|
return scope;
|
|
1827
1842
|
}
|
|
1828
1843
|
return -1;
|
|
@@ -1848,7 +1863,7 @@ namespace gea::embedded::ui
|
|
|
1848
1863
|
// moves content, so native renderers must re-sync.
|
|
1849
1864
|
state.refreshSerial++;
|
|
1850
1865
|
auto &perf = refreshPerfStatsMutable();
|
|
1851
|
-
perf.treeRefreshCalls
|
|
1866
|
+
GEA_REFRESH_PERF(perf.treeRefreshCalls++);
|
|
1852
1867
|
DisplayList::instance().clearRetainedBackgroundRecolors();
|
|
1853
1868
|
|
|
1854
1869
|
const bool textClipDependencies = DisplayList::instance().hasTextClippedBackgrounds();
|
|
@@ -1906,7 +1921,7 @@ namespace gea::embedded::ui
|
|
|
1906
1921
|
const bool framebuffer_was_dirty = false;
|
|
1907
1922
|
#endif
|
|
1908
1923
|
int layout_mode = AbsoluteLeafRefresh::mode();
|
|
1909
|
-
perf.treeLayoutModeUs += refreshPerfNowUs() - layoutModeStartUs;
|
|
1924
|
+
GEA_REFRESH_PERF(perf.treeLayoutModeUs += refreshPerfNowUs() - layoutModeStartUs);
|
|
1910
1925
|
if (layout_mode < 0)
|
|
1911
1926
|
{
|
|
1912
1927
|
if (!framebuffer_was_dirty && !state.displayListDirty && state.pendingScrollIntoViewNode < 0)
|
|
@@ -1923,8 +1938,10 @@ namespace gea::embedded::ui
|
|
|
1923
1938
|
}
|
|
1924
1939
|
else
|
|
1925
1940
|
{
|
|
1941
|
+
#if GEA_CSS_SCROLLING
|
|
1926
1942
|
PreservedScrollOffset scrollOffsets[kMaxNodes];
|
|
1927
1943
|
preserveScrollOffsets(scrollOffsets, kMaxNodes);
|
|
1944
|
+
#endif
|
|
1928
1945
|
// Scoped relayout: when every dirty node sits under a box-stable
|
|
1929
1946
|
// ancestor (e.g. a city-name text growing inside a fixed-size header),
|
|
1930
1947
|
// re-lay only that subtree — the memoized available box makes the
|
|
@@ -1955,13 +1972,13 @@ namespace gea::embedded::ui
|
|
|
1955
1972
|
if (scope >= 0)
|
|
1956
1973
|
scope = stableScopeAt(state, scope, root);
|
|
1957
1974
|
if (scope < 0)
|
|
1958
|
-
perf.treeScopedRejectReason = 1;
|
|
1975
|
+
GEA_REFRESH_PERF(perf.treeScopedRejectReason = 1);
|
|
1959
1976
|
for (int attempt = 0; scope >= 0 && attempt < 2; attempt++)
|
|
1960
1977
|
{
|
|
1961
1978
|
scoped = LayoutEngine::instance().layoutNodeScoped(scope, root);
|
|
1962
1979
|
if (scoped)
|
|
1963
1980
|
{
|
|
1964
|
-
perf.treeScopedLayouts
|
|
1981
|
+
GEA_REFRESH_PERF(perf.treeScopedLayouts++);
|
|
1965
1982
|
break;
|
|
1966
1983
|
}
|
|
1967
1984
|
// Most rejects mean the scope autosized to the new content —
|
|
@@ -1970,12 +1987,14 @@ namespace gea::embedded::ui
|
|
|
1970
1987
|
scope = stableScopeAt(state, state.nodes[scope].parent, root);
|
|
1971
1988
|
}
|
|
1972
1989
|
}
|
|
1990
|
+
LayoutEngine::Pass layoutPass(!scoped);
|
|
1973
1991
|
if (!scoped)
|
|
1974
1992
|
{
|
|
1975
|
-
LayoutEngine::instance().beginLayoutPass();
|
|
1976
1993
|
LayoutEngine::instance().layoutNode(root, width, height);
|
|
1977
1994
|
}
|
|
1995
|
+
#if GEA_CSS_SCROLLING
|
|
1978
1996
|
restoreScrollOffsetsAfterLayout(scrollOffsets, kMaxNodes);
|
|
1997
|
+
#endif
|
|
1979
1998
|
applyPendingScrollIntoView();
|
|
1980
1999
|
if (!scoped)
|
|
1981
2000
|
LayoutEngine::instance().resolveAbsoluteCoords(root, 0, 0);
|
|
@@ -1995,7 +2014,7 @@ namespace gea::embedded::ui
|
|
|
1995
2014
|
continue;
|
|
1996
2015
|
if (n.parent < 0 && i != root)
|
|
1997
2016
|
continue;
|
|
1998
|
-
if (n.
|
|
2017
|
+
if (n.computedStyle().display == kDisplayNone)
|
|
1999
2018
|
continue;
|
|
2000
2019
|
if (n.layout.previous_width <= 0 && n.layout.previous_height <= 0 &&
|
|
2001
2020
|
n.layout.width <= 0 && n.layout.height <= 0)
|
|
@@ -2018,7 +2037,9 @@ namespace gea::embedded::ui
|
|
|
2018
2037
|
}
|
|
2019
2038
|
n.render.dirty = 1;
|
|
2020
2039
|
n.render.layout_dirty = 1;
|
|
2040
|
+
#if GEA_CSS_SCROLLING
|
|
2021
2041
|
n.render.non_scroll_dirty = 1;
|
|
2042
|
+
#endif
|
|
2022
2043
|
}
|
|
2023
2044
|
} // anyLayoutDirty
|
|
2024
2045
|
}
|
|
@@ -2027,7 +2048,7 @@ namespace gea::embedded::ui
|
|
|
2027
2048
|
state.refreshSerial++;
|
|
2028
2049
|
if (state.refreshSerial == 0)
|
|
2029
2050
|
state.refreshSerial = 1;
|
|
2030
|
-
perf.treeLayoutUs += refreshPerfNowUs() - layoutStartUs;
|
|
2051
|
+
GEA_REFRESH_PERF(perf.treeLayoutUs += refreshPerfNowUs() - layoutStartUs);
|
|
2031
2052
|
|
|
2032
2053
|
const std::int64_t displayListStartUs = refreshPerfNowUs();
|
|
2033
2054
|
const bool display_list_was_dirty = state.displayListDirty;
|
|
@@ -2287,10 +2308,10 @@ namespace gea::embedded::ui
|
|
|
2287
2308
|
}
|
|
2288
2309
|
state.displayListDirty = false;
|
|
2289
2310
|
displayListFullRecord = !reprojected;
|
|
2290
|
-
perf.treeRecordNodeUs += refreshPerfNowUs() - recordNodeStartUs;
|
|
2291
|
-
perf.treeRecordCalls
|
|
2292
|
-
perf.treeRecordedNodes += state.nodeCount;
|
|
2293
|
-
perf.treeRecordedCommands += DisplayList::instance().commandCount();
|
|
2311
|
+
GEA_REFRESH_PERF(perf.treeRecordNodeUs += refreshPerfNowUs() - recordNodeStartUs);
|
|
2312
|
+
GEA_REFRESH_PERF(perf.treeRecordCalls++);
|
|
2313
|
+
GEA_REFRESH_PERF(perf.treeRecordedNodes += state.nodeCount);
|
|
2314
|
+
GEA_REFRESH_PERF(perf.treeRecordedCommands += DisplayList::instance().commandCount());
|
|
2294
2315
|
}
|
|
2295
2316
|
else if (!can_keep_display_list)
|
|
2296
2317
|
{
|
|
@@ -2310,16 +2331,16 @@ namespace gea::embedded::ui
|
|
|
2310
2331
|
DisplayList::instance().recordNode(root, 255);
|
|
2311
2332
|
DisplayList::instance().weldTransformedFaces();
|
|
2312
2333
|
state.displayListDirty = false;
|
|
2313
|
-
perf.treeRecordNodeUs += refreshPerfNowUs() - recordNodeStartUs;
|
|
2314
|
-
perf.treeRecordCalls
|
|
2315
|
-
perf.treeRecordedNodes += state.nodeCount;
|
|
2316
|
-
perf.treeRecordedCommands += DisplayList::instance().commandCount();
|
|
2334
|
+
GEA_REFRESH_PERF(perf.treeRecordNodeUs += refreshPerfNowUs() - recordNodeStartUs);
|
|
2335
|
+
GEA_REFRESH_PERF(perf.treeRecordCalls++);
|
|
2336
|
+
GEA_REFRESH_PERF(perf.treeRecordedNodes += state.nodeCount);
|
|
2337
|
+
GEA_REFRESH_PERF(perf.treeRecordedCommands += DisplayList::instance().commandCount());
|
|
2317
2338
|
}
|
|
2318
2339
|
if (displayListFullRecord)
|
|
2319
|
-
perf.treeFullRecords
|
|
2340
|
+
GEA_REFRESH_PERF(perf.treeFullRecords++);
|
|
2320
2341
|
if (reprojected)
|
|
2321
|
-
perf.treeReprojects
|
|
2322
|
-
perf.treeDisplayListUs += refreshPerfNowUs() - displayListStartUs;
|
|
2342
|
+
GEA_REFRESH_PERF(perf.treeReprojects++);
|
|
2343
|
+
GEA_REFRESH_PERF(perf.treeDisplayListUs += refreshPerfNowUs() - displayListStartUs);
|
|
2323
2344
|
|
|
2324
2345
|
// Horizontal-pan fast path: when a camera/world wrapper translated the viewport
|
|
2325
2346
|
// this frame (and nothing structural changed), memcpy-shift the viewport instead
|
|
@@ -2404,7 +2425,7 @@ namespace gea::embedded::ui
|
|
|
2404
2425
|
py0 = state.nodeCommandDirtyY0[i];
|
|
2405
2426
|
py1 = state.nodeCommandDirtyY1[i];
|
|
2406
2427
|
}
|
|
2407
|
-
DirtyRegions::Rect partial{n->render.
|
|
2428
|
+
DirtyRegions::Rect partial{n->render.text_dirty.x0, py0, n->render.text_dirty.x1, py1, i};
|
|
2408
2429
|
partial = expandDirtyRect(partial, GEA_EMBEDDED_TEXT_DIRTY_GUARD_PX);
|
|
2409
2430
|
partial = dirtyRectWithRasterGuard(*n, partial);
|
|
2410
2431
|
addDirtyRegion(rects, &rect_count, partial, width, height);
|
|
@@ -2417,10 +2438,10 @@ namespace gea::embedded::ui
|
|
|
2417
2438
|
direct_replay &&
|
|
2418
2439
|
n->render.bg_recolor_pending &&
|
|
2419
2440
|
n->first_child < 0 &&
|
|
2420
|
-
!hasAnyBorder(n->
|
|
2421
|
-
n->
|
|
2422
|
-
rstyle(n->
|
|
2423
|
-
rstyle(n->
|
|
2441
|
+
!hasAnyBorder(n->computedStyle()) &&
|
|
2442
|
+
n->computedStyle().opacity == 255 &&
|
|
2443
|
+
(GEA_CSS_FILTERS ? rstyle(n->computedStyle()).filter_blur_radius : 0) <= 0 &&
|
|
2444
|
+
(GEA_CSS_BOX_SHADOW ? rstyle(n->computedStyle()).box_shadow_blur_radius : 0) <= 0 &&
|
|
2424
2445
|
n->layout.x == n->layout.previous_x &&
|
|
2425
2446
|
n->layout.y == n->layout.previous_y &&
|
|
2426
2447
|
n->layout.width == n->layout.previous_width &&
|
|
@@ -2433,7 +2454,7 @@ namespace gea::embedded::ui
|
|
|
2433
2454
|
int recolorY1 = -1;
|
|
2434
2455
|
if (DisplayList::instance().recolorRetainedSolidBackground(i,
|
|
2435
2456
|
n->render.bg_recolor_from,
|
|
2436
|
-
n->
|
|
2457
|
+
n->computedStyle().bg_color,
|
|
2437
2458
|
&recolorX0,
|
|
2438
2459
|
&recolorY0,
|
|
2439
2460
|
&recolorX1,
|
|
@@ -2479,11 +2500,13 @@ namespace gea::embedded::ui
|
|
|
2479
2500
|
addDirtyRegion(flush_rects, &flush_rect_count, repair, width, height);
|
|
2480
2501
|
}
|
|
2481
2502
|
}
|
|
2482
|
-
perf.treeBgRecolorCalls
|
|
2483
|
-
perf.treeBgRecolorPixels += recolorPixels;
|
|
2503
|
+
GEA_REFRESH_PERF(perf.treeBgRecolorCalls++);
|
|
2504
|
+
GEA_REFRESH_PERF(perf.treeBgRecolorPixels += recolorPixels);
|
|
2484
2505
|
n->render.dirty = 0;
|
|
2485
2506
|
n->render.layout_dirty = 0;
|
|
2507
|
+
#if GEA_CSS_SCROLLING
|
|
2486
2508
|
n->render.non_scroll_dirty = 0;
|
|
2509
|
+
#endif
|
|
2487
2510
|
n->render.bg_recolor_pending = 0;
|
|
2488
2511
|
continue;
|
|
2489
2512
|
}
|
|
@@ -2697,7 +2720,7 @@ namespace gea::embedded::ui
|
|
|
2697
2720
|
// replay the full filtered source/output bounds so the cache never mixes
|
|
2698
2721
|
// retained pixels with the current frame.
|
|
2699
2722
|
expandDirtyRegionsForFilterBlur(rects, &rect_count, flush_rects, &flush_rect_count, unifiedRectPath, width, height);
|
|
2700
|
-
perf.treeDirtyCollectUs += refreshPerfNowUs() - dirtyCollectStartUs;
|
|
2723
|
+
GEA_REFRESH_PERF(perf.treeDirtyCollectUs += refreshPerfNowUs() - dirtyCollectStartUs);
|
|
2701
2724
|
// Done collecting (and the structural/framebuffer/filter adds above); clear the
|
|
2702
2725
|
// broad-bbox flag so it can't leak into any later addDirtyRegion path.
|
|
2703
2726
|
g_broadDirtyBbox = false;
|
|
@@ -2757,28 +2780,30 @@ namespace gea::embedded::ui
|
|
|
2757
2780
|
coalesceHighCoverageDirtyRegions(flush_rects, &flush_rect_count, width, height);
|
|
2758
2781
|
#endif
|
|
2759
2782
|
}
|
|
2760
|
-
perf.treeDirtyCoalesceUs += refreshPerfNowUs() - dirtyCoalesceStartUs;
|
|
2783
|
+
GEA_REFRESH_PERF(perf.treeDirtyCoalesceUs += refreshPerfNowUs() - dirtyCoalesceStartUs);
|
|
2761
2784
|
|
|
2762
2785
|
gea::platform::display::DisplayFlushRect flushRects[DirtyRegions::kMaxRects];
|
|
2763
2786
|
int flushRectCount = 0;
|
|
2787
|
+
#if GEA_EMBEDDED_UI_REFRESH_PERF
|
|
2764
2788
|
if (rect_count > 0)
|
|
2765
2789
|
{
|
|
2766
|
-
perf.treeReplayRegions += rect_count;
|
|
2790
|
+
GEA_REFRESH_PERF(perf.treeReplayRegions += rect_count);
|
|
2767
2791
|
for (int i = 0; i < rect_count; i++)
|
|
2768
2792
|
{
|
|
2769
2793
|
if (rects[i].origin >= 0)
|
|
2770
|
-
perf.treeReplayOriginRegions
|
|
2794
|
+
GEA_REFRESH_PERF(perf.treeReplayOriginRegions++);
|
|
2771
2795
|
if (perf.treeReplayRegionSampleCount < gea::embedded::ui::RefreshPerfStats::kMaxTreeReplayRegionSamples)
|
|
2772
2796
|
{
|
|
2773
2797
|
const int sample = perf.treeReplayRegionSampleCount++;
|
|
2774
|
-
perf.treeReplayRegionX0[sample] = static_cast<std::int16_t>(rects[i].x0);
|
|
2775
|
-
perf.treeReplayRegionY0[sample] = static_cast<std::int16_t>(rects[i].y0);
|
|
2776
|
-
perf.treeReplayRegionX1[sample] = static_cast<std::int16_t>(rects[i].x1);
|
|
2777
|
-
perf.treeReplayRegionY1[sample] = static_cast<std::int16_t>(rects[i].y1);
|
|
2778
|
-
perf.treeReplayRegionOrigin[sample] = static_cast<std::int16_t>(rects[i].origin);
|
|
2798
|
+
GEA_REFRESH_PERF(perf.treeReplayRegionX0[sample] = static_cast<std::int16_t>(rects[i].x0));
|
|
2799
|
+
GEA_REFRESH_PERF(perf.treeReplayRegionY0[sample] = static_cast<std::int16_t>(rects[i].y0));
|
|
2800
|
+
GEA_REFRESH_PERF(perf.treeReplayRegionX1[sample] = static_cast<std::int16_t>(rects[i].x1));
|
|
2801
|
+
GEA_REFRESH_PERF(perf.treeReplayRegionY1[sample] = static_cast<std::int16_t>(rects[i].y1));
|
|
2802
|
+
GEA_REFRESH_PERF(perf.treeReplayRegionOrigin[sample] = static_cast<std::int16_t>(rects[i].origin));
|
|
2779
2803
|
}
|
|
2780
2804
|
}
|
|
2781
2805
|
}
|
|
2806
|
+
#endif
|
|
2782
2807
|
const bool hasFlushOnlyRecolorRegions = preserveFlushOnlyRecolorRegions && flush_rect_count > 0;
|
|
2783
2808
|
const bool simpleDirtyReplayAvailable =
|
|
2784
2809
|
direct_replay && unifiedRectPath && DisplayList::instance().canReplaySimpleDirtyRegions(width, height);
|
|
@@ -2797,7 +2822,7 @@ namespace gea::embedded::ui
|
|
|
2797
2822
|
#endif
|
|
2798
2823
|
if (simpleUnifiedReplay)
|
|
2799
2824
|
{
|
|
2800
|
-
perf.treeDirectReplayCalls
|
|
2825
|
+
GEA_REFRESH_PERF(perf.treeDirectReplayCalls++);
|
|
2801
2826
|
#if GEA_EMBEDDED_DISPLAY_FUSE_REPLAY_FLUSH
|
|
2802
2827
|
// Fused: skip the separate replay-into-framebuffer pass entirely. Hand the
|
|
2803
2828
|
// coalesced dirty windows to the flush, which chunks them and calls
|
|
@@ -2823,7 +2848,7 @@ namespace gea::embedded::ui
|
|
|
2823
2848
|
gea::platform::display::Display::flushRectsRasterized(sparseRects, sparseCount, fusedReplayRaster, &fctx, /*allowPerChunkDrain=*/false);
|
|
2824
2849
|
gea::platform::display::Display::rebindCanvasToFramebuffer();
|
|
2825
2850
|
}
|
|
2826
|
-
perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs;
|
|
2851
|
+
GEA_REFRESH_PERF(perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs);
|
|
2827
2852
|
}
|
|
2828
2853
|
#else
|
|
2829
2854
|
// A single wide flush of the dirty union avoids the per-window overhead and
|
|
@@ -2877,7 +2902,7 @@ namespace gea::embedded::ui
|
|
|
2877
2902
|
gea::platform::display::Display::pushClip(r->x0, r->y0, r->x1 - r->x0 + 1, r->y1 - r->y0 + 1);
|
|
2878
2903
|
const std::int64_t replayStartUs = refreshPerfNowUs();
|
|
2879
2904
|
DisplayList::instance().replaySimpleClippedDirtyRegion(r->x0, r->y0, r->x1, r->y1, r->origin);
|
|
2880
|
-
perf.treeReplayUs += refreshPerfNowUs() - replayStartUs;
|
|
2905
|
+
GEA_REFRESH_PERF(perf.treeReplayUs += refreshPerfNowUs() - replayStartUs);
|
|
2881
2906
|
gea::platform::display::Display::popClip();
|
|
2882
2907
|
}
|
|
2883
2908
|
}
|
|
@@ -2893,7 +2918,7 @@ namespace gea::embedded::ui
|
|
|
2893
2918
|
regions[i] = DisplayReplayRegion{r->x0, r->y0, r->x1, r->y1, r->origin};
|
|
2894
2919
|
}
|
|
2895
2920
|
DisplayList::instance().replayDirectDirtyRegions(regions, rect_count);
|
|
2896
|
-
perf.treeReplayUs += refreshPerfNowUs() - replayStartUs;
|
|
2921
|
+
GEA_REFRESH_PERF(perf.treeReplayUs += refreshPerfNowUs() - replayStartUs);
|
|
2897
2922
|
}
|
|
2898
2923
|
}
|
|
2899
2924
|
else
|
|
@@ -2906,7 +2931,7 @@ namespace gea::embedded::ui
|
|
|
2906
2931
|
gea::platform::display::Display::pushClip(r->x0, r->y0, r->x1 - r->x0 + 1, r->y1 - r->y0 + 1);
|
|
2907
2932
|
const std::int64_t replayStartUs = refreshPerfNowUs();
|
|
2908
2933
|
DisplayList::instance().replaySimpleClippedDirtyRegion(r->x0, r->y0, r->x1, r->y1, r->origin);
|
|
2909
|
-
perf.treeReplayUs += refreshPerfNowUs() - replayStartUs;
|
|
2934
|
+
GEA_REFRESH_PERF(perf.treeReplayUs += refreshPerfNowUs() - replayStartUs);
|
|
2910
2935
|
gea::platform::display::Display::popClip();
|
|
2911
2936
|
}
|
|
2912
2937
|
}
|
|
@@ -2941,12 +2966,12 @@ namespace gea::embedded::ui
|
|
|
2941
2966
|
if (sparseCount > 0)
|
|
2942
2967
|
gea::platform::display::Display::flushRects(sparseRects, sparseCount);
|
|
2943
2968
|
}
|
|
2944
|
-
perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs;
|
|
2969
|
+
GEA_REFRESH_PERF(perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs);
|
|
2945
2970
|
#endif
|
|
2946
2971
|
}
|
|
2947
2972
|
else if (interleavedUnifiedFlush)
|
|
2948
2973
|
{
|
|
2949
|
-
perf.treeDirectReplayCalls
|
|
2974
|
+
GEA_REFRESH_PERF(perf.treeDirectReplayCalls++);
|
|
2950
2975
|
#if GEA_EMBEDDED_DISPLAY_FUSE_REPLAY_FLUSH && GEA_EMBEDDED_DISPLAY_FUSE_INTERLEAVED_REPLAY_FLUSH
|
|
2951
2976
|
FusedReplayRasterCtx fctx{width, height};
|
|
2952
2977
|
gea::platform::display::DisplayFlushRect sparseRects[DirtyRegions::kMaxRects];
|
|
@@ -2965,7 +2990,7 @@ namespace gea::embedded::ui
|
|
|
2965
2990
|
gea::platform::display::Display::flushRectsRasterized(sparseRects, sparseCount, fusedDirectReplayRaster, &fctx, /*allowPerChunkDrain=*/false);
|
|
2966
2991
|
gea::platform::display::Display::rebindCanvasToFramebuffer();
|
|
2967
2992
|
}
|
|
2968
|
-
perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs;
|
|
2993
|
+
GEA_REFRESH_PERF(perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs);
|
|
2969
2994
|
#else
|
|
2970
2995
|
for (int i = 0; i < rect_count; i++)
|
|
2971
2996
|
{
|
|
@@ -2976,11 +3001,11 @@ namespace gea::embedded::ui
|
|
|
2976
3001
|
const std::int64_t replayStartUs = refreshPerfNowUs();
|
|
2977
3002
|
const DisplayReplayRegion region{r->x0, r->y0, r->x1, r->y1, r->origin};
|
|
2978
3003
|
DisplayList::instance().replayDirectDirtyRegions(®ion, 1);
|
|
2979
|
-
perf.treeReplayUs += refreshPerfNowUs() - replayStartUs;
|
|
3004
|
+
GEA_REFRESH_PERF(perf.treeReplayUs += refreshPerfNowUs() - replayStartUs);
|
|
2980
3005
|
gea::platform::display::Display::popClip();
|
|
2981
3006
|
const std::int64_t flushStartUs = refreshPerfNowUs();
|
|
2982
3007
|
gea::platform::display::Display::flush();
|
|
2983
|
-
perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs;
|
|
3008
|
+
GEA_REFRESH_PERF(perf.treeFlushRectsUs += refreshPerfNowUs() - flushStartUs);
|
|
2984
3009
|
}
|
|
2985
3010
|
#endif
|
|
2986
3011
|
}
|
|
@@ -2989,7 +3014,7 @@ namespace gea::embedded::ui
|
|
|
2989
3014
|
const std::int64_t replayStartUs = refreshPerfNowUs();
|
|
2990
3015
|
if (direct_replay && rect_count > 0)
|
|
2991
3016
|
{
|
|
2992
|
-
perf.treeDirectReplayCalls
|
|
3017
|
+
GEA_REFRESH_PERF(perf.treeDirectReplayCalls++);
|
|
2993
3018
|
gea::platform::display::Display::resetClip();
|
|
2994
3019
|
gea::platform::display::Display::setAlpha(255);
|
|
2995
3020
|
DisplayReplayRegion regions[DirtyRegions::kMaxRects];
|
|
@@ -3013,7 +3038,7 @@ namespace gea::embedded::ui
|
|
|
3013
3038
|
gea::platform::display::Display::popClip();
|
|
3014
3039
|
}
|
|
3015
3040
|
}
|
|
3016
|
-
perf.treeReplayUs += refreshPerfNowUs() - replayStartUs;
|
|
3041
|
+
GEA_REFRESH_PERF(perf.treeReplayUs += refreshPerfNowUs() - replayStartUs);
|
|
3017
3042
|
}
|
|
3018
3043
|
|
|
3019
3044
|
// Static-backdrop cache: once the static scene (bg + stage) has been stable for a
|
|
@@ -3068,7 +3093,7 @@ namespace gea::embedded::ui
|
|
|
3068
3093
|
}
|
|
3069
3094
|
if (flushRectCount > 0)
|
|
3070
3095
|
gea::platform::display::Display::flushRects(flushRects, flushRectCount);
|
|
3071
|
-
perf.treeFlushRectsUs += refreshPerfNowUs() - flushRectsStartUs;
|
|
3096
|
+
GEA_REFRESH_PERF(perf.treeFlushRectsUs += refreshPerfNowUs() - flushRectsStartUs);
|
|
3072
3097
|
}
|
|
3073
3098
|
const std::int64_t snapshotStartUs = refreshPerfNowUs();
|
|
3074
3099
|
LayoutSnapshot::capture();
|
|
@@ -3083,7 +3108,7 @@ namespace gea::embedded::ui
|
|
|
3083
3108
|
if (displayCanvas)
|
|
3084
3109
|
displayCanvas->resetDirty();
|
|
3085
3110
|
#endif
|
|
3086
|
-
perf.treeSnapshotUs += refreshPerfNowUs() - snapshotStartUs;
|
|
3111
|
+
GEA_REFRESH_PERF(perf.treeSnapshotUs += refreshPerfNowUs() - snapshotStartUs);
|
|
3087
3112
|
}
|
|
3088
3113
|
|
|
3089
3114
|
void Tree::frame(int timestamp_ms)
|
|
@@ -3105,35 +3130,41 @@ namespace gea::embedded::ui
|
|
|
3105
3130
|
tickInputCaret(timestamp_ms);
|
|
3106
3131
|
|
|
3107
3132
|
int changed = 0;
|
|
3133
|
+
#if GEA_CSS_BLINK
|
|
3108
3134
|
for (int i = 0; i < state.nodeCount; i++)
|
|
3109
3135
|
{
|
|
3110
3136
|
Node *n = &state.nodes[i];
|
|
3111
|
-
if (n->
|
|
3137
|
+
if (n->computedStyle().blink_interval_ms <= 0)
|
|
3112
3138
|
{
|
|
3113
|
-
if (!n->
|
|
3139
|
+
if (!n->computedStyle().blink_visible)
|
|
3114
3140
|
{
|
|
3115
|
-
n->
|
|
3141
|
+
n->mutableStyle().blink_visible = 1;
|
|
3116
3142
|
n->render.dirty = 1;
|
|
3117
3143
|
n->render.layout_dirty = 1;
|
|
3144
|
+
#if GEA_CSS_SCROLLING
|
|
3118
3145
|
n->render.non_scroll_dirty = 1;
|
|
3146
|
+
#endif
|
|
3119
3147
|
changed = 1;
|
|
3120
3148
|
}
|
|
3121
3149
|
continue;
|
|
3122
3150
|
}
|
|
3123
3151
|
|
|
3124
|
-
int elapsed = timestamp_ms - n->
|
|
3152
|
+
int elapsed = timestamp_ms - n->computedStyle().blink_started_ms;
|
|
3125
3153
|
if (elapsed < 0)
|
|
3126
3154
|
elapsed = 0;
|
|
3127
|
-
int visible = ((elapsed / n->
|
|
3128
|
-
if (n->
|
|
3155
|
+
int visible = ((elapsed / n->computedStyle().blink_interval_ms) % 2) == 0;
|
|
3156
|
+
if (n->computedStyle().blink_visible == visible)
|
|
3129
3157
|
continue;
|
|
3130
|
-
n->
|
|
3158
|
+
n->mutableStyle().blink_visible = visible;
|
|
3131
3159
|
n->render.dirty = 1;
|
|
3132
3160
|
n->render.layout_dirty = 1;
|
|
3161
|
+
#if GEA_CSS_SCROLLING
|
|
3133
3162
|
n->render.non_scroll_dirty = 1;
|
|
3163
|
+
#endif
|
|
3134
3164
|
markDisplayListDirty();
|
|
3135
3165
|
changed = 1;
|
|
3136
3166
|
}
|
|
3167
|
+
#endif
|
|
3137
3168
|
|
|
3138
3169
|
// Live <camera> preview: while a camera is streaming, repaint each camera
|
|
3139
3170
|
// leaf every frame so fresh frames reach the panel — the same idea as the
|
|
@@ -3151,7 +3182,7 @@ namespace gea::embedded::ui
|
|
|
3151
3182
|
Node *n = &state.nodes[i];
|
|
3152
3183
|
if (n->type != NodeType::Camera)
|
|
3153
3184
|
continue;
|
|
3154
|
-
if (n->
|
|
3185
|
+
if (n->computedStyle().display == kDisplayNone)
|
|
3155
3186
|
continue;
|
|
3156
3187
|
hasVisibleCamera = true;
|
|
3157
3188
|
if (nativeOverlay)
|
|
@@ -3165,7 +3196,9 @@ namespace gea::embedded::ui
|
|
|
3165
3196
|
}
|
|
3166
3197
|
n->render.dirty = 1;
|
|
3167
3198
|
n->render.layout_dirty = 1;
|
|
3199
|
+
#if GEA_CSS_SCROLLING
|
|
3168
3200
|
n->render.non_scroll_dirty = 1;
|
|
3201
|
+
#endif
|
|
3169
3202
|
// Content-only: the camera's blit command is unchanged frame to frame —
|
|
3170
3203
|
// only the surface pixels it points at are refreshed — so there's no
|
|
3171
3204
|
// draw-order change. Using the structural markDisplayListDirty() forced a
|