@geastack/engine 0.1.21 → 0.1.22
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 +24 -0
- package/image_store.cpp +308 -1
- package/package.json +1 -1
- package/ui/canvas_element.cpp +12 -16
- package/ui/core.cpp +10 -7
- package/ui/document.cpp +25 -0
- package/ui/input.cpp +332 -11
- package/ui/input_render.cpp +62 -17
- package/ui/input_retirement.h +3 -0
- package/ui/internal.h +34 -0
- package/ui/layout.cpp +68 -16
- package/ui/layout_snapshot.cpp +119 -70
- package/ui/layout_snapshot.h +1 -0
- package/ui/node_model.h +6 -1
- package/ui/render.cpp +1126 -64
- package/ui/root_scroll_refresh.cpp +372 -66
- package/ui/root_scroll_refresh.h +4 -0
- package/ui/style.cpp +38 -21
- package/ui/svg_element.h +5 -2
- package/ui/svg_element_impl.h +475 -36
- package/ui/svg_geometry.h +78 -13
- package/ui/text.cpp +7 -6
- package/ui/tree_internal.h +12 -0
- package/ui/tree_nodes.cpp +1 -0
- package/ui/tree_render.cpp +263 -23
- package/ui/tree_state.h +9 -0
- package/ui/tree_style.cpp +8 -0
- package/ui/view.cpp +27 -9
- package/ui/viewport_region.cpp +53 -0
- package/ui/viewport_region.h +3 -0
- package/ui/virtual_keyboard.cpp +279 -23
- package/ui/virtual_keyboard_icons.h +114 -0
package/ui/style.cpp
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
#include <cstring>
|
|
27
27
|
#include <deque>
|
|
28
28
|
#include <initializer_list>
|
|
29
|
+
#include <new>
|
|
29
30
|
#include <string>
|
|
30
31
|
#include <unordered_map>
|
|
31
32
|
#include <unordered_set>
|
|
@@ -13687,42 +13688,49 @@ __attribute__((noinline)) ActiveRulePlanCacheEntry::ActiveRulePlanCacheEntry()
|
|
|
13687
13688
|
}
|
|
13688
13689
|
#endif
|
|
13689
13690
|
|
|
13691
|
+
// Entries past the inline array live in fixed-size chunks allocated with a
|
|
13692
|
+
// nothrow new. A cache must never abort the device: when a chunk cannot be
|
|
13693
|
+
// allocated, tryEmplaceBack returns null and the plan simply goes uncached.
|
|
13694
|
+
// Chunks also avoid the doubling reallocation of a vector, which needed one
|
|
13695
|
+
// contiguous block of up to ~38 KB at boot on boards with fragmented heaps.
|
|
13690
13696
|
class ActiveRulePlanCacheStore {
|
|
13691
13697
|
public:
|
|
13692
|
-
std::size_t
|
|
13698
|
+
static constexpr std::size_t kCapacityLimit = 64;
|
|
13699
|
+
|
|
13700
|
+
std::size_t size() const { return inlineCount_ + spillCount_; }
|
|
13693
13701
|
|
|
13694
13702
|
ActiveRulePlanCacheEntry &operator[](std::size_t index)
|
|
13695
13703
|
{
|
|
13696
|
-
return index < inlineCount_ ? inline_[index] :
|
|
13704
|
+
return index < inlineCount_ ? inline_[index] : spillAt(index - inlineCount_);
|
|
13697
13705
|
}
|
|
13698
13706
|
|
|
13699
13707
|
const ActiveRulePlanCacheEntry &operator[](std::size_t index) const
|
|
13700
13708
|
{
|
|
13701
|
-
return index < inlineCount_ ? inline_[index] :
|
|
13709
|
+
return index < inlineCount_ ? inline_[index] : spillAt(index - inlineCount_);
|
|
13702
13710
|
}
|
|
13703
13711
|
|
|
13704
|
-
ActiveRulePlanCacheEntry
|
|
13712
|
+
ActiveRulePlanCacheEntry *tryEmplaceBack()
|
|
13705
13713
|
{
|
|
13706
13714
|
if (inlineCount_ < kInlineCapacity) {
|
|
13707
13715
|
ActiveRulePlanCacheEntry &entry = inline_[inlineCount_++];
|
|
13708
13716
|
resetActiveRulePlanCacheEntry(entry);
|
|
13709
|
-
return entry;
|
|
13717
|
+
return &entry;
|
|
13710
13718
|
}
|
|
13711
|
-
|
|
13712
|
-
|
|
13719
|
+
const std::size_t chunk = spillCount_ / kChunkEntries;
|
|
13720
|
+
if (chunk >= kMaxChunks) return nullptr;
|
|
13721
|
+
if (!chunks_[chunk]) {
|
|
13722
|
+
chunks_[chunk] = new (std::nothrow) ActiveRulePlanCacheEntry[kChunkEntries];
|
|
13723
|
+
if (!chunks_[chunk]) return nullptr;
|
|
13724
|
+
}
|
|
13725
|
+
ActiveRulePlanCacheEntry &entry = spillAt(spillCount_++);
|
|
13713
13726
|
resetActiveRulePlanCacheEntry(entry);
|
|
13714
|
-
return entry;
|
|
13715
|
-
}
|
|
13716
|
-
|
|
13717
|
-
ActiveRulePlanCacheEntry &back()
|
|
13718
|
-
{
|
|
13719
|
-
return spill_.empty() ? inline_[inlineCount_ - 1] : spill_.back();
|
|
13727
|
+
return &entry;
|
|
13720
13728
|
}
|
|
13721
13729
|
|
|
13722
13730
|
void pop_back()
|
|
13723
13731
|
{
|
|
13724
|
-
if (
|
|
13725
|
-
|
|
13732
|
+
if (spillCount_) {
|
|
13733
|
+
resetActiveRulePlanCacheEntry(spillAt(--spillCount_));
|
|
13726
13734
|
return;
|
|
13727
13735
|
}
|
|
13728
13736
|
if (inlineCount_ == 0) return;
|
|
@@ -13732,16 +13740,25 @@ public:
|
|
|
13732
13740
|
void clear()
|
|
13733
13741
|
{
|
|
13734
13742
|
for (std::size_t i = 0; i < inlineCount_; ++i) resetActiveRulePlanCacheEntry(inline_[i]);
|
|
13743
|
+
for (std::size_t i = 0; i < spillCount_; ++i) resetActiveRulePlanCacheEntry(spillAt(i));
|
|
13735
13744
|
inlineCount_ = 0;
|
|
13736
|
-
|
|
13745
|
+
spillCount_ = 0;
|
|
13737
13746
|
}
|
|
13738
13747
|
|
|
13739
13748
|
private:
|
|
13740
13749
|
static constexpr std::size_t kInlineCapacity =
|
|
13741
13750
|
static_cast<std::size_t>(GEA_CSS_ACTIVE_RULE_PLAN_INLINE_CACHE_ENTRIES);
|
|
13751
|
+
static constexpr std::size_t kChunkEntries = 8;
|
|
13752
|
+
static constexpr std::size_t kMaxChunks =
|
|
13753
|
+
kCapacityLimit > kInlineCapacity ? (kCapacityLimit - kInlineCapacity + kChunkEntries - 1) / kChunkEntries : 0;
|
|
13754
|
+
|
|
13755
|
+
ActiveRulePlanCacheEntry &spillAt(std::size_t i) { return chunks_[i / kChunkEntries][i % kChunkEntries]; }
|
|
13756
|
+
const ActiveRulePlanCacheEntry &spillAt(std::size_t i) const { return chunks_[i / kChunkEntries][i % kChunkEntries]; }
|
|
13757
|
+
|
|
13742
13758
|
std::array<ActiveRulePlanCacheEntry, kInlineCapacity> inline_{};
|
|
13743
|
-
std::
|
|
13759
|
+
std::array<ActiveRulePlanCacheEntry *, (kMaxChunks ? kMaxChunks : 1)> chunks_{};
|
|
13744
13760
|
std::size_t inlineCount_ = 0;
|
|
13761
|
+
std::size_t spillCount_ = 0;
|
|
13745
13762
|
};
|
|
13746
13763
|
|
|
13747
13764
|
ActiveRulePlanCacheStore &activeRulePlanCache()
|
|
@@ -14639,12 +14656,12 @@ std::uint16_t cachedStyleApplyOpForCompiledValue(const CssCompiledValue *compile
|
|
|
14639
14656
|
|
|
14640
14657
|
void storeActiveRulePlanForSignature(const RuleCandidateSignature &signature, const ActiveRulePlan &plan)
|
|
14641
14658
|
{
|
|
14642
|
-
static constexpr std::size_t kActiveRulePlanCacheLimit = 64;
|
|
14643
14659
|
if (!activeRulePlanFitsCache(plan)) return;
|
|
14644
14660
|
auto &cache = activeRulePlanCache();
|
|
14645
|
-
if (cache.size() >=
|
|
14646
|
-
cache.
|
|
14647
|
-
|
|
14661
|
+
if (cache.size() >= ActiveRulePlanCacheStore::kCapacityLimit) return;
|
|
14662
|
+
ActiveRulePlanCacheEntry *slot = cache.tryEmplaceBack();
|
|
14663
|
+
if (!slot) return;
|
|
14664
|
+
ActiveRulePlanCacheEntry &entry = *slot;
|
|
14648
14665
|
activeRulePlanCacheLastHit() = cache.size() - 1;
|
|
14649
14666
|
copyActiveRulePlanSignature(entry, signature);
|
|
14650
14667
|
const auto &ruleList = rules();
|
package/ui/svg_element.h
CHANGED
|
@@ -63,8 +63,11 @@ bool isShape(int node);
|
|
|
63
63
|
// consumed once per rebuild. False means "repaint the whole box": no rebuild
|
|
64
64
|
// since the last call, a first build or resize, a z-order change, or a change
|
|
65
65
|
// to the svg box's own style or position. An empty rect (x1 < x0) means the
|
|
66
|
-
// rebuild changed nothing on screen.
|
|
67
|
-
|
|
66
|
+
// rebuild changed nothing on screen. `extra` (up to kExtraDamage rects) gets
|
|
67
|
+
// the further boxes of a rebuild that changed several separate places, and
|
|
68
|
+
// `extraCount` how many; the first box is the returned rect.
|
|
69
|
+
constexpr int kExtraDamage = 3;
|
|
70
|
+
bool damage(int root, int &x0, int &y0, int &x1, int &y1, int (*extra)[4] = nullptr, int *extraCount = nullptr);
|
|
68
71
|
|
|
69
72
|
// Tree hooks.
|
|
70
73
|
void noteTagChanged(int node);
|