@geastack/engine 0.1.7 → 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/canvas.cpp +59 -24
- package/css/engine.h +1 -0
- package/package.json +4 -3
- package/ui/absolute_leaf_refresh.cpp +65 -52
- package/ui/core.cpp +4 -4
- package/ui/css_features.h +87 -0
- package/ui/document.cpp +11 -0
- package/ui/image_node.cpp +24 -24
- package/ui/input.cpp +24 -24
- package/ui/input_render.cpp +27 -27
- package/ui/internal.h +22 -0
- package/ui/layout.cpp +771 -573
- package/ui/layout_snapshot.cpp +1 -1
- package/ui/node_features.h +18 -0
- package/ui/node_lifecycle.cpp +167 -1
- package/ui/node_model.h +216 -56
- package/ui/node_text.h +2 -0
- package/ui/refresh_perf.h +19 -17
- package/ui/render.cpp +203 -189
- package/ui/renderer_features.h +5 -0
- package/ui/root_scroll_refresh.cpp +65 -65
- package/ui/storage_usage.h +45 -0
- package/ui/style.cpp +432 -146
- package/ui/style_values.h +2 -2
- package/ui/text.cpp +151 -153
- package/ui/tree_events.cpp +86 -0
- package/ui/tree_events.h +16 -0
- package/ui/tree_nodes.cpp +21 -17
- package/ui/tree_render.cpp +127 -123
- package/ui/tree_scroll_mirror.cpp +4 -4
- package/ui/tree_state.cpp +78 -6
- package/ui/tree_state.h +49 -4
- package/ui/tree_style.cpp +409 -300
- package/ui/view.cpp +207 -207
- package/ui/virtual_keyboard.cpp +11 -11
package/ui/style.cpp
CHANGED
|
@@ -99,7 +99,9 @@ char g_recprofLast[420];
|
|
|
99
99
|
// those keep their existing computed style (identical to a full recompute). A
|
|
100
100
|
// GEA_INCREMENTAL_VERIFY build additionally runs the full recompute afterwards and
|
|
101
101
|
// asserts every node's style matches, proving equivalence on-device.
|
|
102
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
102
103
|
std::vector<CssAtomId> g_nodeRefOverflow;
|
|
104
|
+
#endif
|
|
103
105
|
|
|
104
106
|
struct CssAtomSmallList {
|
|
105
107
|
static constexpr std::uint8_t kInlineCount = 16;
|
|
@@ -157,6 +159,7 @@ struct CssAtomSmallList {
|
|
|
157
159
|
}
|
|
158
160
|
};
|
|
159
161
|
|
|
162
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
160
163
|
struct NodeCustomPropRefs {
|
|
161
164
|
static constexpr std::uint8_t kInlineCount = 4;
|
|
162
165
|
static constexpr std::uint16_t kNoOverflow = 0xFFFFu;
|
|
@@ -301,37 +304,44 @@ struct CustomPropertyLookupCache {
|
|
|
301
304
|
};
|
|
302
305
|
|
|
303
306
|
CustomPropertyLookupCache g_customPropertyLookupCache;
|
|
307
|
+
#elif !GEA_EMBEDDED_SHARED_STYLES
|
|
308
|
+
bool g_nodeStyleTracked[kMaxNodes]{};
|
|
309
|
+
#endif
|
|
304
310
|
|
|
305
311
|
void clearDynamicLengthExpressionResolutionCache();
|
|
306
312
|
|
|
307
313
|
inline void clearCustomPropertyLookupCache()
|
|
308
314
|
{
|
|
315
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
309
316
|
g_customPropertyLookupCache.clear();
|
|
317
|
+
#endif
|
|
310
318
|
clearDynamicLengthExpressionResolutionCache();
|
|
311
319
|
}
|
|
312
320
|
|
|
313
321
|
struct DenseNodeMark {
|
|
322
|
+
// A mark stores batch identity, not a node index. Byte epochs retain direct
|
|
323
|
+
// loads and halve both dense arrays; clear all marks before epoch reuse.
|
|
314
324
|
#if GEA_EMBEDDED_UI_STATE_DYNAMIC_INIT
|
|
315
|
-
std::
|
|
316
|
-
std::
|
|
325
|
+
std::uint8_t marks[kMaxNodes];
|
|
326
|
+
std::uint8_t serial;
|
|
317
327
|
|
|
318
328
|
// Runtime initialization keeps the nonzero serial out of .data (see
|
|
319
329
|
// state_init.h); noinline stops the compiler folding it back in.
|
|
320
330
|
__attribute__((noinline)) DenseNodeMark()
|
|
321
331
|
{
|
|
322
|
-
for (std::
|
|
332
|
+
for (std::uint8_t &mark : marks) mark = 0;
|
|
323
333
|
serial = 1;
|
|
324
334
|
}
|
|
325
335
|
#else
|
|
326
|
-
std::
|
|
327
|
-
std::
|
|
336
|
+
std::uint8_t marks[kMaxNodes]{};
|
|
337
|
+
std::uint8_t serial = 1;
|
|
328
338
|
#endif
|
|
329
339
|
|
|
330
340
|
void clear()
|
|
331
341
|
{
|
|
332
342
|
++serial;
|
|
333
343
|
if (serial == 0) {
|
|
334
|
-
for (std::
|
|
344
|
+
for (std::uint8_t &mark : marks) mark = 0;
|
|
335
345
|
serial = 1;
|
|
336
346
|
}
|
|
337
347
|
}
|
|
@@ -362,8 +372,12 @@ std::unordered_set<int> g_incrRecomputedNodes; // nodes the incremental pass ac
|
|
|
362
372
|
|
|
363
373
|
inline void recordCustomPropRef(CssAtomId name)
|
|
364
374
|
{
|
|
375
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
365
376
|
if (g_recordingNode < 0 || g_recordingNode >= kMaxNodes || name == kInvalidCssAtom) return;
|
|
366
377
|
g_nodeRefs[g_recordingNode].insert(name);
|
|
378
|
+
#else
|
|
379
|
+
(void)name;
|
|
380
|
+
#endif
|
|
367
381
|
}
|
|
368
382
|
|
|
369
383
|
bool nodeParticipatesInMountedTree(const TreeState &state, int node)
|
|
@@ -445,8 +459,13 @@ bool styleEqualExceptTextPaint(const ComputedStyle &a, const ComputedStyle &b)
|
|
|
445
459
|
GEA_CSS_POSITION_PERCENT_2(a) != GEA_CSS_POSITION_PERCENT_2(b) ||
|
|
446
460
|
GEA_CSS_POSITION_PERCENT_3(a) != GEA_CSS_POSITION_PERCENT_3(b)) return false;
|
|
447
461
|
for (int i = 0; i < 4; ++i) {
|
|
448
|
-
if (
|
|
462
|
+
if (
|
|
463
|
+
#if GEA_CSS_PADDING
|
|
464
|
+
a.padding[i] != b.padding[i] ||
|
|
465
|
+
#endif
|
|
466
|
+
#if GEA_CSS_MARGINS
|
|
449
467
|
a.margin[i] != b.margin[i] ||
|
|
468
|
+
#endif
|
|
450
469
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
451
470
|
ar.margin_expression[i] != br.margin_expression[i] ||
|
|
452
471
|
#endif
|
|
@@ -666,8 +685,12 @@ bool styleEqualExceptLocalDisplayCommands(const ComputedStyle &a, const Computed
|
|
|
666
685
|
GEA_CSS_POSITION_PERCENT_3(a) != GEA_CSS_POSITION_PERCENT_3(b)) return false;
|
|
667
686
|
for (int i = 0; i < 4; ++i) {
|
|
668
687
|
if (boxInset(a, i) != boxInset(b, i) ||
|
|
688
|
+
#if GEA_CSS_PADDING
|
|
669
689
|
a.padding[i] != b.padding[i] ||
|
|
690
|
+
#endif
|
|
691
|
+
#if GEA_CSS_MARGINS
|
|
670
692
|
a.margin[i] != b.margin[i] ||
|
|
693
|
+
#endif
|
|
671
694
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
672
695
|
ar.margin_expression[i] != br.margin_expression[i] ||
|
|
673
696
|
#endif
|
|
@@ -741,7 +764,7 @@ void markClassRecomputeStyleDiff(int node, const ComputedStyle &beforeStyle, int
|
|
|
741
764
|
auto &state = treeState();
|
|
742
765
|
if (node < 0 || node >= state.nodeCount) return;
|
|
743
766
|
Node &target = state.nodes[node];
|
|
744
|
-
if (beforeImageId == target.image_id && styleExactlyEqual(beforeStyle, target.
|
|
767
|
+
if (beforeImageId == target.image_id && styleExactlyEqual(beforeStyle, target.computedStyle()) && !firstLineChanged) return;
|
|
745
768
|
if (!nodeParticipatesInMountedTree(state, node)) return;
|
|
746
769
|
const bool hadRecolor = target.render.bg_recolor_pending;
|
|
747
770
|
const bool canRecolor = !target.render.dirty || hadRecolor;
|
|
@@ -770,12 +793,12 @@ void markClassRecomputeStyleDiff(int node, const ComputedStyle &beforeStyle, int
|
|
|
770
793
|
};
|
|
771
794
|
invalidateText(invalidateText, node);
|
|
772
795
|
}
|
|
773
|
-
if (beforeImageId == target.image_id && styleExactlyEqual(beforeStyle, target.
|
|
796
|
+
if (beforeImageId == target.image_id && styleExactlyEqual(beforeStyle, target.computedStyle()) && firstLineChanged) {
|
|
774
797
|
return;
|
|
775
798
|
}
|
|
776
799
|
|
|
777
|
-
if (beforeImageId == target.image_id && styleEqualExceptTextPaint(beforeStyle, target.
|
|
778
|
-
if (target.type == NodeType::Text || borderUsesCurrentColor(target.
|
|
800
|
+
if (beforeImageId == target.image_id && styleEqualExceptTextPaint(beforeStyle, target.computedStyle())) {
|
|
801
|
+
if (target.type == NodeType::Text || borderUsesCurrentColor(target.computedStyle()) || borderUsesCurrentColor(beforeStyle)) {
|
|
779
802
|
target.render.dirty = 1; // paint-only: text color; geometry untouched
|
|
780
803
|
#if GEA_CSS_SCROLLING
|
|
781
804
|
target.render.non_scroll_dirty = 1;
|
|
@@ -785,7 +808,7 @@ void markClassRecomputeStyleDiff(int node, const ComputedStyle &beforeStyle, int
|
|
|
785
808
|
return;
|
|
786
809
|
}
|
|
787
810
|
|
|
788
|
-
if (beforeImageId == target.image_id && styleEqualExceptPlainBackgroundColor(beforeStyle, target.
|
|
811
|
+
if (beforeImageId == target.image_id && styleEqualExceptPlainBackgroundColor(beforeStyle, target.computedStyle())) {
|
|
789
812
|
// Preserve `bg_recolor_from` across coalesced changes. The in-place recolor
|
|
790
813
|
// rewrites framebuffer pixels equal to `from`. If several background-color
|
|
791
814
|
// changes land between renders (e.g. fast rotary spins A->B->C), overwriting
|
|
@@ -810,13 +833,13 @@ void markClassRecomputeStyleDiff(int node, const ComputedStyle &beforeStyle, int
|
|
|
810
833
|
#if GEA_CSS_SCROLLING
|
|
811
834
|
target.render.non_scroll_dirty = 1;
|
|
812
835
|
#endif
|
|
813
|
-
if (preserves3D(beforeStyle) != preserves3D(target.
|
|
836
|
+
if (preserves3D(beforeStyle) != preserves3D(target.computedStyle()))
|
|
814
837
|
Tree::instance().markDisplayListDirty();
|
|
815
|
-
if (beforeImageId == target.image_id && styleEqualExceptLocalDisplayCommands(beforeStyle, target.
|
|
838
|
+
if (beforeImageId == target.image_id && styleEqualExceptLocalDisplayCommands(beforeStyle, target.computedStyle())) {
|
|
816
839
|
// Local display-command diff: geometry equal by the predicate's
|
|
817
840
|
// construction (transforms ride transform_dirty), so no layout pass.
|
|
818
841
|
const RareStyle &beforeRare = rstyle(beforeStyle);
|
|
819
|
-
const RareStyle &targetRare = rstyle(target.
|
|
842
|
+
const RareStyle &targetRare = rstyle(target.computedStyle());
|
|
820
843
|
if (beforeRare.transform_rotate != targetRare.transform_rotate ||
|
|
821
844
|
beforeRare.transform_translate_outer_axes != targetRare.transform_translate_outer_axes ||
|
|
822
845
|
beforeRare.rotate_angle != targetRare.rotate_angle ||
|
|
@@ -858,8 +881,8 @@ void markClassRecomputeStyleDiff(int node, const ComputedStyle &beforeStyle, int
|
|
|
858
881
|
}
|
|
859
882
|
Tree::instance().markNodeDisplayCommandsDirty(node);
|
|
860
883
|
// Flattened backface visibility changes the whole descendant paint group.
|
|
861
|
-
if (beforeStyle.backface_hidden != target.
|
|
862
|
-
rstyle(beforeStyle).transform_preserve_3d != rstyle(target.
|
|
884
|
+
if (beforeStyle.backface_hidden != target.computedStyle().backface_hidden ||
|
|
885
|
+
rstyle(beforeStyle).transform_preserve_3d != rstyle(target.computedStyle()).transform_preserve_3d)
|
|
863
886
|
Tree::instance().markDisplayListDirty();
|
|
864
887
|
return;
|
|
865
888
|
}
|
|
@@ -1068,6 +1091,11 @@ using CssDeclarationId = StyleDeclaration;
|
|
|
1068
1091
|
CssDeclarationId classifyDeclaration(const char *property)
|
|
1069
1092
|
{
|
|
1070
1093
|
if (!property || !*property) return CssDeclarationId::Unknown;
|
|
1094
|
+
// Position updates are frequent; resolve them before the long declaration list.
|
|
1095
|
+
if (std::strcmp(property, "top") == 0) return CssDeclarationId::Top;
|
|
1096
|
+
if (std::strcmp(property, "left") == 0) return CssDeclarationId::Left;
|
|
1097
|
+
if (std::strcmp(property, "right") == 0) return CssDeclarationId::Right;
|
|
1098
|
+
if (std::strcmp(property, "bottom") == 0) return CssDeclarationId::Bottom;
|
|
1071
1099
|
if (property[0] == '-' && property[1] == '-') return CssDeclarationId::Custom;
|
|
1072
1100
|
if (std::strcmp(property, "color-scheme") == 0 ||
|
|
1073
1101
|
std::strcmp(property, "isolation") == 0 ||
|
|
@@ -1131,10 +1159,6 @@ CssDeclarationId classifyDeclaration(const char *property)
|
|
|
1131
1159
|
if (std::strcmp(property, "margin-left") == 0) return CssDeclarationId::MarginLeft;
|
|
1132
1160
|
if (std::strcmp(property, "position") == 0) return CssDeclarationId::Position;
|
|
1133
1161
|
if (std::strcmp(property, "inset") == 0) return CssDeclarationId::Inset;
|
|
1134
|
-
if (std::strcmp(property, "top") == 0) return CssDeclarationId::Top;
|
|
1135
|
-
if (std::strcmp(property, "right") == 0) return CssDeclarationId::Right;
|
|
1136
|
-
if (std::strcmp(property, "bottom") == 0) return CssDeclarationId::Bottom;
|
|
1137
|
-
if (std::strcmp(property, "left") == 0) return CssDeclarationId::Left;
|
|
1138
1162
|
if (std::strcmp(property, "box-sizing") == 0) return CssDeclarationId::BoxSizing;
|
|
1139
1163
|
if (std::strcmp(property, "float") == 0) return CssDeclarationId::Float;
|
|
1140
1164
|
if (std::strcmp(property, "aspect-ratio") == 0) return CssDeclarationId::AspectRatio;
|
|
@@ -2273,19 +2297,21 @@ std::vector<CssLengthExpression> &compiledCssLengthExpressions()
|
|
|
2273
2297
|
}
|
|
2274
2298
|
|
|
2275
2299
|
struct StaticLengthExpressionResolution {
|
|
2276
|
-
ResolvedCssLength
|
|
2300
|
+
// Reuse ResolvedCssLength's two tail-padding bytes for cache bookkeeping.
|
|
2301
|
+
// All members remain direct loads; the cached value keeps its full precision.
|
|
2302
|
+
[[no_unique_address]] ResolvedCssLength value;
|
|
2277
2303
|
std::uint8_t status = 0; // 0 unknown, 1 dynamic, 2 cacheable
|
|
2278
2304
|
std::uint8_t valid = 0;
|
|
2279
2305
|
};
|
|
2280
2306
|
|
|
2281
2307
|
struct DynamicLengthExpressionResolution {
|
|
2282
2308
|
#if GEA_EMBEDDED_UI_STATE_DYNAMIC_INIT
|
|
2283
|
-
ResolvedCssLength value;
|
|
2309
|
+
[[no_unique_address]] ResolvedCssLength value;
|
|
2310
|
+
std::uint8_t axis;
|
|
2311
|
+
std::uint8_t valid;
|
|
2284
2312
|
std::uint16_t handle;
|
|
2285
2313
|
std::int16_t nodeId;
|
|
2286
2314
|
int basis;
|
|
2287
|
-
std::uint8_t axis;
|
|
2288
|
-
std::uint8_t valid;
|
|
2289
2315
|
|
|
2290
2316
|
// Runtime initialization keeps the nonzero sentinels out of .data (see
|
|
2291
2317
|
// state_init.h); noinline stops the compiler folding them back in.
|
|
@@ -2299,12 +2325,12 @@ struct DynamicLengthExpressionResolution {
|
|
|
2299
2325
|
valid = 0;
|
|
2300
2326
|
}
|
|
2301
2327
|
#else
|
|
2302
|
-
ResolvedCssLength value;
|
|
2328
|
+
[[no_unique_address]] ResolvedCssLength value;
|
|
2329
|
+
std::uint8_t axis = 0;
|
|
2330
|
+
std::uint8_t valid = 0;
|
|
2303
2331
|
std::uint16_t handle = kNoCompiledCssLengthExpression;
|
|
2304
2332
|
std::int16_t nodeId = -1;
|
|
2305
2333
|
int basis = 0;
|
|
2306
|
-
std::uint8_t axis = 0;
|
|
2307
|
-
std::uint8_t valid = 0;
|
|
2308
2334
|
#endif
|
|
2309
2335
|
};
|
|
2310
2336
|
|
|
@@ -3484,6 +3510,7 @@ std::vector<std::string> splitTopLevel(const std::string &value, char delimiter)
|
|
|
3484
3510
|
|
|
3485
3511
|
const NodeCustomProperty *lookupCustomPropertyEntry(int nodeId, CssAtomId name)
|
|
3486
3512
|
{
|
|
3513
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
3487
3514
|
// Record the dependency against the node currently being recomputed (not nodeId:
|
|
3488
3515
|
// pseudo-element resolution looks up from the pseudo node but the dependency
|
|
3489
3516
|
// belongs to its owner, which is g_recordingNode). Record on every lookup, hit or
|
|
@@ -3517,6 +3544,9 @@ const NodeCustomProperty *lookupCustomPropertyEntry(int nodeId, CssAtomId name)
|
|
|
3517
3544
|
}
|
|
3518
3545
|
}
|
|
3519
3546
|
storeVisited(nullptr);
|
|
3547
|
+
#else
|
|
3548
|
+
(void)nodeId; (void)name;
|
|
3549
|
+
#endif
|
|
3520
3550
|
return nullptr;
|
|
3521
3551
|
}
|
|
3522
3552
|
|
|
@@ -3583,17 +3613,17 @@ int percentBasisForNode(int nodeId, LengthAxis axis)
|
|
|
3583
3613
|
int parent = nodeId >= 0 && nodeId < state.nodeCount ? state.nodes[nodeId].parent : -1;
|
|
3584
3614
|
if (parent >= 0 && parent < state.nodeCount) {
|
|
3585
3615
|
const auto &p = state.nodes[parent];
|
|
3586
|
-
const int padding = boxInsets(p.
|
|
3616
|
+
const int padding = boxInsets(p.computedStyle(), axis != LengthAxis::Vertical);
|
|
3587
3617
|
auto contentBasis = [padding](int value) {
|
|
3588
3618
|
value -= padding;
|
|
3589
3619
|
return value < 0 ? 0 : value;
|
|
3590
3620
|
};
|
|
3591
3621
|
if (axis == LengthAxis::Vertical) {
|
|
3592
3622
|
if (p.layout.height > 0) return contentBasis(p.layout.height);
|
|
3593
|
-
if (p.
|
|
3623
|
+
if (p.computedStyle().height != kUnset) return p.computedStyle().box_sizing == 0 ? p.computedStyle().height : contentBasis(p.computedStyle().height);
|
|
3594
3624
|
} else {
|
|
3595
3625
|
if (p.layout.width > 0) return contentBasis(p.layout.width);
|
|
3596
|
-
if (p.
|
|
3626
|
+
if (p.computedStyle().width != kUnset) return p.computedStyle().box_sizing == 0 ? p.computedStyle().width : contentBasis(p.computedStyle().width);
|
|
3597
3627
|
}
|
|
3598
3628
|
}
|
|
3599
3629
|
return axis == LengthAxis::Vertical ? g_viewport_height : g_viewport_width;
|
|
@@ -3640,7 +3670,7 @@ int lineHeightForLength(int nodeId, bool rootRelative)
|
|
|
3640
3670
|
if (basis >= 0 && basis < state.nodeCount &&
|
|
3641
3671
|
(basis == g_fontSizeBasisNode || basis == g_lineHeightBasisNode)) basis = state.nodes[basis].parent;
|
|
3642
3672
|
if (basis >= 0 && basis < state.nodeCount) {
|
|
3643
|
-
const auto &style = state.nodes[basis].
|
|
3673
|
+
const auto &style = state.nodes[basis].computedStyle();
|
|
3644
3674
|
if (style.line_height > 0) return style.line_height;
|
|
3645
3675
|
return TextRenderer::measureHeight(" ", style.font_id, currentFontSizeForNode(basis));
|
|
3646
3676
|
}
|
|
@@ -3652,7 +3682,7 @@ int zeroAdvanceForNode(int nodeId)
|
|
|
3652
3682
|
{
|
|
3653
3683
|
const auto &state = treeState();
|
|
3654
3684
|
nodeId = fontMetricBasisNode(nodeId);
|
|
3655
|
-
const int fontId = nodeId >= 0 && nodeId < state.nodeCount ? state.nodes[nodeId].
|
|
3685
|
+
const int fontId = nodeId >= 0 && nodeId < state.nodeCount ? state.nodes[nodeId].computedStyle().font_id : -1;
|
|
3656
3686
|
return TextRenderer::measureWidth("0", fontId, currentFontSizeForNode(nodeId));
|
|
3657
3687
|
}
|
|
3658
3688
|
|
|
@@ -3861,8 +3891,8 @@ int parseLength(const std::string &value)
|
|
|
3861
3891
|
int currentFontSizeForNode(int nodeId)
|
|
3862
3892
|
{
|
|
3863
3893
|
auto &state = treeState();
|
|
3864
|
-
if (nodeId >= 0 && nodeId < state.nodeCount && state.nodes[nodeId].
|
|
3865
|
-
return state.nodes[nodeId].
|
|
3894
|
+
if (nodeId >= 0 && nodeId < state.nodeCount && state.nodes[nodeId].computedStyle().font_size > 0)
|
|
3895
|
+
return state.nodes[nodeId].computedStyle().font_size;
|
|
3866
3896
|
return cssPixelLength(16.0);
|
|
3867
3897
|
}
|
|
3868
3898
|
|
|
@@ -4174,7 +4204,7 @@ ParsedCssColor parseCssColor(const std::string &value)
|
|
|
4174
4204
|
// RAW (pre-panel-swap) native style-value for colours applied via setStyleValue()
|
|
4175
4205
|
// -> Tree::setStyle() -> StyleValues::pixelFromStyleValue(), which applies the
|
|
4176
4206
|
// panel byte-swap once on 16-bit boards (must be raw here or colours double-swap,
|
|
4177
|
-
// e.g. cream text rendered periwinkle). Colours written straight into node.
|
|
4207
|
+
// e.g. cream text rendered periwinkle). Colours written straight into node.computedStyle()
|
|
4178
4208
|
// (gradient stops, grid lines) bypass that swap and use cssColorNative() instead.
|
|
4179
4209
|
// On full-colour boards there is no panel concept, so both are identical RGBA8888.
|
|
4180
4210
|
gea::framework::graphics::pixel::native_t cssColorStyleValue(const ParsedCssColor &color)
|
|
@@ -7491,7 +7521,7 @@ void applyCompiledGridTemplateValue(NodeHandle node, const CssCompiledGridTempla
|
|
|
7491
7521
|
const int nodeId = node.id();
|
|
7492
7522
|
Node &target = treeState().nodes[nodeId];
|
|
7493
7523
|
const LengthAxis axis = columns ? LengthAxis::Horizontal : LengthAxis::Vertical;
|
|
7494
|
-
RareStyle &rs = rstyleMut(target.
|
|
7524
|
+
RareStyle &rs = rstyleMut(target.mutableStyle());
|
|
7495
7525
|
int8_t *types = columns ? rs.grid_column_type : rs.grid_row_type;
|
|
7496
7526
|
int16_t *values = columns ? rs.grid_column_value : rs.grid_row_value;
|
|
7497
7527
|
int8_t &count = columns ? rs.grid_column_count : rs.grid_row_count;
|
|
@@ -7541,16 +7571,20 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7541
7571
|
&target == &treeState().nodes[g_resolvedFontNode]) return true;
|
|
7542
7572
|
if (g_resolvedLineHeightNode >= 0 && isLineHeightProperty(property) &&
|
|
7543
7573
|
&target == &treeState().nodes[g_resolvedLineHeightNode]) return true;
|
|
7544
|
-
ComputedStyle &style = target.
|
|
7574
|
+
ComputedStyle &style = target.mutableStyle();
|
|
7545
7575
|
switch (property) {
|
|
7546
7576
|
case Property::Display:
|
|
7577
|
+
#if GEA_CSS_DISPLAY_EXPLICIT
|
|
7547
7578
|
style.display_explicit = 1;
|
|
7579
|
+
#endif
|
|
7548
7580
|
style.display = value;
|
|
7549
7581
|
return true;
|
|
7582
|
+
#if GEA_CSS_FLEX_DIRECTION
|
|
7550
7583
|
case Property::FlexDirection:
|
|
7551
7584
|
style.flex_direction_explicit = 1;
|
|
7552
7585
|
style.flex_direction = value;
|
|
7553
7586
|
return true;
|
|
7587
|
+
#endif
|
|
7554
7588
|
#if GEA_CSS_FLEX_WRAP
|
|
7555
7589
|
case Property::FlexWrap: style.flex_wrap = value; return true;
|
|
7556
7590
|
#endif
|
|
@@ -7569,8 +7603,12 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7569
7603
|
#if GEA_CSS_CONTAINMENT
|
|
7570
7604
|
case Property::Containment: rstyleMut(style).containment = value; return true;
|
|
7571
7605
|
#endif
|
|
7606
|
+
#if GEA_CSS_JUSTIFY_CONTENT
|
|
7572
7607
|
case Property::JustifyContent: style.justify_content = value; return true;
|
|
7608
|
+
#endif
|
|
7609
|
+
#if GEA_CSS_ALIGN_ITEMS
|
|
7573
7610
|
case Property::AlignItems: style.align_items = value; return true;
|
|
7611
|
+
#endif
|
|
7574
7612
|
#if GEA_CSS_JUSTIFY_ITEMS
|
|
7575
7613
|
case Property::JustifyItems: style.justify_items = value; return true;
|
|
7576
7614
|
#endif
|
|
@@ -7589,7 +7627,9 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7589
7627
|
case Property::GridRowEnd: rstyleMut(style).grid_line[2] = value; return true;
|
|
7590
7628
|
case Property::GridColumnEnd: rstyleMut(style).grid_line[3] = value; return true;
|
|
7591
7629
|
#endif
|
|
7630
|
+
#if GEA_CSS_BOX_SIZING
|
|
7592
7631
|
case Property::BoxSizing: style.box_sizing = value; return true;
|
|
7632
|
+
#endif
|
|
7593
7633
|
#if GEA_CSS_FLOATS
|
|
7594
7634
|
case Property::Float: style.float_side = value; return true;
|
|
7595
7635
|
#endif
|
|
@@ -7616,10 +7656,18 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7616
7656
|
case Property::RowGapPercent: style.row_gap_percent = value; return true;
|
|
7617
7657
|
case Property::ColumnGapPercent: style.column_gap_percent = value; return true;
|
|
7618
7658
|
#endif
|
|
7659
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
7619
7660
|
case Property::MarginTopAuto: style.margin_auto = (style.margin_auto & ~1) | (value ? 1 : 0); return true;
|
|
7661
|
+
#endif
|
|
7662
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
7620
7663
|
case Property::MarginRightAuto: style.margin_auto = (style.margin_auto & ~2) | (value ? 2 : 0); return true;
|
|
7664
|
+
#endif
|
|
7665
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
7621
7666
|
case Property::MarginBottomAuto: style.margin_auto = (style.margin_auto & ~4) | (value ? 4 : 0); return true;
|
|
7667
|
+
#endif
|
|
7668
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
7622
7669
|
case Property::MarginLeftAuto: style.margin_auto = (style.margin_auto & ~8) | (value ? 8 : 0); return true;
|
|
7670
|
+
#endif
|
|
7623
7671
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
7624
7672
|
case Property::MarginTopExpression: rstyleMut(style).margin_expression[0] = value; return true;
|
|
7625
7673
|
#endif
|
|
@@ -7644,13 +7692,28 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7644
7692
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
7645
7693
|
case Property::PaddingLeftExpression: rstyleMut(style).padding_expression[3] = value; return true;
|
|
7646
7694
|
#endif
|
|
7647
|
-
|
|
7695
|
+
#if GEA_CSS_WIDTH_EXPRESSIONS
|
|
7696
|
+
case Property::WidthExpression:
|
|
7697
|
+
style.width_expression = value;
|
|
7698
|
+
style.width = kUnset;
|
|
7699
|
+
#if GEA_CSS_WIDTH_PERCENT
|
|
7700
|
+
style.width_percent = kUnset;
|
|
7701
|
+
#endif
|
|
7702
|
+
return true;
|
|
7703
|
+
#endif
|
|
7648
7704
|
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
7649
|
-
case Property::HeightExpression:
|
|
7705
|
+
case Property::HeightExpression:
|
|
7706
|
+
style.height_expression = value;
|
|
7707
|
+
style.height = kUnset;
|
|
7708
|
+
#if GEA_CSS_HEIGHT_PERCENT
|
|
7709
|
+
style.height_percent = kUnset;
|
|
7710
|
+
#endif
|
|
7711
|
+
return true;
|
|
7650
7712
|
#endif
|
|
7651
7713
|
#if GEA_CSS_ORDER
|
|
7652
7714
|
case Property::Order: style.order = value; return true;
|
|
7653
7715
|
#endif
|
|
7716
|
+
#if GEA_CSS_GAP
|
|
7654
7717
|
case Property::Gap:
|
|
7655
7718
|
style.gap = value;
|
|
7656
7719
|
#if GEA_CSS_AXIS_GAP
|
|
@@ -7660,40 +7723,59 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7660
7723
|
style.row_gap_percent = style.column_gap_percent = kUnset;
|
|
7661
7724
|
#endif
|
|
7662
7725
|
return true;
|
|
7726
|
+
#endif
|
|
7663
7727
|
case Property::Width:
|
|
7728
|
+
#if GEA_CSS_WIDTH_EXPRESSIONS
|
|
7664
7729
|
style.width_expression = -1;
|
|
7730
|
+
#endif
|
|
7665
7731
|
style.width = value;
|
|
7732
|
+
#if GEA_CSS_WIDTH_PERCENT
|
|
7666
7733
|
style.width_percent = kUnset;
|
|
7734
|
+
#endif
|
|
7667
7735
|
return true;
|
|
7668
7736
|
case Property::Height:
|
|
7669
7737
|
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
7670
7738
|
style.height_expression = -1;
|
|
7671
7739
|
#endif
|
|
7672
7740
|
style.height = value;
|
|
7741
|
+
#if GEA_CSS_HEIGHT_PERCENT
|
|
7673
7742
|
style.height_percent = kUnset;
|
|
7743
|
+
#endif
|
|
7674
7744
|
return true;
|
|
7675
7745
|
case Property::WidthPercent:
|
|
7746
|
+
#if GEA_CSS_WIDTH_EXPRESSIONS
|
|
7676
7747
|
style.width_expression = -1;
|
|
7748
|
+
#endif
|
|
7749
|
+
#if GEA_CSS_WIDTH_PERCENT
|
|
7677
7750
|
style.width_percent = value;
|
|
7751
|
+
#endif
|
|
7678
7752
|
style.width = kUnset;
|
|
7679
7753
|
return true;
|
|
7680
7754
|
case Property::HeightPercent:
|
|
7681
7755
|
#if GEA_CSS_HEIGHT_EXPRESSIONS
|
|
7682
7756
|
style.height_expression = -1;
|
|
7683
7757
|
#endif
|
|
7758
|
+
#if GEA_CSS_HEIGHT_PERCENT
|
|
7684
7759
|
style.height_percent = value;
|
|
7760
|
+
#endif
|
|
7685
7761
|
style.height = kUnset;
|
|
7686
7762
|
return true;
|
|
7687
7763
|
#if GEA_CSS_MIN_WIDTH
|
|
7688
7764
|
case Property::MinWidth: style.min_width = value; return true;
|
|
7689
7765
|
#endif
|
|
7766
|
+
#if GEA_CSS_MIN_HEIGHT
|
|
7690
7767
|
case Property::MinHeight: style.min_height = value; return true;
|
|
7768
|
+
#endif
|
|
7769
|
+
#if GEA_CSS_MAX_WIDTH
|
|
7691
7770
|
case Property::MaxWidth: style.max_width = value; return true;
|
|
7771
|
+
#endif
|
|
7692
7772
|
#if GEA_CSS_MAX_HEIGHT
|
|
7693
7773
|
case Property::MaxHeight: style.max_height = value; return true;
|
|
7694
7774
|
#endif
|
|
7775
|
+
#if GEA_CSS_FLEX_FACTORS
|
|
7695
7776
|
case Property::Flex: style.flex = value; return true;
|
|
7696
7777
|
case Property::FlexShrink: style.flex_shrink = value; return true;
|
|
7778
|
+
#endif
|
|
7697
7779
|
case Property::FlexBasis:
|
|
7698
7780
|
#if GEA_CSS_FLEX_BASIS_EXPRESSIONS
|
|
7699
7781
|
if (rstyle(style).flex_basis_expression >= 0) rstyleMut(style).flex_basis_expression = -1;
|
|
@@ -7710,6 +7792,7 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7710
7792
|
#endif
|
|
7711
7793
|
return true;
|
|
7712
7794
|
#endif
|
|
7795
|
+
#if GEA_CSS_PADDING
|
|
7713
7796
|
case Property::PaddingTop:
|
|
7714
7797
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
7715
7798
|
if (rstyle(style).padding_expression[0] >= 0) rstyleMut(style).padding_expression[0] = -1;
|
|
@@ -7730,26 +7813,45 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7730
7813
|
if (rstyle(style).padding_expression[3] >= 0) rstyleMut(style).padding_expression[3] = -1;
|
|
7731
7814
|
#endif
|
|
7732
7815
|
style.padding[3] = value; return true;
|
|
7816
|
+
#endif
|
|
7817
|
+
#if GEA_CSS_MARGINS
|
|
7733
7818
|
case Property::MarginTop:
|
|
7734
7819
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
7735
7820
|
if (rstyle(style).margin_expression[0] >= 0) rstyleMut(style).margin_expression[0] = -1;
|
|
7736
7821
|
#endif
|
|
7737
|
-
|
|
7822
|
+
|
|
7823
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
7824
|
+
style.margin_auto &= ~1;
|
|
7825
|
+
#endif
|
|
7826
|
+
style.margin[0] = value; return true;
|
|
7738
7827
|
case Property::MarginRight:
|
|
7739
7828
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
7740
7829
|
if (rstyle(style).margin_expression[1] >= 0) rstyleMut(style).margin_expression[1] = -1;
|
|
7741
7830
|
#endif
|
|
7742
|
-
|
|
7831
|
+
|
|
7832
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
7833
|
+
style.margin_auto &= ~2;
|
|
7834
|
+
#endif
|
|
7835
|
+
style.margin[1] = value; return true;
|
|
7743
7836
|
case Property::MarginBottom:
|
|
7744
7837
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
7745
7838
|
if (rstyle(style).margin_expression[2] >= 0) rstyleMut(style).margin_expression[2] = -1;
|
|
7746
7839
|
#endif
|
|
7747
|
-
|
|
7840
|
+
|
|
7841
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
7842
|
+
style.margin_auto &= ~4;
|
|
7843
|
+
#endif
|
|
7844
|
+
style.margin[2] = value; return true;
|
|
7748
7845
|
case Property::MarginLeft:
|
|
7749
7846
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
7750
7847
|
if (rstyle(style).margin_expression[3] >= 0) rstyleMut(style).margin_expression[3] = -1;
|
|
7751
7848
|
#endif
|
|
7752
|
-
|
|
7849
|
+
|
|
7850
|
+
#if GEA_CSS_MARGIN_AUTO
|
|
7851
|
+
style.margin_auto &= ~8;
|
|
7852
|
+
#endif
|
|
7853
|
+
style.margin[3] = value; return true;
|
|
7854
|
+
#endif
|
|
7753
7855
|
case Property::Position: if (value == kPositionFixed) treeState().fixedPositionUsed = true; style.position = value; return true;
|
|
7754
7856
|
case Property::Top:
|
|
7755
7857
|
#if GEA_CSS_POSITION_TOP
|
|
@@ -7847,10 +7949,14 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7847
7949
|
StyleValues::applyBackgroundImage(style, value, static_cast<int>(&target - treeState().nodes));
|
|
7848
7950
|
return true;
|
|
7849
7951
|
case Property::HasBackground: style.has_bg = value; return true;
|
|
7952
|
+
#if GEA_CSS_ACTIVE_BACKGROUND
|
|
7850
7953
|
case Property::ActiveBackgroundColor:
|
|
7851
7954
|
style.active_bg_color = StyleValues::pixelFromStyleValue(value);
|
|
7852
7955
|
return true;
|
|
7956
|
+
#endif
|
|
7957
|
+
#if GEA_CSS_ACTIVE_BACKGROUND
|
|
7853
7958
|
case Property::HasActiveBackground: style.has_active_bg = value; return true;
|
|
7959
|
+
#endif
|
|
7854
7960
|
case Property::Color:
|
|
7855
7961
|
style.text_color = StyleValues::pixelFromStyleValue(value);
|
|
7856
7962
|
#if GEA_CSS_TEXT_ALPHA
|
|
@@ -7890,7 +7996,8 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7890
7996
|
return true;
|
|
7891
7997
|
#endif
|
|
7892
7998
|
case Property::BorderWidth:
|
|
7893
|
-
setComputedBorderWidth(style, -1, value, target.parent >= 0 ? &treeState().nodes[target.parent].
|
|
7999
|
+
setComputedBorderWidth(style, -1, value, target.parent >= 0 ? &treeState().nodes[target.parent].computedStyle() : nullptr); return true;
|
|
8000
|
+
#if GEA_CSS_BORDER_COLORS
|
|
7894
8001
|
case Property::BorderColor:
|
|
7895
8002
|
setBorderColorBinding(style, -1, false);
|
|
7896
8003
|
style.border_color = StyleValues::pixelFromStyleValue(value);
|
|
@@ -7898,6 +8005,7 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7898
8005
|
style.border_alpha = 255;
|
|
7899
8006
|
#endif
|
|
7900
8007
|
return true;
|
|
8008
|
+
#endif
|
|
7901
8009
|
#if GEA_CSS_BORDER_RELIEF
|
|
7902
8010
|
case Property::BorderTopRelief:
|
|
7903
8011
|
case Property::BorderRightRelief:
|
|
@@ -7913,10 +8021,10 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7913
8021
|
return true;
|
|
7914
8022
|
#endif
|
|
7915
8023
|
#if GEA_CSS_SIDE_BORDERS
|
|
7916
|
-
case Property::BorderTopWidth: setComputedBorderWidth(style, 0, value, target.parent >= 0 ? &treeState().nodes[target.parent].
|
|
7917
|
-
case Property::BorderRightWidth: setComputedBorderWidth(style, 1, value, target.parent >= 0 ? &treeState().nodes[target.parent].
|
|
7918
|
-
case Property::BorderBottomWidth: setComputedBorderWidth(style, 2, value, target.parent >= 0 ? &treeState().nodes[target.parent].
|
|
7919
|
-
case Property::BorderLeftWidth: setComputedBorderWidth(style, 3, value, target.parent >= 0 ? &treeState().nodes[target.parent].
|
|
8024
|
+
case Property::BorderTopWidth: setComputedBorderWidth(style, 0, value, target.parent >= 0 ? &treeState().nodes[target.parent].computedStyle() : nullptr); return true;
|
|
8025
|
+
case Property::BorderRightWidth: setComputedBorderWidth(style, 1, value, target.parent >= 0 ? &treeState().nodes[target.parent].computedStyle() : nullptr); return true;
|
|
8026
|
+
case Property::BorderBottomWidth: setComputedBorderWidth(style, 2, value, target.parent >= 0 ? &treeState().nodes[target.parent].computedStyle() : nullptr); return true;
|
|
8027
|
+
case Property::BorderLeftWidth: setComputedBorderWidth(style, 3, value, target.parent >= 0 ? &treeState().nodes[target.parent].computedStyle() : nullptr); return true;
|
|
7920
8028
|
case Property::BorderTopColor:
|
|
7921
8029
|
setBorderColorBinding(style, 0, false);
|
|
7922
8030
|
rstyleMut(style).border_side_color[0] = StyleValues::pixelFromStyleValue(value);
|
|
@@ -7982,34 +8090,50 @@ bool setClassRuleValueFastUnchecked(Node &target, Property property, int value)
|
|
|
7982
8090
|
#endif
|
|
7983
8091
|
case Property::FontId: style.font_id = value; return true;
|
|
7984
8092
|
case Property::FontSize: style.font_size = value; return true;
|
|
8093
|
+
#if GEA_CSS_FONT_WEIGHT
|
|
7985
8094
|
case Property::FontWeight: style.font_weight = value; return true;
|
|
8095
|
+
#endif
|
|
8096
|
+
#if GEA_CSS_LINE_HEIGHT
|
|
7986
8097
|
case Property::LineHeight:
|
|
8098
|
+
#if GEA_CSS_LINE_HEIGHT_MULTIPLIER
|
|
7987
8099
|
if (style.line_height_multiplier >= 0) style.line_height_multiplier = -1;
|
|
8100
|
+
#endif
|
|
7988
8101
|
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
7989
8102
|
if (rstyle(style).line_height_expression >= 0) rstyleMut(style).line_height_expression = -1;
|
|
7990
8103
|
#endif
|
|
7991
8104
|
style.line_height = value; return true;
|
|
7992
8105
|
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
7993
8106
|
case Property::LineHeightExpression:
|
|
8107
|
+
#if GEA_CSS_LINE_HEIGHT_MULTIPLIER
|
|
7994
8108
|
if (style.line_height_multiplier >= 0) style.line_height_multiplier = -1;
|
|
8109
|
+
#endif
|
|
7995
8110
|
rstyleMut(style).line_height_expression = value;
|
|
7996
8111
|
style.line_height = resolveLineHeightExpression(static_cast<int>(&target - treeState().nodes), value); return true;
|
|
7997
8112
|
#endif
|
|
8113
|
+
#if GEA_CSS_LINE_HEIGHT_MULTIPLIER
|
|
7998
8114
|
case Property::LineHeightMultiplier:
|
|
7999
8115
|
style.line_height_multiplier = value;
|
|
8000
8116
|
#if GEA_CSS_LINE_HEIGHT_EXPRESSIONS
|
|
8001
8117
|
if (rstyle(style).line_height_expression >= 0) rstyleMut(style).line_height_expression = -1;
|
|
8002
8118
|
#endif
|
|
8003
8119
|
style.line_height = resolveLineHeightMultiplier(static_cast<int>(&target - treeState().nodes), value); return true;
|
|
8120
|
+
#endif
|
|
8121
|
+
#endif
|
|
8122
|
+
#if GEA_CSS_TEXT_ALIGN
|
|
8004
8123
|
case Property::TextAlign: style.text_align = value; return true;
|
|
8124
|
+
#endif
|
|
8005
8125
|
#if GEA_CSS_TEXT_DECORATION
|
|
8006
8126
|
case Property::TextDecoration: style.text_decoration = value; return true;
|
|
8007
8127
|
#endif
|
|
8008
8128
|
#if GEA_CSS_TEXT_TRANSFORM
|
|
8009
8129
|
case Property::TextTransform: style.text_transform = value; return true;
|
|
8010
8130
|
#endif
|
|
8131
|
+
#if GEA_CSS_WHITE_SPACE
|
|
8011
8132
|
case Property::WhiteSpace: style.white_space = static_cast<std::int8_t>(value); return true;
|
|
8133
|
+
#endif
|
|
8134
|
+
#if GEA_CSS_TEXT_OVERFLOW
|
|
8012
8135
|
case Property::TextOverflow: style.text_overflow = static_cast<std::int8_t>(value); return true;
|
|
8136
|
+
#endif
|
|
8013
8137
|
#if GEA_CSS_TRANSFORMS
|
|
8014
8138
|
case Property::TransformStyle: rstyleMut(style).transform_preserve_3d = value != 0; return true;
|
|
8015
8139
|
#endif
|
|
@@ -8482,7 +8606,7 @@ bool applyTransformComponentsFast(NodeHandle node, const TransformComponents &t,
|
|
|
8482
8606
|
const int nodeId = node.id();
|
|
8483
8607
|
if (nodeId < 0 || nodeId >= state.nodeCount) return true;
|
|
8484
8608
|
Node &target = state.nodes[nodeId];
|
|
8485
|
-
const RareStyle ¤t = rstyle(target.
|
|
8609
|
+
const RareStyle ¤t = rstyle(target.computedStyle());
|
|
8486
8610
|
if (current.transform_rotate_x == static_cast<int16_t>(t.rotateX) &&
|
|
8487
8611
|
current.transform_rotate_y == static_cast<int16_t>(t.rotateY) &&
|
|
8488
8612
|
current.transform_rotate == static_cast<int16_t>(t.rotateZ) &&
|
|
@@ -8495,7 +8619,7 @@ bool applyTransformComponentsFast(NodeHandle node, const TransformComponents &t,
|
|
|
8495
8619
|
current.transform_scale_y == static_cast<int16_t>(t.scaleY) &&
|
|
8496
8620
|
current.transform_scale_z == static_cast<int16_t>(t.scaleZ))
|
|
8497
8621
|
return true;
|
|
8498
|
-
RareStyle &rs = rstyleMut(target.
|
|
8622
|
+
RareStyle &rs = rstyleMut(target.mutableStyle());
|
|
8499
8623
|
rs.transform_rotate_x = static_cast<int16_t>(t.rotateX);
|
|
8500
8624
|
rs.transform_rotate_y = static_cast<int16_t>(t.rotateY);
|
|
8501
8625
|
rs.transform_rotate = static_cast<int16_t>(t.rotateZ);
|
|
@@ -8551,7 +8675,7 @@ bool applyTransformSlotsFast(NodeHandle node, const std::int16_t *slots, StyleAp
|
|
|
8551
8675
|
const int nodeId = node.id();
|
|
8552
8676
|
if (nodeId < 0 || nodeId >= state.nodeCount) return true;
|
|
8553
8677
|
Node &target = state.nodes[nodeId];
|
|
8554
|
-
const RareStyle ¤t = rstyle(target.
|
|
8678
|
+
const RareStyle ¤t = rstyle(target.computedStyle());
|
|
8555
8679
|
if (current.transform_rotate_x == slots[0] &&
|
|
8556
8680
|
current.transform_rotate_y == slots[1] &&
|
|
8557
8681
|
current.transform_rotate == slots[2] &&
|
|
@@ -8564,7 +8688,7 @@ bool applyTransformSlotsFast(NodeHandle node, const std::int16_t *slots, StyleAp
|
|
|
8564
8688
|
current.transform_scale_y == slots[9] &&
|
|
8565
8689
|
current.transform_scale_z == slots[10])
|
|
8566
8690
|
return true;
|
|
8567
|
-
RareStyle &rs = rstyleMut(target.
|
|
8691
|
+
RareStyle &rs = rstyleMut(target.mutableStyle());
|
|
8568
8692
|
rs.transform_rotate_x = slots[0];
|
|
8569
8693
|
rs.transform_rotate_y = slots[1];
|
|
8570
8694
|
rs.transform_rotate = slots[2];
|
|
@@ -8764,7 +8888,7 @@ void applyBackgroundSizeValue(NodeHandle node, const std::string &value)
|
|
|
8764
8888
|
{
|
|
8765
8889
|
if (!node) return;
|
|
8766
8890
|
Node &target = treeState().nodes[node.id()];
|
|
8767
|
-
if (rstyle(target.
|
|
8891
|
+
if (rstyle(target.computedStyle()).bg_grid_axes == 0) return;
|
|
8768
8892
|
const auto layers = splitTopLevel(value, ',');
|
|
8769
8893
|
if (layers.empty()) return;
|
|
8770
8894
|
const auto parts = splitWords(layers[0]);
|
|
@@ -8772,8 +8896,8 @@ void applyBackgroundSizeValue(NodeHandle node, const std::string &value)
|
|
|
8772
8896
|
const int stepX = parseLengthForNode(parts[0], node.id(), LengthAxis::Horizontal);
|
|
8773
8897
|
const int stepY = parseLengthForNode(parts.size() > 1 ? parts[1] : parts[0], node.id(), LengthAxis::Vertical);
|
|
8774
8898
|
#if GEA_EMBEDDED_RENDERER_LINEAR_GRADIENTS || GEA_EMBEDDED_RENDERER_RADIAL_GRADIENTS
|
|
8775
|
-
if (stepX > 0) rstyleMut(target.
|
|
8776
|
-
if (stepY > 0) rstyleMut(target.
|
|
8899
|
+
if (stepX > 0) rstyleMut(target.mutableStyle()).bg_grid_step_x = static_cast<uint16_t>(std::min(stepX, 65535));
|
|
8900
|
+
if (stepY > 0) rstyleMut(target.mutableStyle()).bg_grid_step_y = static_cast<uint16_t>(std::min(stepY, 65535));
|
|
8777
8901
|
#endif
|
|
8778
8902
|
markNodeDisplayCommandsDirtyForStyleApply(node.id());
|
|
8779
8903
|
}
|
|
@@ -8838,7 +8962,7 @@ bool applyAnimatedTransformStyleValueFast(int nodeId, Property property, int val
|
|
|
8838
8962
|
auto &state = treeState();
|
|
8839
8963
|
if (nodeId < 0 || nodeId >= state.nodeCount) return true;
|
|
8840
8964
|
Node &target = state.nodes[nodeId];
|
|
8841
|
-
RareStyle &rs = rstyleMut(target.
|
|
8965
|
+
RareStyle &rs = rstyleMut(target.mutableStyle());
|
|
8842
8966
|
int16_t *slot = animatedTransformSlot(rs, property);
|
|
8843
8967
|
if (!slot) return false;
|
|
8844
8968
|
const int16_t next = static_cast<int16_t>(value);
|
|
@@ -8865,6 +8989,18 @@ bool applyAnimatedTransformStyleValueFast(int nodeId, Property property, int val
|
|
|
8865
8989
|
|
|
8866
8990
|
} // namespace
|
|
8867
8991
|
|
|
8992
|
+
StorageUsage styleDependencyStorageUsage()
|
|
8993
|
+
{
|
|
8994
|
+
StorageUsage usage;
|
|
8995
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
8996
|
+
usage.staticBytes = sizeof(g_nodeRefs) + sizeof(g_nodeRefOverflow) + sizeof(g_recordingNode) + sizeof(g_customPropertyLookupCache);
|
|
8997
|
+
usage.addVector(g_nodeRefOverflow);
|
|
8998
|
+
#elif !GEA_EMBEDDED_SHARED_STYLES
|
|
8999
|
+
usage.staticBytes = sizeof(g_nodeStyleTracked);
|
|
9000
|
+
#endif
|
|
9001
|
+
return usage;
|
|
9002
|
+
}
|
|
9003
|
+
|
|
8868
9004
|
bool layoutSizeExpressionUsesPercentage(int nodeId, int expression)
|
|
8869
9005
|
{
|
|
8870
9006
|
return expression >= 0 && lengthDependsOnInput(
|
|
@@ -8892,7 +9028,7 @@ int resolveLineHeightExpression(int nodeId, int expression)
|
|
|
8892
9028
|
|
|
8893
9029
|
int resolveLayoutFlexBasis(int nodeId, int percentageBasis, bool horizontal)
|
|
8894
9030
|
{
|
|
8895
|
-
const auto &style = treeState().nodes[nodeId].
|
|
9031
|
+
const auto &style = treeState().nodes[nodeId].computedStyle();
|
|
8896
9032
|
const int expression = rstyle(style).flex_basis_expression;
|
|
8897
9033
|
if (expression < 0) return style.flex_basis;
|
|
8898
9034
|
if (percentageBasis < 0 && layoutSizeExpressionUsesPercentage(nodeId, expression)) return kUnset;
|
|
@@ -8908,9 +9044,9 @@ bool resolveLayoutBoxLengths(int nodeId, int percentageBasis)
|
|
|
8908
9044
|
#if GEA_CSS_BOX_EXPRESSIONS
|
|
8909
9045
|
auto &node = treeState().nodes[nodeId];
|
|
8910
9046
|
#if !GEA_EMBEDDED_RARE_STYLE_INLINE
|
|
8911
|
-
if (node.
|
|
9047
|
+
if (node.computedStyle().rare_style < 0) return false;
|
|
8912
9048
|
#endif
|
|
8913
|
-
const RareStyle &rare = rstyle(node.
|
|
9049
|
+
const RareStyle &rare = rstyle(node.computedStyle());
|
|
8914
9050
|
const int previous = g_boxPercentageBasis;
|
|
8915
9051
|
g_boxPercentageBasis = std::max(0, percentageBasis);
|
|
8916
9052
|
bool changed = false;
|
|
@@ -8923,9 +9059,13 @@ bool resolveLayoutBoxLengths(int nodeId, int percentageBasis)
|
|
|
8923
9059
|
// Padding can have a proven unsigned byte range while margin remains
|
|
8924
9060
|
// signed. Keep writes typed; the existing side choice already branches.
|
|
8925
9061
|
if (padding) {
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
9062
|
+
#if GEA_CSS_PADDING
|
|
9063
|
+
if (node.computedStyle().padding[side] != value) { node.mutableStyle().padding[side] = value; changed = true; }
|
|
9064
|
+
#endif
|
|
9065
|
+
} else {
|
|
9066
|
+
#if GEA_CSS_MARGINS
|
|
9067
|
+
if (node.computedStyle().margin[side] != value) { node.mutableStyle().margin[side] = static_cast<int16_t>(value); changed = true; }
|
|
9068
|
+
#endif
|
|
8929
9069
|
}
|
|
8930
9070
|
}
|
|
8931
9071
|
}
|
|
@@ -8997,23 +9137,33 @@ void applyInheritedStyleDefaults(int node)
|
|
|
8997
9137
|
const int parent = state.nodes[node].parent;
|
|
8998
9138
|
if (parent < 0 || parent >= state.nodeCount) return;
|
|
8999
9139
|
|
|
9000
|
-
const auto &parentStyle = state.nodes[parent].
|
|
9001
|
-
auto &style = state.nodes[node].
|
|
9140
|
+
const auto &parentStyle = state.nodes[parent].computedStyle();
|
|
9141
|
+
auto &style = state.nodes[node].mutableStyle();
|
|
9002
9142
|
style.text_color = parentStyle.text_color;
|
|
9003
9143
|
#if GEA_CSS_TEXT_ALPHA
|
|
9004
9144
|
style.text_alpha = parentStyle.text_alpha;
|
|
9005
9145
|
#endif
|
|
9006
9146
|
style.font_id = parentStyle.font_id;
|
|
9007
9147
|
style.font_size = parentStyle.font_size;
|
|
9148
|
+
#if GEA_CSS_FONT_WEIGHT
|
|
9008
9149
|
style.font_weight = parentStyle.font_weight;
|
|
9150
|
+
#endif
|
|
9151
|
+
#if GEA_CSS_LINE_HEIGHT
|
|
9009
9152
|
style.line_height = parentStyle.line_height;
|
|
9153
|
+
#endif
|
|
9154
|
+
#if GEA_CSS_LINE_HEIGHT_MULTIPLIER
|
|
9010
9155
|
if (parentStyle.line_height_multiplier >= 0)
|
|
9011
9156
|
style.line_height_multiplier = parentStyle.line_height_multiplier;
|
|
9157
|
+
#endif
|
|
9158
|
+
#if GEA_CSS_TEXT_ALIGN
|
|
9012
9159
|
style.text_align = parentStyle.text_align;
|
|
9160
|
+
#endif
|
|
9013
9161
|
#if GEA_CSS_TEXT_TRANSFORM
|
|
9014
9162
|
style.text_transform = parentStyle.text_transform;
|
|
9015
9163
|
#endif
|
|
9164
|
+
#if GEA_CSS_WHITE_SPACE
|
|
9016
9165
|
style.white_space = parentStyle.white_space;
|
|
9166
|
+
#endif
|
|
9017
9167
|
#if GEA_CSS_VISIBILITY
|
|
9018
9168
|
style.visibility = parentStyle.visibility;
|
|
9019
9169
|
#endif
|
|
@@ -9190,7 +9340,7 @@ bool applyKnownResolvedPropertyWithSource(NodeHandle node, CssDeclarationId decl
|
|
|
9190
9340
|
if (placement != Property::Count) {
|
|
9191
9341
|
const int parent = Tree::instance().node(nodeId).parent;
|
|
9192
9342
|
const int handle = toLowerAscii(trimCssValue(value)) == "inherit"
|
|
9193
|
-
? (parent >= 0 ? backgroundPlacementHandle(Tree::instance().node(parent).
|
|
9343
|
+
? (parent >= 0 ? backgroundPlacementHandle(Tree::instance().node(parent).computedStyle(), placement) : -1)
|
|
9194
9344
|
: compileBackgroundPlacement(declaration, value);
|
|
9195
9345
|
if (handle >= -1) setStyleValue(node, placement, handle, source);
|
|
9196
9346
|
return true;
|
|
@@ -9241,7 +9391,7 @@ bool applyKnownResolvedPropertyWithSource(NodeHandle node, CssDeclarationId decl
|
|
|
9241
9391
|
case CssDeclarationId::BackgroundClip: {
|
|
9242
9392
|
const int parent = Tree::instance().node(nodeId).parent;
|
|
9243
9393
|
const int clip = toLowerAscii(trimCssValue(value)) == "inherit"
|
|
9244
|
-
? (parent >= 0 ? rstyle(Tree::instance().node(parent).
|
|
9394
|
+
? (parent >= 0 ? rstyle(Tree::instance().node(parent).computedStyle()).bg_clip : 0)
|
|
9245
9395
|
: compileBackgroundClip(value);
|
|
9246
9396
|
if (clip >= 0) setStyleValue(node, Property::BackgroundClip, clip, source);
|
|
9247
9397
|
return true;
|
|
@@ -9249,7 +9399,7 @@ bool applyKnownResolvedPropertyWithSource(NodeHandle node, CssDeclarationId decl
|
|
|
9249
9399
|
case CssDeclarationId::Contain: {
|
|
9250
9400
|
const int parent = Tree::instance().node(nodeId).parent;
|
|
9251
9401
|
const int flags = toLowerAscii(trimCssValue(value)) == "inherit"
|
|
9252
|
-
? (parent >= 0 ? (GEA_CSS_CONTAINMENT ? rstyle(Tree::instance().node(parent).
|
|
9402
|
+
? (parent >= 0 ? (GEA_CSS_CONTAINMENT ? rstyle(Tree::instance().node(parent).computedStyle()).containment : 0) : 0)
|
|
9253
9403
|
: containmentValue(value);
|
|
9254
9404
|
if (flags >= 0) setStyleValue(node, Property::Containment, flags, source);
|
|
9255
9405
|
return true;
|
|
@@ -9263,7 +9413,7 @@ bool applyKnownResolvedPropertyWithSource(NodeHandle node, CssDeclarationId decl
|
|
|
9263
9413
|
}
|
|
9264
9414
|
if (ratio == "inherit") {
|
|
9265
9415
|
const int parent = Tree::instance().node(nodeId).parent;
|
|
9266
|
-
setStyleValue(node, Property::AspectRatio, parent >= 0 ? (GEA_CSS_ASPECT_RATIO ? rstyle(Tree::instance().node(parent).
|
|
9416
|
+
setStyleValue(node, Property::AspectRatio, parent >= 0 ? (GEA_CSS_ASPECT_RATIO ? rstyle(Tree::instance().node(parent).computedStyle()).aspect_ratio : 0) : 0, source);
|
|
9267
9417
|
return true;
|
|
9268
9418
|
}
|
|
9269
9419
|
const auto words = splitFunctionAwareWords(ratio);
|
|
@@ -9314,7 +9464,7 @@ bool applyKnownResolvedPropertyWithSource(NodeHandle node, CssDeclarationId decl
|
|
|
9314
9464
|
case CssDeclarationId::MarginTrim: {
|
|
9315
9465
|
const int parent = Tree::instance().node(nodeId).parent;
|
|
9316
9466
|
const int flags = toLowerAscii(trimCssValue(value)) == "inherit"
|
|
9317
|
-
? (parent >= 0 ? (GEA_CSS_MARGIN_TRIM ? rstyle(Tree::instance().node(parent).
|
|
9467
|
+
? (parent >= 0 ? (GEA_CSS_MARGIN_TRIM ? rstyle(Tree::instance().node(parent).computedStyle()).margin_trim : 0) : 0)
|
|
9318
9468
|
: marginTrimValue(value);
|
|
9319
9469
|
if (flags >= 0) setStyleValue(node, Property::MarginTrim, flags, source);
|
|
9320
9470
|
return true;
|
|
@@ -9390,7 +9540,7 @@ bool applyKnownResolvedPropertyWithSource(NodeHandle node, CssDeclarationId decl
|
|
|
9390
9540
|
case CssDeclarationId::FlexWrap:
|
|
9391
9541
|
if (value == "inherit") {
|
|
9392
9542
|
const int parent = Tree::instance().node(nodeId).parent;
|
|
9393
|
-
setStyleValue(node, Property::FlexWrap, parent >= 0 ? Tree::instance().node(parent).
|
|
9543
|
+
setStyleValue(node, Property::FlexWrap, parent >= 0 ? Tree::instance().node(parent).computedStyle().flex_wrap : 0, source);
|
|
9394
9544
|
} else if (flexWrapValue(value) >= 0) setStyleValue(node, Property::FlexWrap, flexWrapValue(value), source);
|
|
9395
9545
|
return true;
|
|
9396
9546
|
case CssDeclarationId::FlexLineCount: {
|
|
@@ -9398,7 +9548,7 @@ bool applyKnownResolvedPropertyWithSource(NodeHandle node, CssDeclarationId decl
|
|
|
9398
9548
|
if (value == "initial" || value == "unset") setStyleValue(node, Property::FlexLineCount, 1, source);
|
|
9399
9549
|
else if (value == "inherit") {
|
|
9400
9550
|
const int parent = Tree::instance().node(nodeId).parent;
|
|
9401
|
-
setStyleValue(node, Property::FlexLineCount, parent >= 0 ? (GEA_CSS_FLEX_LINE_COUNT ? rstyle(Tree::instance().node(parent).
|
|
9551
|
+
setStyleValue(node, Property::FlexLineCount, parent >= 0 ? (GEA_CSS_FLEX_LINE_COUNT ? rstyle(Tree::instance().node(parent).computedStyle()).flex_line_count : 1) : 1, source);
|
|
9402
9552
|
} else if (parseOrder(value, count) && count >= 1) setStyleValue(node, Property::FlexLineCount, count, source);
|
|
9403
9553
|
return true;
|
|
9404
9554
|
}
|
|
@@ -9437,7 +9587,7 @@ bool applyKnownResolvedPropertyWithSource(NodeHandle node, CssDeclarationId decl
|
|
|
9437
9587
|
if (parent < 0) {
|
|
9438
9588
|
align = justify = declaration == CssDeclarationId::PlaceSelf ? -1 : 0;
|
|
9439
9589
|
} else {
|
|
9440
|
-
const auto &inherited = Tree::instance().node(parent).
|
|
9590
|
+
const auto &inherited = Tree::instance().node(parent).computedStyle();
|
|
9441
9591
|
align = declaration == CssDeclarationId::PlaceItems ? inherited.align_items : declaration == CssDeclarationId::PlaceContent ? inherited.align_content : inherited.align_self;
|
|
9442
9592
|
justify = declaration == CssDeclarationId::PlaceItems ? inherited.justify_items : declaration == CssDeclarationId::PlaceContent ? inherited.justify_content : (GEA_CSS_JUSTIFY_SELF ? rstyle(inherited).justify_self : -1);
|
|
9443
9593
|
}
|
|
@@ -9939,8 +10089,8 @@ bool applyCompiledColorValue(NodeHandle node,
|
|
|
9939
10089
|
Node &target = treeState().nodes[nodeId];
|
|
9940
10090
|
switch (declaration) {
|
|
9941
10091
|
case CssDeclarationId::Color:
|
|
9942
|
-
if (source == StyleApplicationSource::ClassRule && target.
|
|
9943
|
-
target.
|
|
10092
|
+
if (source == StyleApplicationSource::ClassRule && target.computedStyle().text_color == static_cast<style_color_t>(nativeColor) &&
|
|
10093
|
+
target.computedStyle().text_alpha == static_cast<std::uint8_t>(alpha))
|
|
9944
10094
|
return true;
|
|
9945
10095
|
setStyleValueKnownTarget(node, target, Property::Color, styleColor, source);
|
|
9946
10096
|
#if GEA_CSS_TEXT_ALPHA
|
|
@@ -9966,8 +10116,8 @@ bool applyCompiledColorValue(NodeHandle node,
|
|
|
9966
10116
|
markNodeDisplayCommandsDirtyForStyleApply(nodeId);
|
|
9967
10117
|
return true;
|
|
9968
10118
|
case CssDeclarationId::BorderColor:
|
|
9969
|
-
if (source == StyleApplicationSource::ClassRule && target.
|
|
9970
|
-
target.
|
|
10119
|
+
if (source == StyleApplicationSource::ClassRule && target.computedStyle().border_color_flags == 16u && target.computedStyle().border_color == static_cast<style_color_t>(nativeColor) &&
|
|
10120
|
+
target.computedStyle().border_alpha == static_cast<std::uint8_t>(alpha))
|
|
9971
10121
|
return true;
|
|
9972
10122
|
setStyleValueKnownTarget(node, target, Property::BorderColor, styleColor, source);
|
|
9973
10123
|
#if GEA_CSS_BORDER_ALPHA
|
|
@@ -9982,8 +10132,8 @@ bool applyCompiledColorValue(NodeHandle node,
|
|
|
9982
10132
|
const int side = declaration == CssDeclarationId::BorderTopColor ? 0 :
|
|
9983
10133
|
declaration == CssDeclarationId::BorderRightColor ? 1 :
|
|
9984
10134
|
declaration == CssDeclarationId::BorderBottomColor ? 2 : 3;
|
|
9985
|
-
const RareStyle ¤t = rstyle(target.
|
|
9986
|
-
if (source == StyleApplicationSource::ClassRule && (target.
|
|
10135
|
+
const RareStyle ¤t = rstyle(target.computedStyle());
|
|
10136
|
+
if (source == StyleApplicationSource::ClassRule && (target.computedStyle().border_color_flags & (1u << side)) && !borderColorIsCurrent(target.computedStyle(), side) && current.border_side_color[side] == static_cast<style_color_t>(nativeColor) &&
|
|
9987
10137
|
current.border_side_alpha[side] == static_cast<std::uint8_t>(alpha))
|
|
9988
10138
|
return true;
|
|
9989
10139
|
setStyleValueKnownTarget(node, target, borderSideColorProperty(side), styleColor, source);
|
|
@@ -10493,10 +10643,10 @@ bool applyRuntimeBackgroundSizeValue(NodeHandle node,
|
|
|
10493
10643
|
auto &state = treeState();
|
|
10494
10644
|
if (nodeId < 0 || nodeId >= state.nodeCount) return true;
|
|
10495
10645
|
Node &target = state.nodes[nodeId];
|
|
10496
|
-
if (rstyle(target.
|
|
10646
|
+
if (rstyle(target.computedStyle()).bg_grid_axes == 0) return true;
|
|
10497
10647
|
const int stepX = resolveCompiledLengthForNode(stepXLength, nodeId, LengthAxis::Horizontal);
|
|
10498
10648
|
const int stepY = resolveCompiledLengthForNode(stepYLength, nodeId, LengthAxis::Vertical);
|
|
10499
|
-
RareStyle &rs = rstyleMut(target.
|
|
10649
|
+
RareStyle &rs = rstyleMut(target.mutableStyle());
|
|
10500
10650
|
#if GEA_EMBEDDED_RENDERER_LINEAR_GRADIENTS || GEA_EMBEDDED_RENDERER_RADIAL_GRADIENTS
|
|
10501
10651
|
if (stepX > 0) rs.bg_grid_step_x = static_cast<std::uint16_t>(std::min(stepX, 65535));
|
|
10502
10652
|
if (stepY > 0) rs.bg_grid_step_y = static_cast<std::uint16_t>(std::min(stepY, 65535));
|
|
@@ -10990,6 +11140,37 @@ const CssCompiledValue *inlineCompiledStyleValueFor(CssDeclarationId declaration
|
|
|
10990
11140
|
#endif
|
|
10991
11141
|
}
|
|
10992
11142
|
|
|
11143
|
+
// Unitless integers use rawNumber, exactly as parseLengthForNode does.
|
|
11144
|
+
// Units, fractions, expressions and values outside this exact range retain
|
|
11145
|
+
// the general parser (including px device-pixel-ratio conversion).
|
|
11146
|
+
bool applyIntegerPosition(NodeHandle node, CssDeclarationId declaration,
|
|
11147
|
+
const std::string &text, StyleApplicationSource source)
|
|
11148
|
+
{
|
|
11149
|
+
Property property;
|
|
11150
|
+
switch (declaration) {
|
|
11151
|
+
case CssDeclarationId::Top: property = Property::Top; break;
|
|
11152
|
+
case CssDeclarationId::Right: property = Property::Right; break;
|
|
11153
|
+
case CssDeclarationId::Bottom: property = Property::Bottom; break;
|
|
11154
|
+
case CssDeclarationId::Left: property = Property::Left; break;
|
|
11155
|
+
default: return false;
|
|
11156
|
+
}
|
|
11157
|
+
if (text.empty()) return false;
|
|
11158
|
+
std::size_t index = (text[0] == '-' || text[0] == '+') ? 1 : 0;
|
|
11159
|
+
if (index == text.size()) return false;
|
|
11160
|
+
int value = 0;
|
|
11161
|
+
for (; index < text.size(); ++index) {
|
|
11162
|
+
const unsigned digit = static_cast<unsigned char>(text[index]) - '0';
|
|
11163
|
+
if (digit > 9) return false;
|
|
11164
|
+
value = value * 10 + static_cast<int>(digit);
|
|
11165
|
+
if (value > 32767) return false;
|
|
11166
|
+
}
|
|
11167
|
+
#if GEA_EMBEDDED_UI_REFRESH_PERF
|
|
11168
|
+
refreshPerfStatsMutable().treeIntegerPositionFastCalls++;
|
|
11169
|
+
#endif
|
|
11170
|
+
setStyleValue(node, property, rawNumber(text[0] == '-' ? -value : value), source);
|
|
11171
|
+
return true;
|
|
11172
|
+
}
|
|
11173
|
+
|
|
10993
11174
|
void applyPropertyWithSource(NodeHandle node,
|
|
10994
11175
|
CssDeclarationId declaration,
|
|
10995
11176
|
const std::string &rawValue,
|
|
@@ -10998,6 +11179,7 @@ void applyPropertyWithSource(NodeHandle node,
|
|
|
10998
11179
|
if (!node) return;
|
|
10999
11180
|
const int nodeId = node.id();
|
|
11000
11181
|
if (declaration == CssDeclarationId::Unknown) return;
|
|
11182
|
+
if (applyIntegerPosition(node, declaration, rawValue, source)) return;
|
|
11001
11183
|
#if GEA_CSS_GRID
|
|
11002
11184
|
if (source == StyleApplicationSource::Inline &&
|
|
11003
11185
|
(declaration == CssDeclarationId::GridTemplateColumns || declaration == CssDeclarationId::GridTemplateRows ||
|
|
@@ -11151,6 +11333,7 @@ bool removeInlineStyleProperty(NodeHandle node, const std::string &property)
|
|
|
11151
11333
|
{
|
|
11152
11334
|
if (!node) return false;
|
|
11153
11335
|
if (property.rfind("--", 0) == 0) {
|
|
11336
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
11154
11337
|
NodeRareData *rare = rareDataFor(node.id());
|
|
11155
11338
|
if (!rare) return false;
|
|
11156
11339
|
auto &values = rare->inlineCustomProperties.values;
|
|
@@ -11160,6 +11343,9 @@ bool removeInlineStyleProperty(NodeHandle node, const std::string &property)
|
|
|
11160
11343
|
values.erase(end, values.end());
|
|
11161
11344
|
recomputeSubtreeClassStyles(node.id());
|
|
11162
11345
|
return true;
|
|
11346
|
+
#else
|
|
11347
|
+
return false;
|
|
11348
|
+
#endif
|
|
11163
11349
|
}
|
|
11164
11350
|
const int id = node.id();
|
|
11165
11351
|
#if GEA_CSS_GRID
|
|
@@ -12429,7 +12615,10 @@ int ensurePseudoChild(int parent, CssRule::PseudoElement pseudo)
|
|
|
12429
12615
|
|
|
12430
12616
|
#endif
|
|
12431
12617
|
|
|
12432
|
-
|
|
12618
|
+
// The class-list proof also bounds cache keys. Unknown/overflow-capable apps
|
|
12619
|
+
// retain the six-token fast key and the existing uncached fallback beyond it.
|
|
12620
|
+
static constexpr std::size_t kRuleCandidateCacheClassCapacity =
|
|
12621
|
+
GEA_UI_CLASS_OVERFLOW ? 6 : std::min<std::size_t>(6, GEA_UI_CLASS_INLINE_TOKENS);
|
|
12433
12622
|
|
|
12434
12623
|
struct RuleCandidateSignature {
|
|
12435
12624
|
CssAtomId classes[kRuleCandidateCacheClassCapacity]{};
|
|
@@ -12850,16 +13039,24 @@ CssAtomId nodeIdAttributeAtom(int node)
|
|
|
12850
13039
|
}
|
|
12851
13040
|
|
|
12852
13041
|
enum ActiveRuleBucket : std::uint8_t {
|
|
13042
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
12853
13043
|
kActiveMainCustom,
|
|
13044
|
+
#endif
|
|
12854
13045
|
kActiveMainRule,
|
|
12855
13046
|
#if GEA_CSS_PSEUDO_ELEMENTS
|
|
13047
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
12856
13048
|
kActiveBeforeCustom,
|
|
13049
|
+
#endif
|
|
12857
13050
|
kActiveBeforeRule,
|
|
13051
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
12858
13052
|
kActiveAfterCustom,
|
|
13053
|
+
#endif
|
|
12859
13054
|
kActiveAfterRule,
|
|
12860
13055
|
#endif
|
|
12861
13056
|
#if GEA_CSS_FIRST_LINE
|
|
13057
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
12862
13058
|
kActiveFirstLineCustom,
|
|
13059
|
+
#endif
|
|
12863
13060
|
kActiveFirstLineRule,
|
|
12864
13061
|
#endif
|
|
12865
13062
|
#if GEA_CSS_ANIMATIONS
|
|
@@ -12868,6 +13065,19 @@ enum ActiveRuleBucket : std::uint8_t {
|
|
|
12868
13065
|
kActiveRuleBucketCount
|
|
12869
13066
|
};
|
|
12870
13067
|
|
|
13068
|
+
#if !GEA_CSS_CUSTOM_PROPERTIES
|
|
13069
|
+
// Bucket readers already treat negative IDs as empty. Keep that contract
|
|
13070
|
+
// without reserving a bucket, count or offset for an absent CSS feature.
|
|
13071
|
+
static constexpr int kActiveMainCustom = -1;
|
|
13072
|
+
#if GEA_CSS_PSEUDO_ELEMENTS
|
|
13073
|
+
static constexpr int kActiveBeforeCustom = -1;
|
|
13074
|
+
static constexpr int kActiveAfterCustom = -1;
|
|
13075
|
+
#endif
|
|
13076
|
+
#if GEA_CSS_FIRST_LINE
|
|
13077
|
+
static constexpr int kActiveFirstLineCustom = -1;
|
|
13078
|
+
#endif
|
|
13079
|
+
#endif
|
|
13080
|
+
|
|
12871
13081
|
struct ActiveRulePlanCacheEntry;
|
|
12872
13082
|
|
|
12873
13083
|
struct ActiveRulePlan {
|
|
@@ -15083,8 +15293,8 @@ bool applyCachedStyleApplyOpWithSource(NodeHandle node,
|
|
|
15083
15293
|
auto &state = treeState();
|
|
15084
15294
|
if (nodeId < 0 || nodeId >= state.nodeCount) return true;
|
|
15085
15295
|
Node &target = state.nodes[nodeId];
|
|
15086
|
-
if (rstyle(target.
|
|
15087
|
-
RareStyle &rs = rstyleMut(target.
|
|
15296
|
+
if (rstyle(target.computedStyle()).bg_grid_axes == 0) return true;
|
|
15297
|
+
RareStyle &rs = rstyleMut(target.mutableStyle());
|
|
15088
15298
|
#if GEA_EMBEDDED_RENDERER_LINEAR_GRADIENTS || GEA_EMBEDDED_RENDERER_RADIAL_GRADIENTS
|
|
15089
15299
|
if (op.values[0] > 0) rs.bg_grid_step_x = static_cast<std::uint16_t>(op.values[0]);
|
|
15090
15300
|
if (op.values[1] > 0) rs.bg_grid_step_y = static_cast<std::uint16_t>(op.values[1]);
|
|
@@ -15291,7 +15501,11 @@ void applyActiveRuleSpanToNode(int node, const ActiveRulePlan &plan, int bucketI
|
|
|
15291
15501
|
|
|
15292
15502
|
void applyActiveRuleSpansToNode(int node, const ActiveRulePlan &plan, int customBucket, int ruleBucket)
|
|
15293
15503
|
{
|
|
15504
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
15294
15505
|
applyActiveRuleSpanToNode(node, plan, customBucket);
|
|
15506
|
+
#else
|
|
15507
|
+
(void)customBucket;
|
|
15508
|
+
#endif
|
|
15295
15509
|
// Resolve the font cascade before any property consumes its metrics. Keep
|
|
15296
15510
|
// the winning font fixed while replaying the ordinary cascade so intervening
|
|
15297
15511
|
// font declarations cannot change the basis of a padding/line-height/length.
|
|
@@ -15306,9 +15520,11 @@ void applyActiveRuleSpansToNode(int node, const ActiveRulePlan &plan, int custom
|
|
|
15306
15520
|
g_resolvedFontNode = node;
|
|
15307
15521
|
// Inherited unitless numbers are resolved against this element's final font.
|
|
15308
15522
|
// Lengths and percentages inherit their already-computed pixel value.
|
|
15309
|
-
auto &style = treeState().nodes[node].
|
|
15523
|
+
auto &style = treeState().nodes[node].mutableStyle();
|
|
15524
|
+
#if GEA_CSS_LINE_HEIGHT
|
|
15310
15525
|
if (style.line_height_multiplier >= 0)
|
|
15311
15526
|
style.line_height = resolveLineHeightMultiplier(node, style.line_height_multiplier);
|
|
15527
|
+
#endif
|
|
15312
15528
|
// lh consumers need the winning line-height, evaluated using the final font.
|
|
15313
15529
|
applyActiveRuleSpanToNode(node, plan, ruleBucket, 2);
|
|
15314
15530
|
if (const NodeRareData *rd = rareDataFor(node))
|
|
@@ -15425,9 +15641,9 @@ void syncPseudoElementsForNode(int node, const ActiveRulePlan &plan)
|
|
|
15425
15641
|
if (pseudoNode < 0) continue;
|
|
15426
15642
|
if (NodeRareData *rd = rareDataFor(pseudoNode)) rd->customProperties.clear();
|
|
15427
15643
|
clearCustomPropertyLookupCache();
|
|
15428
|
-
int16_t staleRareStyle = treeState().nodes[pseudoNode].
|
|
15644
|
+
int16_t staleRareStyle = treeState().nodes[pseudoNode].computedStyle().rare_style;
|
|
15429
15645
|
Tree::instance().resetStyleForClassRecompute(pseudoNode);
|
|
15430
|
-
if (staleRareStyle >= 0 && treeState().nodes[pseudoNode].
|
|
15646
|
+
if (staleRareStyle >= 0 && treeState().nodes[pseudoNode].computedStyle().rare_style != staleRareStyle)
|
|
15431
15647
|
releaseRareStyle(staleRareStyle);
|
|
15432
15648
|
applyInheritedStyleDefaults(pseudoNode);
|
|
15433
15649
|
applyDefaultStyleOverrides(pseudoNode);
|
|
@@ -15443,7 +15659,7 @@ void recomputeNodeClassStyles(int node)
|
|
|
15443
15659
|
auto &state = treeState();
|
|
15444
15660
|
if (node < 0 || node >= state.nodeCount) return;
|
|
15445
15661
|
|
|
15446
|
-
const ComputedStyle beforeStyle = state.nodes[node].
|
|
15662
|
+
const ComputedStyle beforeStyle = state.nodes[node].computedStyle();
|
|
15447
15663
|
#if GEA_CSS_FIRST_LINE
|
|
15448
15664
|
const FirstLineBackground beforeFirstLine = rareDataFor(node)
|
|
15449
15665
|
? rareDataFor(node)->firstLineBackground : FirstLineBackground{};
|
|
@@ -15454,9 +15670,17 @@ void recomputeNodeClassStyles(int node)
|
|
|
15454
15670
|
// Record this node's custom-property dependencies fresh (lookupCustomProperty
|
|
15455
15671
|
// appends into g_nodeRefs[g_recordingNode] for every var() resolved here,
|
|
15456
15672
|
// including the node's pseudo-elements via syncPseudoElementsForNode below).
|
|
15673
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
15457
15674
|
const int prevRecordingNode = g_recordingNode;
|
|
15458
15675
|
g_recordingNode = node;
|
|
15676
|
+
#endif
|
|
15677
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
15459
15678
|
if (node >= 0 && node < kMaxNodes) g_nodeRefs[node].clearForRecompute();
|
|
15679
|
+
#elif GEA_EMBEDDED_SHARED_STYLES
|
|
15680
|
+
state.nodes[node].class_style_tracked = true;
|
|
15681
|
+
#else
|
|
15682
|
+
g_nodeStyleTracked[node] = true;
|
|
15683
|
+
#endif
|
|
15460
15684
|
#if GEA_RECPROF
|
|
15461
15685
|
g_profNodes++;
|
|
15462
15686
|
int64_t _t = recNow();
|
|
@@ -15513,7 +15737,7 @@ void recomputeNodeClassStyles(int node)
|
|
|
15513
15737
|
#endif
|
|
15514
15738
|
state.styleInvalidationSuppressionDepth--;
|
|
15515
15739
|
markClassRecomputeStyleDiff(node, beforeStyle, beforeImageId, firstLineChanged);
|
|
15516
|
-
if (staleRareStyle >= 0 && state.nodes[node].
|
|
15740
|
+
if (staleRareStyle >= 0 && state.nodes[node].computedStyle().rare_style != staleRareStyle)
|
|
15517
15741
|
releaseRareStyle(staleRareStyle);
|
|
15518
15742
|
#if GEA_RECPROF
|
|
15519
15743
|
g_profMiscUs += recNow() - _t;
|
|
@@ -15527,7 +15751,10 @@ void recomputeNodeClassStyles(int node)
|
|
|
15527
15751
|
#if GEA_RECPROF
|
|
15528
15752
|
g_profPseudoUs += recNow() - _t;
|
|
15529
15753
|
#endif
|
|
15754
|
+
state.nodes[node].internComputedStyle();
|
|
15755
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
15530
15756
|
g_recordingNode = prevRecordingNode;
|
|
15757
|
+
#endif
|
|
15531
15758
|
}
|
|
15532
15759
|
|
|
15533
15760
|
// When set (during the initial app mount), per-op class-style recomputes are
|
|
@@ -15582,16 +15809,36 @@ struct ParentStyleSnapshot {
|
|
|
15582
15809
|
#endif
|
|
15583
15810
|
std::int16_t font_id;
|
|
15584
15811
|
decltype(ComputedStyle::font_size) font_size;
|
|
15812
|
+
#if GEA_CSS_FONT_WEIGHT
|
|
15585
15813
|
std::int16_t font_weight;
|
|
15814
|
+
#else
|
|
15815
|
+
static constexpr std::int16_t font_weight = 400;
|
|
15816
|
+
#endif
|
|
15817
|
+
#if GEA_CSS_LINE_HEIGHT
|
|
15586
15818
|
decltype(ComputedStyle::line_height) line_height;
|
|
15819
|
+
#else
|
|
15820
|
+
static constexpr std::int16_t line_height = 0;
|
|
15821
|
+
#endif
|
|
15822
|
+
#if GEA_CSS_LINE_HEIGHT_MULTIPLIER
|
|
15587
15823
|
std::int32_t line_height_multiplier;
|
|
15824
|
+
#else
|
|
15825
|
+
static constexpr std::int32_t line_height_multiplier = -1;
|
|
15826
|
+
#endif
|
|
15827
|
+
#if GEA_CSS_TEXT_ALIGN
|
|
15588
15828
|
std::uint8_t text_align;
|
|
15829
|
+
#else
|
|
15830
|
+
static constexpr std::uint8_t text_align = 0;
|
|
15831
|
+
#endif
|
|
15589
15832
|
#if GEA_CSS_TEXT_TRANSFORM
|
|
15590
15833
|
std::uint8_t text_transform;
|
|
15591
15834
|
#else
|
|
15592
15835
|
static constexpr std::uint8_t text_transform = 0;
|
|
15593
15836
|
#endif
|
|
15837
|
+
#if GEA_CSS_WHITE_SPACE
|
|
15594
15838
|
std::uint8_t white_space;
|
|
15839
|
+
#else
|
|
15840
|
+
static constexpr std::uint8_t white_space = 0;
|
|
15841
|
+
#endif
|
|
15595
15842
|
#if GEA_CSS_VISIBILITY
|
|
15596
15843
|
std::uint8_t visibility;
|
|
15597
15844
|
#else
|
|
@@ -15600,7 +15847,7 @@ struct ParentStyleSnapshot {
|
|
|
15600
15847
|
#if GEA_CSS_SIDE_BORDERS
|
|
15601
15848
|
std::array<int, 4> border_widths;
|
|
15602
15849
|
#else
|
|
15603
|
-
std::array<decltype(ComputedStyle::border_width)
|
|
15850
|
+
std::array<std::remove_cv_t<decltype(ComputedStyle::border_width)>, 1> border_widths;
|
|
15604
15851
|
#endif
|
|
15605
15852
|
};
|
|
15606
15853
|
|
|
@@ -15613,14 +15860,24 @@ ParentStyleSnapshot snapshotParentStyle(const ComputedStyle &s)
|
|
|
15613
15860
|
#endif
|
|
15614
15861
|
out.font_id = s.font_id;
|
|
15615
15862
|
out.font_size = s.font_size;
|
|
15863
|
+
#if GEA_CSS_FONT_WEIGHT
|
|
15616
15864
|
out.font_weight = s.font_weight;
|
|
15865
|
+
#endif
|
|
15866
|
+
#if GEA_CSS_LINE_HEIGHT
|
|
15617
15867
|
out.line_height = s.line_height;
|
|
15868
|
+
#endif
|
|
15869
|
+
#if GEA_CSS_LINE_HEIGHT_MULTIPLIER
|
|
15618
15870
|
out.line_height_multiplier = s.line_height_multiplier;
|
|
15871
|
+
#endif
|
|
15872
|
+
#if GEA_CSS_TEXT_ALIGN
|
|
15619
15873
|
out.text_align = s.text_align;
|
|
15874
|
+
#endif
|
|
15620
15875
|
#if GEA_CSS_TEXT_TRANSFORM
|
|
15621
15876
|
out.text_transform = s.text_transform;
|
|
15622
15877
|
#endif
|
|
15878
|
+
#if GEA_CSS_WHITE_SPACE
|
|
15623
15879
|
out.white_space = s.white_space;
|
|
15880
|
+
#endif
|
|
15624
15881
|
#if GEA_CSS_VISIBILITY
|
|
15625
15882
|
out.visibility = s.visibility;
|
|
15626
15883
|
#endif
|
|
@@ -15866,9 +16123,18 @@ void recomputeNodeIncremental(int node, const CssAtomSmallList &changedAbove, bo
|
|
|
15866
16123
|
if (node < 0 || node >= state.nodeCount) return;
|
|
15867
16124
|
if (isGeneratedPseudoNode(state.nodes[node])) return;
|
|
15868
16125
|
|
|
16126
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
15869
16127
|
const NodeCustomPropRefs &refs = g_nodeRefs[node];
|
|
15870
16128
|
const bool tracked = refs.tracked;
|
|
15871
16129
|
const bool referencesChanged = refs.touches(changedAbove);
|
|
16130
|
+
#else
|
|
16131
|
+
#if GEA_EMBEDDED_SHARED_STYLES
|
|
16132
|
+
const bool tracked = state.nodes[node].class_style_tracked;
|
|
16133
|
+
#else
|
|
16134
|
+
const bool tracked = g_nodeStyleTracked[node];
|
|
16135
|
+
#endif
|
|
16136
|
+
constexpr bool referencesChanged = false;
|
|
16137
|
+
#endif
|
|
15872
16138
|
const bool directlyChanged = pending.contains(node);
|
|
15873
16139
|
// A never-recorded node (e.g. freshly created this batch) must recompute — we
|
|
15874
16140
|
// have no dependency info to justify skipping it.
|
|
@@ -15888,15 +16154,15 @@ void recomputeNodeIncremental(int node, const CssAtomSmallList &changedAbove, bo
|
|
|
15888
16154
|
#if GEA_INCREMENTAL_VERIFY
|
|
15889
16155
|
g_incrRecomputedNodes.insert(node);
|
|
15890
16156
|
#endif
|
|
15891
|
-
const ParentStyleSnapshot before = snapshotParentStyle(state.nodes[node].
|
|
16157
|
+
const ParentStyleSnapshot before = snapshotParentStyle(state.nodes[node].computedStyle());
|
|
15892
16158
|
CustomPropertySnapshot beforeCustom;
|
|
15893
16159
|
snapshotCustomProperties(rareDataFor(node), beforeCustom);
|
|
15894
16160
|
recomputeNodeClassStyles(node);
|
|
15895
|
-
inheritablesChanged = parentStylesDiffer(before, snapshotParentStyle(state.nodes[node].
|
|
16161
|
+
inheritablesChanged = parentStylesDiffer(before, snapshotParentStyle(state.nodes[node].computedStyle()));
|
|
15896
16162
|
// Reconcile the cascaded custom-property set for descendants: a (re)defined
|
|
15897
16163
|
// property whose value changed is now changed for them; one whose value is
|
|
15898
16164
|
// unchanged shadows any same-named change from above; a removed one un-shadows.
|
|
15899
|
-
static const
|
|
16165
|
+
static const NodeCustomPropertyStore::Values kNoCustomProps;
|
|
15900
16166
|
const NodeRareData *rdCustomAfter = rareDataFor(node);
|
|
15901
16167
|
const auto &afterCustom = rdCustomAfter ? rdCustomAfter->customProperties.values : kNoCustomProps;
|
|
15902
16168
|
for (const auto &kv : afterCustom) {
|
|
@@ -15938,7 +16204,7 @@ void collectSubtreeStyles(int node, std::vector<int> &ids, std::vector<ComputedS
|
|
|
15938
16204
|
auto &state = treeState();
|
|
15939
16205
|
if (node < 0 || node >= state.nodeCount) return;
|
|
15940
16206
|
ids.push_back(node);
|
|
15941
|
-
styles.push_back(state.nodes[node].
|
|
16207
|
+
styles.push_back(state.nodes[node].computedStyle());
|
|
15942
16208
|
imageIds.push_back(state.nodes[node].image_id);
|
|
15943
16209
|
for (int child = state.nodes[node].first_child; child >= 0; child = state.nodes[child].next_sibling)
|
|
15944
16210
|
collectSubtreeStyles(child, ids, styles, imageIds);
|
|
@@ -15957,9 +16223,17 @@ void syncNodeClassAttribute(int node)
|
|
|
15957
16223
|
void recomputeAllClassStyles()
|
|
15958
16224
|
{
|
|
15959
16225
|
auto &state = treeState();
|
|
16226
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
15960
16227
|
g_nodeRefOverflow.clear();
|
|
16228
|
+
#endif
|
|
15961
16229
|
clearCustomPropertyLookupCache();
|
|
16230
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
15962
16231
|
for (auto &refs : g_nodeRefs) refs.reset();
|
|
16232
|
+
#elif GEA_EMBEDDED_SHARED_STYLES
|
|
16233
|
+
for (auto &node : treeState().nodes) node.class_style_tracked = false;
|
|
16234
|
+
#else
|
|
16235
|
+
std::fill(std::begin(g_nodeStyleTracked), std::end(g_nodeStyleTracked), false);
|
|
16236
|
+
#endif
|
|
15963
16237
|
for (int i = 0; i < state.nodeCount; i++) {
|
|
15964
16238
|
if (state.nodes[i].parent < 0) recomputeSubtreeClassStyles(i);
|
|
15965
16239
|
}
|
|
@@ -16308,52 +16582,52 @@ double currentStyleValue(const Node &node, Property property)
|
|
|
16308
16582
|
{
|
|
16309
16583
|
switch (property) {
|
|
16310
16584
|
#if GEA_CSS_TRANSFORMS
|
|
16311
|
-
case Property::TransformRotate: return static_cast<double>(rstyle(node.
|
|
16312
|
-
case Property::TransformRotateX: return static_cast<double>(rstyle(node.
|
|
16313
|
-
case Property::TransformRotateY: return static_cast<double>(rstyle(node.
|
|
16314
|
-
case Property::TransformTranslateOuterAxes: return rstyle(node.
|
|
16315
|
-
case Property::RotateAngle: return static_cast<double>(rstyle(node.
|
|
16316
|
-
case Property::RotateAxisX: return rstyle(node.
|
|
16317
|
-
case Property::RotateAxisY: return rstyle(node.
|
|
16318
|
-
case Property::RotateAxisZ: return rstyle(node.
|
|
16319
|
-
case Property::ScaleX: return rstyle(node.
|
|
16320
|
-
case Property::ScaleY: return rstyle(node.
|
|
16321
|
-
case Property::ScaleZ: return rstyle(node.
|
|
16322
|
-
case Property::RotatePresent: return rstyle(node.
|
|
16323
|
-
case Property::ScalePresent: return rstyle(node.
|
|
16324
|
-
case Property::TranslatePresent: return rstyle(node.
|
|
16325
|
-
case Property::TranslateX: return rstyle(node.
|
|
16326
|
-
case Property::TranslateY: return rstyle(node.
|
|
16327
|
-
case Property::TranslateZ: return rstyle(node.
|
|
16328
|
-
case Property::TranslateXPercent: return rstyle(node.
|
|
16329
|
-
case Property::TranslateYPercent: return rstyle(node.
|
|
16330
|
-
case Property::TransformTranslateX: return rstyle(node.
|
|
16331
|
-
case Property::TransformTranslateY: return rstyle(node.
|
|
16332
|
-
case Property::TransformTranslateZ: return rstyle(node.
|
|
16333
|
-
case Property::TransformTranslateXPercent: return rstyle(node.
|
|
16334
|
-
case Property::TransformTranslateYPercent: return rstyle(node.
|
|
16335
|
-
case Property::TransformScaleX: return rstyle(node.
|
|
16336
|
-
case Property::TransformScaleY: return rstyle(node.
|
|
16337
|
-
case Property::TransformScaleZ: return rstyle(node.
|
|
16338
|
-
#endif
|
|
16339
|
-
case Property::FilterBlur: return (GEA_CSS_FILTERS ? rstyle(node.
|
|
16340
|
-
case Property::Opacity: return node.
|
|
16341
|
-
case Property::Width: return node.
|
|
16342
|
-
case Property::Height: return node.
|
|
16343
|
-
case Property::WidthPercent: return node.
|
|
16344
|
-
case Property::HeightPercent: return node.
|
|
16345
|
-
case Property::LineHeight: return node.
|
|
16346
|
-
case Property::FontWeight: return node.
|
|
16347
|
-
case Property::Top: return GEA_CSS_POSITION_PX_0(node.
|
|
16348
|
-
case Property::Right: return GEA_CSS_POSITION_PX_1(node.
|
|
16349
|
-
case Property::Bottom: return GEA_CSS_POSITION_PX_2(node.
|
|
16350
|
-
case Property::Left: return GEA_CSS_POSITION_PX_3(node.
|
|
16351
|
-
case Property::TopPercent: return GEA_CSS_POSITION_PERCENT_0(node.
|
|
16352
|
-
case Property::RightPercent: return GEA_CSS_POSITION_PERCENT_1(node.
|
|
16353
|
-
case Property::BottomPercent: return GEA_CSS_POSITION_PERCENT_2(node.
|
|
16354
|
-
case Property::LeftPercent: return GEA_CSS_POSITION_PERCENT_3(node.
|
|
16355
|
-
case Property::BackgroundColor: return node.
|
|
16356
|
-
case Property::Color: return node.
|
|
16585
|
+
case Property::TransformRotate: return static_cast<double>(rstyle(node.computedStyle()).transform_rotate) / 10.0;
|
|
16586
|
+
case Property::TransformRotateX: return static_cast<double>(rstyle(node.computedStyle()).transform_rotate_x) / 10.0;
|
|
16587
|
+
case Property::TransformRotateY: return static_cast<double>(rstyle(node.computedStyle()).transform_rotate_y) / 10.0;
|
|
16588
|
+
case Property::TransformTranslateOuterAxes: return rstyle(node.computedStyle()).transform_translate_outer_axes;
|
|
16589
|
+
case Property::RotateAngle: return static_cast<double>(rstyle(node.computedStyle()).rotate_angle) / 10.0;
|
|
16590
|
+
case Property::RotateAxisX: return rstyle(node.computedStyle()).rotate_axis_x;
|
|
16591
|
+
case Property::RotateAxisY: return rstyle(node.computedStyle()).rotate_axis_y;
|
|
16592
|
+
case Property::RotateAxisZ: return rstyle(node.computedStyle()).rotate_axis_z;
|
|
16593
|
+
case Property::ScaleX: return rstyle(node.computedStyle()).scale_x;
|
|
16594
|
+
case Property::ScaleY: return rstyle(node.computedStyle()).scale_y;
|
|
16595
|
+
case Property::ScaleZ: return rstyle(node.computedStyle()).scale_z;
|
|
16596
|
+
case Property::RotatePresent: return rstyle(node.computedStyle()).rotate_present;
|
|
16597
|
+
case Property::ScalePresent: return rstyle(node.computedStyle()).scale_present;
|
|
16598
|
+
case Property::TranslatePresent: return rstyle(node.computedStyle()).translate_present;
|
|
16599
|
+
case Property::TranslateX: return rstyle(node.computedStyle()).translate_x;
|
|
16600
|
+
case Property::TranslateY: return rstyle(node.computedStyle()).translate_y;
|
|
16601
|
+
case Property::TranslateZ: return rstyle(node.computedStyle()).translate_z;
|
|
16602
|
+
case Property::TranslateXPercent: return rstyle(node.computedStyle()).translate_x_percent;
|
|
16603
|
+
case Property::TranslateYPercent: return rstyle(node.computedStyle()).translate_y_percent;
|
|
16604
|
+
case Property::TransformTranslateX: return rstyle(node.computedStyle()).transform_translate_x;
|
|
16605
|
+
case Property::TransformTranslateY: return rstyle(node.computedStyle()).transform_translate_y;
|
|
16606
|
+
case Property::TransformTranslateZ: return rstyle(node.computedStyle()).transform_translate_z;
|
|
16607
|
+
case Property::TransformTranslateXPercent: return rstyle(node.computedStyle()).transform_translate_x_percent;
|
|
16608
|
+
case Property::TransformTranslateYPercent: return rstyle(node.computedStyle()).transform_translate_y_percent;
|
|
16609
|
+
case Property::TransformScaleX: return rstyle(node.computedStyle()).transform_scale_x;
|
|
16610
|
+
case Property::TransformScaleY: return rstyle(node.computedStyle()).transform_scale_y;
|
|
16611
|
+
case Property::TransformScaleZ: return rstyle(node.computedStyle()).transform_scale_z;
|
|
16612
|
+
#endif
|
|
16613
|
+
case Property::FilterBlur: return (GEA_CSS_FILTERS ? rstyle(node.computedStyle()).filter_blur_radius : 0);
|
|
16614
|
+
case Property::Opacity: return node.computedStyle().opacity;
|
|
16615
|
+
case Property::Width: return node.computedStyle().width;
|
|
16616
|
+
case Property::Height: return node.computedStyle().height;
|
|
16617
|
+
case Property::WidthPercent: return node.computedStyle().width_percent == kUnset ? 0 : node.computedStyle().width_percent;
|
|
16618
|
+
case Property::HeightPercent: return node.computedStyle().height_percent == kUnset ? 0 : node.computedStyle().height_percent;
|
|
16619
|
+
case Property::LineHeight: return node.computedStyle().line_height;
|
|
16620
|
+
case Property::FontWeight: return node.computedStyle().font_weight;
|
|
16621
|
+
case Property::Top: return GEA_CSS_POSITION_PX_0(node.computedStyle()) == kUnset ? 0 : GEA_CSS_POSITION_PX_0(node.computedStyle());
|
|
16622
|
+
case Property::Right: return GEA_CSS_POSITION_PX_1(node.computedStyle()) == kUnset ? 0 : GEA_CSS_POSITION_PX_1(node.computedStyle());
|
|
16623
|
+
case Property::Bottom: return GEA_CSS_POSITION_PX_2(node.computedStyle()) == kUnset ? 0 : GEA_CSS_POSITION_PX_2(node.computedStyle());
|
|
16624
|
+
case Property::Left: return GEA_CSS_POSITION_PX_3(node.computedStyle()) == kUnset ? 0 : GEA_CSS_POSITION_PX_3(node.computedStyle());
|
|
16625
|
+
case Property::TopPercent: return GEA_CSS_POSITION_PERCENT_0(node.computedStyle()) == kUnset ? 0 : GEA_CSS_POSITION_PERCENT_0(node.computedStyle());
|
|
16626
|
+
case Property::RightPercent: return GEA_CSS_POSITION_PERCENT_1(node.computedStyle()) == kUnset ? 0 : GEA_CSS_POSITION_PERCENT_1(node.computedStyle());
|
|
16627
|
+
case Property::BottomPercent: return GEA_CSS_POSITION_PERCENT_2(node.computedStyle()) == kUnset ? 0 : GEA_CSS_POSITION_PERCENT_2(node.computedStyle());
|
|
16628
|
+
case Property::LeftPercent: return GEA_CSS_POSITION_PERCENT_3(node.computedStyle()) == kUnset ? 0 : GEA_CSS_POSITION_PERCENT_3(node.computedStyle());
|
|
16629
|
+
case Property::BackgroundColor: return node.computedStyle().bg_color;
|
|
16630
|
+
case Property::Color: return node.computedStyle().text_color;
|
|
16357
16631
|
default: return 0;
|
|
16358
16632
|
}
|
|
16359
16633
|
}
|
|
@@ -16863,8 +17137,8 @@ BackgroundPlacement StyleValues::backgroundPlacement(const ComputedStyle &style,
|
|
|
16863
17137
|
}
|
|
16864
17138
|
if (out.origin != 0) {
|
|
16865
17139
|
int inset[4];
|
|
16866
|
-
for (int i = 0; i < 4; ++i) inset[i] = computedBorderWidth(node.
|
|
16867
|
-
(out.origin == 2 ? std::max<int>(0, node.
|
|
17140
|
+
for (int i = 0; i < 4; ++i) inset[i] = computedBorderWidth(node.computedStyle(), i) +
|
|
17141
|
+
(out.origin == 2 ? std::max<int>(0, node.computedStyle().padding[i]) : 0);
|
|
16868
17142
|
x += inset[3]; y += inset[0]; width -= inset[1]+inset[3]; height -= inset[0]+inset[2];
|
|
16869
17143
|
}
|
|
16870
17144
|
}
|
|
@@ -16976,14 +17250,18 @@ void endStyleMountBatch()
|
|
|
16976
17250
|
const int id = vIds[i];
|
|
16977
17251
|
// Field-wise compare (ComputedStyle has padding, so memcmp gives false diffs).
|
|
16978
17252
|
// styleEqualExceptTextPaint covers every field but text_color, which we add.
|
|
16979
|
-
const bool equal = styleEqualExceptTextPaint(vStyles[i], state.nodes[id].
|
|
16980
|
-
vStyles[i].text_color == state.nodes[id].
|
|
17253
|
+
const bool equal = styleEqualExceptTextPaint(vStyles[i], state.nodes[id].computedStyle()) &&
|
|
17254
|
+
vStyles[i].text_color == state.nodes[id].computedStyle().text_color &&
|
|
16981
17255
|
vImg[i] == state.nodes[id].image_id;
|
|
16982
17256
|
if (!equal) {
|
|
16983
17257
|
mismatches++;
|
|
16984
17258
|
if (logged < 8) {
|
|
16985
17259
|
const bool recomputed = g_incrRecomputedNodes.count(id) > 0;
|
|
17260
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
16986
17261
|
const std::string refs = (id >= 0 && id < kMaxNodes) ? g_nodeRefs[id].debugString() : std::string();
|
|
17262
|
+
#else
|
|
17263
|
+
const std::string refs;
|
|
17264
|
+
#endif
|
|
16987
17265
|
GEA_STYLE_LOGW("gea.recincr", " mismatch node=%d tag=%s class=[%s] incrRecomputed=%d refs=[%s]", id,
|
|
16988
17266
|
tagFromId(state.nodes[id].tag_id), state.classLists[id].value().c_str(), recomputed ? 1 : 0,
|
|
16989
17267
|
refs.c_str());
|
|
@@ -17091,9 +17369,17 @@ void StyleSheet::clear()
|
|
|
17091
17369
|
#endif
|
|
17092
17370
|
invalidateRuleIndex();
|
|
17093
17371
|
clearSelectorPartsCache();
|
|
17372
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
17094
17373
|
g_nodeRefOverflow.clear();
|
|
17374
|
+
#endif
|
|
17095
17375
|
clearCustomPropertyLookupCache();
|
|
17096
|
-
|
|
17376
|
+
#if GEA_CSS_CUSTOM_PROPERTIES
|
|
17377
|
+
for (auto &refs : g_nodeRefs) refs.reset();
|
|
17378
|
+
#elif GEA_EMBEDDED_SHARED_STYLES
|
|
17379
|
+
for (auto &node : treeState().nodes) node.class_style_tracked = false;
|
|
17380
|
+
#else
|
|
17381
|
+
std::fill(std::begin(g_nodeStyleTracked), std::end(g_nodeStyleTracked), false);
|
|
17382
|
+
#endif
|
|
17097
17383
|
g_pendingRecomputeMark.clear();
|
|
17098
17384
|
g_forceFullSubtreeMark.clear();
|
|
17099
17385
|
recomputeAllClassStyles();
|
|
@@ -17736,7 +18022,7 @@ void StyleSheet::startCssAnimations(std::uint32_t nowMs) const
|
|
|
17736
18022
|
if (g_ruleIndex.animationRules.empty()) return;
|
|
17737
18023
|
auto &state = treeState();
|
|
17738
18024
|
for (int node = 0; node < state.nodeCount; ++node) {
|
|
17739
|
-
if (isDisplayNone(state.nodes[node].
|
|
18025
|
+
if (isDisplayNone(state.nodes[node].computedStyle())) continue;
|
|
17740
18026
|
const CssAnimationSpec spec = animationSpecForNode(node);
|
|
17741
18027
|
startAnimationForNode(node, spec, nowMs);
|
|
17742
18028
|
}
|