@geastack/engine 0.1.5 → 0.1.6
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/canvas.cpp +34 -0
- package/css/animation.h +64 -0
- package/css/engine.h +6 -1
- package/package.json +2 -2
- package/ui/absolute_leaf_refresh.cpp +32 -31
- package/ui/core.cpp +9 -1
- package/ui/display_invalidation.cpp +29 -0
- package/ui/flex_balance.h +73 -0
- package/ui/image_node.cpp +24 -20
- package/ui/input.cpp +66 -36
- package/ui/input_render.cpp +13 -13
- package/ui/internal.h +51 -5
- package/ui/layout.cpp +2472 -400
- package/ui/layout_snapshot.cpp +21 -5
- package/ui/node_lifecycle.cpp +28 -3
- package/ui/node_model.h +323 -23
- package/ui/render.cpp +638 -265
- package/ui/root_scroll_refresh.cpp +15 -10
- package/ui/style.cpp +3254 -935
- package/ui/style.h +143 -6
- package/ui/style_values.h +16 -0
- package/ui/text.cpp +378 -103
- package/ui/tree_events.cpp +6 -3
- package/ui/tree_events.h +1 -0
- package/ui/tree_internal.h +19 -0
- package/ui/tree_nodes.cpp +6 -0
- package/ui/tree_render.cpp +71 -21
- package/ui/tree_state.h +54 -0
- package/ui/tree_style.cpp +287 -27
- package/ui/view.cpp +612 -251
package/ui/style.h
CHANGED
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
namespace gea::embedded::ui {
|
|
9
9
|
|
|
10
|
+
int resolveLayoutSizeExpression(int nodeId, int expression, bool horizontal);
|
|
11
|
+
int resolveLineHeightExpression(int nodeId, int expression);
|
|
12
|
+
int resolveLineHeightMultiplier(int nodeId, int bits);
|
|
13
|
+
int resolveLayoutFlexBasis(int nodeId, int percentageBasis, bool horizontal);
|
|
14
|
+
bool resolveLayoutBoxLengths(int nodeId, int percentageBasis);
|
|
15
|
+
bool layoutSizeExpressionUsesPercentage(int nodeId, int expression);
|
|
16
|
+
|
|
10
17
|
enum class Property : int {
|
|
11
18
|
Display = 0,
|
|
12
19
|
FlexDirection,
|
|
@@ -92,6 +99,7 @@ enum class Property : int {
|
|
|
92
99
|
TransformTranslateYPercent,
|
|
93
100
|
TransformScaleX,
|
|
94
101
|
TransformScaleY,
|
|
102
|
+
TransformScaleZ,
|
|
95
103
|
TransformOriginX,
|
|
96
104
|
TransformOriginY,
|
|
97
105
|
Perspective,
|
|
@@ -111,6 +119,86 @@ enum class Property : int {
|
|
|
111
119
|
TextOverflow,
|
|
112
120
|
Backface,
|
|
113
121
|
PointerEvents,
|
|
122
|
+
Order,
|
|
123
|
+
BoxSizing,
|
|
124
|
+
Float,
|
|
125
|
+
Clear,
|
|
126
|
+
WritingMode,
|
|
127
|
+
RowGap,
|
|
128
|
+
ColumnGap,
|
|
129
|
+
RowGapPercent,
|
|
130
|
+
ColumnGapPercent,
|
|
131
|
+
MarginTopAuto,
|
|
132
|
+
MarginRightAuto,
|
|
133
|
+
MarginBottomAuto,
|
|
134
|
+
MarginLeftAuto,
|
|
135
|
+
WidthExpression,
|
|
136
|
+
HeightExpression,
|
|
137
|
+
Direction,
|
|
138
|
+
MarginTopExpression,
|
|
139
|
+
MarginRightExpression,
|
|
140
|
+
MarginBottomExpression,
|
|
141
|
+
MarginLeftExpression,
|
|
142
|
+
PaddingTopExpression,
|
|
143
|
+
PaddingRightExpression,
|
|
144
|
+
PaddingBottomExpression,
|
|
145
|
+
PaddingLeftExpression,
|
|
146
|
+
JustifySelf,
|
|
147
|
+
GridRowStart,
|
|
148
|
+
GridColumnStart,
|
|
149
|
+
GridRowEnd,
|
|
150
|
+
GridColumnEnd,
|
|
151
|
+
TransformPresent,
|
|
152
|
+
RotatePresent,
|
|
153
|
+
ScalePresent,
|
|
154
|
+
FilterPresent,
|
|
155
|
+
AspectRatio,
|
|
156
|
+
FlexLineCount,
|
|
157
|
+
BorderColorCurrent,
|
|
158
|
+
BorderTopColorCurrent,
|
|
159
|
+
BorderRightColorCurrent,
|
|
160
|
+
BorderBottomColorCurrent,
|
|
161
|
+
BorderLeftColorCurrent,
|
|
162
|
+
ColorAlpha,
|
|
163
|
+
BorderAlpha,
|
|
164
|
+
BorderTopAlpha,
|
|
165
|
+
BorderRightAlpha,
|
|
166
|
+
BorderBottomAlpha,
|
|
167
|
+
BorderLeftAlpha,
|
|
168
|
+
BackgroundAlpha,
|
|
169
|
+
BackgroundImage,
|
|
170
|
+
Containment,
|
|
171
|
+
BackgroundClip,
|
|
172
|
+
FlexBasisExpression,
|
|
173
|
+
LineHeightExpression,
|
|
174
|
+
TransformStyle,
|
|
175
|
+
LineHeightMultiplier,
|
|
176
|
+
Visibility,
|
|
177
|
+
TranslatePresent,
|
|
178
|
+
TranslateX,
|
|
179
|
+
TranslateY,
|
|
180
|
+
TranslateZ,
|
|
181
|
+
TranslateXPercent,
|
|
182
|
+
TranslateYPercent,
|
|
183
|
+
TransformTranslateOuterAxes,
|
|
184
|
+
RotateAngle,
|
|
185
|
+
RotateAxisX,
|
|
186
|
+
RotateAxisY,
|
|
187
|
+
RotateAxisZ,
|
|
188
|
+
ScaleX,
|
|
189
|
+
ScaleY,
|
|
190
|
+
ScaleZ,
|
|
191
|
+
BackgroundSizeList,
|
|
192
|
+
BackgroundPositionList,
|
|
193
|
+
BackgroundRepeatList,
|
|
194
|
+
BackgroundAttachmentList,
|
|
195
|
+
BackgroundOriginList,
|
|
196
|
+
MarginTrim,
|
|
197
|
+
BorderTopRelief,
|
|
198
|
+
BorderRightRelief,
|
|
199
|
+
BorderBottomRelief,
|
|
200
|
+
BorderLeftRelief,
|
|
201
|
+
BorderRelief,
|
|
114
202
|
Count
|
|
115
203
|
};
|
|
116
204
|
|
|
@@ -207,7 +295,43 @@ enum class StyleDeclaration : std::uint8_t {
|
|
|
207
295
|
BoxShadow,
|
|
208
296
|
TransformOrigin,
|
|
209
297
|
Perspective,
|
|
210
|
-
PerspectiveOrigin
|
|
298
|
+
PerspectiveOrigin,
|
|
299
|
+
Order,
|
|
300
|
+
BoxSizing,
|
|
301
|
+
Float,
|
|
302
|
+
Clear,
|
|
303
|
+
WritingMode,
|
|
304
|
+
FlexFlow,
|
|
305
|
+
RowGap,
|
|
306
|
+
ColumnGap,
|
|
307
|
+
Direction,
|
|
308
|
+
Font,
|
|
309
|
+
JustifySelf,
|
|
310
|
+
GridTemplate,
|
|
311
|
+
Grid,
|
|
312
|
+
GridRowStart,
|
|
313
|
+
GridColumnStart,
|
|
314
|
+
GridRowEnd,
|
|
315
|
+
GridColumnEnd,
|
|
316
|
+
GridRow,
|
|
317
|
+
GridColumn,
|
|
318
|
+
GridArea,
|
|
319
|
+
AspectRatio,
|
|
320
|
+
FlexLineCount,
|
|
321
|
+
PlaceContent,
|
|
322
|
+
PlaceSelf,
|
|
323
|
+
BackgroundColor,
|
|
324
|
+
BackgroundImage,
|
|
325
|
+
Contain,
|
|
326
|
+
BackgroundClip,
|
|
327
|
+
TransformStyle,
|
|
328
|
+
Visibility,
|
|
329
|
+
Translate,
|
|
330
|
+
BackgroundPosition,
|
|
331
|
+
BackgroundRepeat,
|
|
332
|
+
BackgroundAttachment,
|
|
333
|
+
BackgroundOrigin,
|
|
334
|
+
MarginTrim
|
|
211
335
|
};
|
|
212
336
|
|
|
213
337
|
class Style {
|
|
@@ -230,6 +354,8 @@ public:
|
|
|
230
354
|
void translateY(int value) const { set(Property::TransformTranslateY, value); }
|
|
231
355
|
void rotateDegrees(double value) const;
|
|
232
356
|
void scale(double value) const;
|
|
357
|
+
void cssRotateDegrees(double value) const;
|
|
358
|
+
void cssScale(double value) const;
|
|
233
359
|
void imageId(int value) const { set(Property::ImageId, value); }
|
|
234
360
|
void imageFit(int value) const { set(Property::ImageFit, value); }
|
|
235
361
|
|
|
@@ -262,6 +388,7 @@ struct StaticStyleSimpleSelectorSpec {
|
|
|
262
388
|
bool wantsRoot = false;
|
|
263
389
|
bool wantsFirstChild = false;
|
|
264
390
|
bool wantsLastChild = false;
|
|
391
|
+
bool wantsHover = false;
|
|
265
392
|
};
|
|
266
393
|
|
|
267
394
|
struct StaticStyleSelectorPartSpec {
|
|
@@ -306,7 +433,8 @@ enum class StaticStyleColorProperty : std::uint8_t {
|
|
|
306
433
|
BorderTop,
|
|
307
434
|
BorderRight,
|
|
308
435
|
BorderBottom,
|
|
309
|
-
BorderLeft
|
|
436
|
+
BorderLeft,
|
|
437
|
+
BackgroundColor
|
|
310
438
|
};
|
|
311
439
|
|
|
312
440
|
enum class StaticStyleLengthUnit : std::uint8_t {
|
|
@@ -497,6 +625,8 @@ public:
|
|
|
497
625
|
void endRuleRegistrationBatch();
|
|
498
626
|
void registerRule(const std::string &className, const std::string &property, const std::string &value, const std::string &media = std::string());
|
|
499
627
|
void registerElementRule(const std::string &elementName, const std::string &property, const std::string &value, const std::string &media = std::string());
|
|
628
|
+
// Defaults have lower cascade priority than every author selector.
|
|
629
|
+
void registerUserAgentElementRule(const std::string &elementName, const std::string &property, const std::string &value);
|
|
500
630
|
void registerSelectorRule(const std::string &selector, const std::string &property, const std::string &value, const std::string &media = std::string());
|
|
501
631
|
void registerKeyframeRule(const std::string &name, int offsetPermille, const std::string &property, const std::string &value);
|
|
502
632
|
void registerStaticRule(const char *className, const char *property, const char *value, const char *media = nullptr);
|
|
@@ -542,7 +672,8 @@ public:
|
|
|
542
672
|
StaticStyleLengthSpec translateY,
|
|
543
673
|
StaticStyleLengthSpec translateZ,
|
|
544
674
|
int scaleX,
|
|
545
|
-
int scaleY
|
|
675
|
+
int scaleY,
|
|
676
|
+
int scaleZ = 1000);
|
|
546
677
|
void registerStaticPropertyRule(StaticStyleSelectorKind selectorKind,
|
|
547
678
|
const char *selector,
|
|
548
679
|
Property property,
|
|
@@ -641,7 +772,8 @@ public:
|
|
|
641
772
|
bool hasOverlayGradient,
|
|
642
773
|
StaticStyleBackgroundGridLine gridX,
|
|
643
774
|
StaticStyleBackgroundGridLine gridY,
|
|
644
|
-
const char *media = nullptr
|
|
775
|
+
const char *media = nullptr,
|
|
776
|
+
bool imageOnly = false);
|
|
645
777
|
void registerStaticBackgroundFullRule(StaticStyleSelectorKind selectorKind,
|
|
646
778
|
const char *selector,
|
|
647
779
|
StaticStyleLinearGradientRef gradient,
|
|
@@ -650,7 +782,8 @@ public:
|
|
|
650
782
|
StaticStyleRadialGradientRef radialGradient,
|
|
651
783
|
StaticStyleBackgroundGridLine gridX,
|
|
652
784
|
StaticStyleBackgroundGridLine gridY,
|
|
653
|
-
const char *media = nullptr
|
|
785
|
+
const char *media = nullptr,
|
|
786
|
+
bool imageOnly = false);
|
|
654
787
|
void registerStaticBackgroundSizeRule(StaticStyleSelectorKind selectorKind,
|
|
655
788
|
const char *selector,
|
|
656
789
|
StaticStyleLengthSpec stepX,
|
|
@@ -695,7 +828,8 @@ public:
|
|
|
695
828
|
StaticStyleLengthSpec translateZ,
|
|
696
829
|
int scaleX,
|
|
697
830
|
int scaleY,
|
|
698
|
-
const char *media = nullptr
|
|
831
|
+
const char *media = nullptr,
|
|
832
|
+
int scaleZ = 1000);
|
|
699
833
|
void registerStaticOriginRule(StaticStyleSelectorKind selectorKind,
|
|
700
834
|
const char *selector,
|
|
701
835
|
StaticStyleOriginProperty property,
|
|
@@ -707,10 +841,13 @@ public:
|
|
|
707
841
|
void applyProperty(NodeHandle node, StyleDeclaration declaration, const std::string &value) const;
|
|
708
842
|
void applyProperty(NodeHandle node, const char *property, const std::string &value) const;
|
|
709
843
|
void applyProperty(NodeHandle node, const std::string &property, const std::string &value) const;
|
|
844
|
+
// Preserve CSS px units through device scaling before property-specific rounding.
|
|
845
|
+
bool applyPixelLengthProperty(NodeHandle node, StyleDeclaration declaration, double value) const;
|
|
710
846
|
bool applyNumberProperty(NodeHandle node, StyleDeclaration declaration, double value) const;
|
|
711
847
|
bool applyNumberProperty(NodeHandle node, const char *property, double value) const;
|
|
712
848
|
bool removeProperty(NodeHandle node, const std::string &property) const;
|
|
713
849
|
void recomputeSubtree(int nodeId) const;
|
|
850
|
+
void hoverChanged() const;
|
|
714
851
|
void startCssAnimations(std::uint32_t nowMs) const;
|
|
715
852
|
|
|
716
853
|
private:
|
package/ui/style_values.h
CHANGED
|
@@ -7,8 +7,24 @@
|
|
|
7
7
|
|
|
8
8
|
namespace gea::embedded::ui {
|
|
9
9
|
|
|
10
|
+
struct ComputedStyle;
|
|
11
|
+
struct BackgroundPlacement {
|
|
12
|
+
int x, y, width, height;
|
|
13
|
+
int repeatX = 0, repeatY = 0; // repeat, no-repeat, round, space
|
|
14
|
+
int attachment = 0; // scroll, fixed, local
|
|
15
|
+
int origin = 1; // border, padding, content
|
|
16
|
+
int areaX = 0, areaY = 0, areaWidth = 0, areaHeight = 0;
|
|
17
|
+
};
|
|
18
|
+
|
|
10
19
|
class StyleValues {
|
|
11
20
|
public:
|
|
21
|
+
// Image handles belong to the stylesheet pool; -1 is CSS none.
|
|
22
|
+
static bool applyBackgroundImage(ComputedStyle &style, int handle, int nodeId);
|
|
23
|
+
// 0: border-box, 1: padding-box, 2: content-box. Lists repeat by image layer.
|
|
24
|
+
static int backgroundClip(const ComputedStyle &style, int layer);
|
|
25
|
+
static bool hasTextBackgroundClip(const ComputedStyle &style);
|
|
26
|
+
static BackgroundPlacement backgroundPlacement(const ComputedStyle &style, int nodeId, int layer,
|
|
27
|
+
int x, int y, int width, int height);
|
|
12
28
|
// Convert a raw style-value colour int into this board's native pixel, applied
|
|
13
29
|
// once when the colour is written into node.style. The style-value int holds
|
|
14
30
|
// the authoring colour in the board's pre-panel form: raw (unswapped) RGB565 on
|