Skip to content

Commit

Permalink
Merge branch 'main' into chore
Browse files Browse the repository at this point in the history
  • Loading branch information
open-hippy authored Aug 25, 2023
2 parents ade4761 + 219e4a4 commit 0619fba
Show file tree
Hide file tree
Showing 21 changed files with 2,167 additions and 25 deletions.
6 changes: 3 additions & 3 deletions PUBLISH.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The front-end Uses [lerna](https://lerna.js.org/) for versioning and CHANGELOG g
Update version and CHANGELOG usage:

```bash
npx lerna version [VERSION] --conventional-commits --tag-version-prefix='' --no-push
npx lerna version [VERSION] --force-publish --conventional-commits --tag-version-prefix='' --no-push
```

* `[version]` - The version number to be released, such as 2.1.0.
Expand Down Expand Up @@ -84,10 +84,10 @@ Enter a commit message that conforms to [Convention Commit](https://conventional
git commit -m 'chore(release): released [VERSION]'
```

tag
tag (如果是大版本, 在主干打tag, 如果是hotfix,在hotfix分支打tag,然后把changelog合回主干)

```bash
git tag [VERSION]
git tag -a [VERSION] -m "version release xxx"
```

Commit the code and prepare to publish the PR merge into the master branch.
Expand Down
1 change: 1 addition & 0 deletions dom/include/dom/layout_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class LayoutNode {
virtual void SetMeasureFunction(MeasureFunction measure_function) = 0;
virtual bool HasMeasureFunction() = 0;
virtual void MarkDirty() = 0;
virtual bool IsDirty() = 0;
virtual bool HasParentEngineNode() = 0;
virtual void Print() = 0;

Expand Down
1 change: 1 addition & 0 deletions dom/include/dom/root_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class RootNode : public DomNode {
void RemoveEvent(uint32_t id, const std::string& event_name);
void HandleEvent(const std::shared_ptr<DomEvent>& event) override;
void UpdateRenderNode(const std::shared_ptr<DomNode>& node);
uint32_t GetChildCount();

std::shared_ptr<DomNode> GetNode(uint32_t id);
std::tuple<float, float> GetRootSize();
Expand Down
2 changes: 1 addition & 1 deletion dom/include/dom/taitank_layout_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this
* @brief 是否脏节点
* @return 是否脏节点
*/
bool IsDirty();
bool IsDirty() override;

/**
* @brief 重置节点
Expand Down
2 changes: 1 addition & 1 deletion dom/include/dom/yoga_layout_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class YogaLayoutNode : public LayoutNode, public std::enable_shared_from_this<Yo

void Print() override;

bool IsDirty();
bool IsDirty() override;

void Reset();

Expand Down
9 changes: 9 additions & 0 deletions dom/src/dom/dom_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ void DomManager::CreateDomNodes(const std::weak_ptr<RootNode>& weak_root_node,
if (!root_node) {
return;
}
size_t create_size = nodes.size();
root_node->CreateDomNodes(std::move(nodes));
FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] create node size = " << create_size << ", total node size = " << root_node->GetChildCount();
}

void DomManager::UpdateDomNodes(const std::weak_ptr<RootNode>& weak_root_node,
Expand All @@ -85,7 +87,9 @@ void DomManager::UpdateDomNodes(const std::weak_ptr<RootNode>& weak_root_node,
if (!root_node) {
return;
}
size_t update_size = nodes.size();
root_node->UpdateDomNodes(std::move(nodes));
FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] update node size = " << update_size << ", total node size = " << root_node->GetChildCount();
}

void DomManager::MoveDomNodes(const std::weak_ptr<RootNode>& weak_root_node,
Expand All @@ -94,7 +98,9 @@ void DomManager::MoveDomNodes(const std::weak_ptr<RootNode>& weak_root_node,
if (!root_node) {
return;
}
size_t move_size = nodes.size();
root_node->MoveDomNodes(std::move(nodes));
FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] move node size = " << move_size << ", total node size = " << root_node->GetChildCount();
}

void DomManager::UpdateAnimation(const std::weak_ptr<RootNode>& weak_root_node,
Expand All @@ -112,7 +118,9 @@ void DomManager::DeleteDomNodes(const std::weak_ptr<RootNode>& weak_root_node,
if (!root_node) {
return;
}
size_t delete_size = nodes.size();
root_node->DeleteDomNodes(std::move(nodes));
FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] delete node size = " << delete_size << ", total node size = " << root_node->GetChildCount();
}

void DomManager::EndBatch(const std::weak_ptr<RootNode>& weak_root_node) {
Expand All @@ -125,6 +133,7 @@ void DomManager::EndBatch(const std::weak_ptr<RootNode>& weak_root_node) {
if (!root_node) {
return;
}
FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] total node size = " << root_node->GetChildCount();
root_node->SyncWithRenderManager(render_manager);
}

Expand Down
5 changes: 2 additions & 3 deletions dom/src/dom/dom_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,8 @@ LayoutResult DomNode::GetLayoutInfoFromRoot() {

void DomNode::TransferLayoutOutputsRecursive(std::vector<std::shared_ptr<DomNode>>& changed_nodes) {
auto not_equal = std::not_equal_to<>();
bool changed = not_equal(layout_.left, layout_node_->GetLeft()) || not_equal(layout_.top, layout_node_->GetTop()) ||
not_equal(layout_.width, layout_node_->GetWidth()) ||
not_equal(layout_.height, layout_node_->GetHeight());
bool changed = layout_node_->IsDirty() || layout_node_->HasNewLayout();

layout_.left = layout_node_->GetLeft();
layout_.top = layout_node_->GetTop();
layout_.width = layout_node_->GetWidth();
Expand Down
10 changes: 8 additions & 2 deletions dom/src/dom/layer_optimized_render_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ void LayerOptimizedRenderManager::CreateRenderNode(std::weak_ptr<RootNode> root_
nodes_to_create.push_back(node);
}
}

FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] create node size before optimize = " << nodes.size()
<< ", create node size after optimize = " << nodes_to_create.size();
if (!nodes_to_create.empty()) {
render_manager_->CreateRenderNode(root_node, std::move(nodes_to_create));
}
Expand Down Expand Up @@ -86,7 +87,8 @@ void LayerOptimizedRenderManager::UpdateRenderNode(std::weak_ptr<RootNode> root_
}
}
}

FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] update node size before optimize = " << nodes.size()
<< ", update node size after optimize = " << nodes_to_update.size();
if (!nodes_to_update.empty()) {
render_manager_->UpdateRenderNode(root_node, std::move(nodes_to_update));
}
Expand All @@ -108,6 +110,8 @@ void LayerOptimizedRenderManager::MoveRenderNode(std::weak_ptr<RootNode> root_no
}
}
}
FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] move node size before optimize = " << nodes.size()
<< ", move node size after optimize = " << nodes_to_move.size();
render_manager_->MoveRenderNode(root_node, std::move(nodes));
}

Expand All @@ -121,6 +125,8 @@ void LayerOptimizedRenderManager::DeleteRenderNode(std::weak_ptr<RootNode> root_
FindValidChildren(node, nodes_to_delete);
}
}
FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] delete node size before optimize = " << nodes.size()
<< ", delete node size after optimize = " << nodes_to_delete.size();
if (!nodes_to_delete.empty()) {
for (auto& node : nodes_to_delete) {
// Recursively delete all ids on the node tree.
Expand Down
6 changes: 6 additions & 0 deletions dom/src/dom/root_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@ void RootNode::UpdateRenderNode(const std::shared_ptr<DomNode>& node) {
SyncWithRenderManager(render_manager);
}

uint32_t RootNode::GetChildCount() {
uint32_t child_count = 0;
Traverse([&child_count](const std::shared_ptr<DomNode>&) { child_count++; });
return child_count;
}

std::shared_ptr<DomNode> RootNode::GetNode(uint32_t id) {
if (id == GetId()) {
return shared_from_this();
Expand Down
Loading

0 comments on commit 0619fba

Please sign in to comment.