Skip to content

Commit

Permalink
fix(dom): fix skip style diff update style map null
Browse files Browse the repository at this point in the history
  • Loading branch information
zealotchen0 committed Oct 30, 2023
1 parent 0f51c5d commit f672a44
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions dom/src/dom/dom_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,13 @@ std::ostream& operator<<(std::ostream& os, const RefInfo& ref_info) {
return os;
}

std::ostream& operator<<(std::ostream& os, const DiffInfo& diff_info) {
os << "{";
os << "\"skip_style_diff\": " << diff_info.skip_style_diff << ", ";
os << "}";
return os;
}

std::ostream& operator<<(std::ostream& os, const DomNode& dom_node) {
os << "{";
os << "\"id\": " << dom_node.id_ << ", ";
Expand All @@ -637,10 +644,14 @@ std::ostream& operator<<(std::ostream& os, const DomNode& dom_node) {
std::ostream& operator<<(std::ostream& os, const DomInfo& dom_info) {
auto dom_node = dom_info.dom_node;
auto ref_info = dom_info.ref_info;
auto diff_info = dom_info.diff_info;
os << "{";
if (ref_info != nullptr) {
os << "\"ref info\": " << *ref_info << ", ";
}
if (diff_info != nullptr) {
os << "\"diff info\": " << *diff_info << ", ";
}
if (dom_node != nullptr) {
os << "\"dom node\": " << *dom_node << ", ";
}
Expand Down
4 changes: 3 additions & 1 deletion dom/src/dom/root_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ void RootNode::UpdateDomNodes(std::vector<std::shared_ptr<DomInfo>>&& nodes) {
if (!ext_update->empty()) {
diff_value->insert(ext_update->begin(), ext_update->end());
}
dom_node->SetStyleMap(node_info->dom_node->GetStyleMap());
if (!skip_style_diff) {
dom_node->SetStyleMap(node_info->dom_node->GetStyleMap());
}
dom_node->SetExtStyleMap(node_info->dom_node->GetExtStyle());
dom_node->SetDiffStyle(diff_value);

Expand Down

0 comments on commit f672a44

Please sign in to comment.