@geastack/engine 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,33 +14,49 @@ Mirror &Mirror::instance()
14
14
 
15
15
  bool Mirror::scrollDirtyAny() const
16
16
  {
17
+ #if GEA_CSS_SCROLLING
17
18
  return treeState().scrollDirtyAny;
19
+ #else
20
+ return false;
21
+ #endif
18
22
  }
19
23
 
20
24
  void Mirror::copyScrollDirty(uint64_t *dst, int word_count) const
21
25
  {
26
+ #if GEA_CSS_SCROLLING
22
27
  if (!dst || word_count <= 0) return;
23
28
  auto &state = treeState();
24
29
  for (int i = 0; i < word_count; i++)
25
30
  dst[i] = i < kScrollDirtyWordCount ? state.scrollDirtyNodes[i] : 0;
31
+ #else
32
+ if (dst && word_count > 0) std::fill_n(dst, word_count, uint64_t{0});
33
+ #endif
26
34
  }
27
35
 
28
36
  void Mirror::clearScrollDirty() const
29
37
  {
38
+ #if GEA_CSS_SCROLLING
30
39
  auto &state = treeState();
31
40
  for (int i = 0; i < kScrollDirtyWordCount; i++)
32
41
  state.scrollDirtyNodes[i] = 0;
33
42
  state.scrollDirtyAny = false;
43
+ #else
44
+
45
+ #endif
34
46
  }
35
47
 
36
48
  bool Mirror::nodeIsScrollable(int node) const
37
49
  {
50
+ #if GEA_CSS_SCROLLING
38
51
  auto &state = treeState();
39
52
  if (node < 0 || node >= state.nodeCount) return false;
40
53
  Node *n = &state.nodes[node];
41
54
  return isViewLikeNodeType(n->type) &&
42
- ((n->type != NodeType::VirtualList && scrollsOverflowX(n->style) && ViewRenderer::scrollMaxX(*n) > 0) ||
43
- ((n->type == NodeType::VirtualList || scrollsOverflowY(n->style)) && ViewRenderer::scrollMaxY(*n) > 0));
55
+ ((n->type != NodeType::VirtualList && scrollsOverflowX(n->computedStyle()) && ViewRenderer::scrollMaxX(*n) > 0) ||
56
+ ((n->type == NodeType::VirtualList || scrollsOverflowY(n->computedStyle())) && ViewRenderer::scrollMaxY(*n) > 0));
57
+ #else
58
+ (void)node; return false;
59
+ #endif
44
60
  }
45
61
 
46
62
  int Mirror::scrollX(int node) const
@@ -52,10 +68,11 @@ int Mirror::scrollX(int node) const
52
68
 
53
69
  void Mirror::setScrollX(int node, int scroll_x) const
54
70
  {
71
+ #if GEA_CSS_SCROLLING
55
72
  auto &state = treeState();
56
73
  if (node < 0 || node >= state.nodeCount) return;
57
74
  Node *n = &state.nodes[node];
58
- if (!isViewLikeNodeType(n->type) || !scrollsOverflowX(n->style) || n->type == NodeType::VirtualList) return;
75
+ if (!isViewLikeNodeType(n->type) || !scrollsOverflowX(n->computedStyle()) || n->type == NodeType::VirtualList) return;
59
76
 
60
77
  int max_x = ViewRenderer::scrollMaxX(*n);
61
78
  if (scroll_x < 0) scroll_x = 0;
@@ -65,10 +82,15 @@ void Mirror::setScrollX(int node, int scroll_x) const
65
82
  n->layout.scroll_x = scroll_x;
66
83
  n->render.dirty = 1;
67
84
  n->render.layout_dirty = 1;
85
+ #if GEA_CSS_SCROLLING
68
86
  n->render.non_scroll_dirty = 1;
87
+ #endif
69
88
  n->render.scroll_dirty = 1;
70
89
  state.scrollDirtyNodes[node / 64] |= (1ull << (node % 64));
71
90
  state.scrollDirtyAny = true;
91
+ #else
92
+ (void)node; (void)scroll_x;
93
+ #endif
72
94
  }
73
95
 
74
96
  int Mirror::scrollY(int node) const
@@ -80,10 +102,11 @@ int Mirror::scrollY(int node) const
80
102
 
81
103
  void Mirror::setScrollY(int node, int scroll_y) const
82
104
  {
105
+ #if GEA_CSS_SCROLLING
83
106
  auto &state = treeState();
84
107
  if (node < 0 || node >= state.nodeCount) return;
85
108
  Node *n = &state.nodes[node];
86
- if (!isViewLikeNodeType(n->type) || (n->type != NodeType::VirtualList && !scrollsOverflowY(n->style))) return;
109
+ if (!isViewLikeNodeType(n->type) || (n->type != NodeType::VirtualList && !scrollsOverflowY(n->computedStyle()))) return;
87
110
 
88
111
  int max_y = ViewRenderer::scrollMaxY(*n);
89
112
  if (scroll_y < 0) scroll_y = 0;
@@ -96,6 +119,9 @@ void Mirror::setScrollY(int node, int scroll_y) const
96
119
  n->render.scroll_dirty = 1;
97
120
  state.scrollDirtyNodes[node / 64] |= (1ull << (node % 64));
98
121
  state.scrollDirtyAny = true;
122
+ #else
123
+ (void)node; (void)scroll_y;
124
+ #endif
99
125
  }
100
126
 
101
127
  } // namespace gea::embedded::ui