@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
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
namespace gea::embedded::ui {
|
|
31
31
|
|
|
32
|
+
#if GEA_CSS_SCROLLING
|
|
32
33
|
namespace {
|
|
33
34
|
|
|
34
35
|
bool hasTransformState(const Node &node)
|
|
@@ -107,8 +108,8 @@ bool isSlotRepositionCandidate(const TreeState &state, int node, int scrollNode)
|
|
|
107
108
|
if (n.style.position != 1) return false;
|
|
108
109
|
// Anchored via top/bottom (the windowed axis); refresh() recomputes y from
|
|
109
110
|
// these offsets directly.
|
|
110
|
-
if (n.style
|
|
111
|
-
n.style
|
|
111
|
+
if (GEA_CSS_POSITION_PX_0(n.style) == kUnset && GEA_CSS_POSITION_PERCENT_0(n.style) == kUnset &&
|
|
112
|
+
GEA_CSS_POSITION_PX_2(n.style) == kUnset && GEA_CSS_POSITION_PERCENT_2(n.style) == kUnset)
|
|
112
113
|
return false;
|
|
113
114
|
if (hasTransformState(n)) return false;
|
|
114
115
|
// The reconcile translates the slot box; a pending size change needs layout.
|
|
@@ -117,10 +118,11 @@ bool isSlotRepositionCandidate(const TreeState &state, int node, int scrollNode)
|
|
|
117
118
|
return true;
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
template <int side>
|
|
122
|
+
int resolvedSlotOffset(const Node &slot, int basis)
|
|
121
123
|
{
|
|
122
|
-
int offset = slot.style
|
|
123
|
-
const int percent = slot.style
|
|
124
|
+
int offset = GEA_CSS_POSITION_PX(slot.style, side) != kUnset ? GEA_CSS_POSITION_PX(slot.style, side) : 0;
|
|
125
|
+
const int percent = GEA_CSS_POSITION_PERCENT(slot.style, side);
|
|
124
126
|
if (percent != kUnset) {
|
|
125
127
|
const int numerator = basis * percent;
|
|
126
128
|
offset += (numerator + (numerator >= 0 ? 500 : -500)) / 1000;
|
|
@@ -333,7 +335,10 @@ int RootScrollOnlyRefresh::refreshNode(int root,
|
|
|
333
335
|
if (hasTransformState(*n)) return -1;
|
|
334
336
|
if (n->style.opacity != 255 || hasAnyBorder(n->style)) return -1;
|
|
335
337
|
for (int r = 0; r < 4; r++) {
|
|
336
|
-
if (n->style.border_radius[r] != 0
|
|
338
|
+
if (n->style.border_radius[GEA_CSS_RADIUS_INDEX(r)] != 0) return -1;
|
|
339
|
+
#if GEA_CSS_PERCENT_RADIUS
|
|
340
|
+
if (n->style.border_radius_percent[GEA_CSS_RADIUS_INDEX(r)] != kUnset) return -1;
|
|
341
|
+
#endif
|
|
337
342
|
}
|
|
338
343
|
foundNode = i;
|
|
339
344
|
continue;
|
|
@@ -537,18 +542,18 @@ int RootScrollOnlyRefresh::refresh(int root, int width, int height)
|
|
|
537
542
|
if (slot.style.display == 1) continue; // display:none — erase old rect only
|
|
538
543
|
|
|
539
544
|
int newX = slot.layout.x;
|
|
540
|
-
if (slot.style
|
|
541
|
-
newX = n->layout.x + resolvedSlotOffset(slot,
|
|
542
|
-
else if (slot.style
|
|
545
|
+
if (GEA_CSS_POSITION_PX_3(slot.style) != kUnset || GEA_CSS_POSITION_PERCENT_3(slot.style) != kUnset)
|
|
546
|
+
newX = n->layout.x + resolvedSlotOffset<3>(slot, n->layout.width);
|
|
547
|
+
else if (GEA_CSS_POSITION_PX_1(slot.style) != kUnset || GEA_CSS_POSITION_PERCENT_1(slot.style) != kUnset)
|
|
543
548
|
newX = n->layout.x + n->layout.width - slot.layout.width -
|
|
544
|
-
resolvedSlotOffset(slot,
|
|
549
|
+
resolvedSlotOffset<1>(slot, n->layout.width);
|
|
545
550
|
|
|
546
551
|
int newY = slot.layout.y;
|
|
547
|
-
if (slot.style
|
|
548
|
-
newY = n->layout.y - n->layout.scroll_y + resolvedSlotOffset(slot,
|
|
549
|
-
else if (slot.style
|
|
552
|
+
if (GEA_CSS_POSITION_PX_0(slot.style) != kUnset || GEA_CSS_POSITION_PERCENT_0(slot.style) != kUnset)
|
|
553
|
+
newY = n->layout.y - n->layout.scroll_y + resolvedSlotOffset<0>(slot, n->layout.height);
|
|
554
|
+
else if (GEA_CSS_POSITION_PX_2(slot.style) != kUnset || GEA_CSS_POSITION_PERCENT_2(slot.style) != kUnset)
|
|
550
555
|
newY = n->layout.y - n->layout.scroll_y + n->layout.height - slot.layout.height -
|
|
551
|
-
resolvedSlotOffset(slot,
|
|
556
|
+
resolvedSlotOffset<2>(slot, n->layout.height);
|
|
552
557
|
|
|
553
558
|
const int dx = newX - slot.layout.x;
|
|
554
559
|
const int dy = newY - slot.layout.y;
|
|
@@ -858,7 +863,19 @@ void rootScrollImageHoldTick()
|
|
|
858
863
|
if (state.mountedRoot < 0) return;
|
|
859
864
|
Tree::instance().markDisplayListDirty();
|
|
860
865
|
state.nodes[state.mountedRoot].render.dirty = 1;
|
|
866
|
+
#if GEA_CSS_SCROLLING
|
|
861
867
|
state.nodes[state.mountedRoot].render.non_scroll_dirty = 1;
|
|
868
|
+
#endif
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
#else
|
|
872
|
+
int RootScrollOnlyRefresh::refresh(int root, int width, int height)
|
|
873
|
+
{
|
|
874
|
+
(void)root; (void)width; (void)height;
|
|
875
|
+
return 0;
|
|
862
876
|
}
|
|
863
877
|
|
|
878
|
+
void rootScrollImageHoldTick() {}
|
|
879
|
+
#endif
|
|
880
|
+
|
|
864
881
|
} // namespace gea::embedded::ui
|