From c28c5c92d04c0ecf2f8cccc3951da6a84b0c0baf Mon Sep 17 00:00:00 2001 From: zealotchen Date: Mon, 30 Oct 2023 12:49:42 +0800 Subject: [PATCH] fix(dom): fix skip style diff update style map null --- dom/src/dom/dom_node.cc | 11 +++++++++++ dom/src/dom/root_node.cc | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dom/src/dom/dom_node.cc b/dom/src/dom/dom_node.cc index 701db433487..ffebb72fe65 100644 --- a/dom/src/dom/dom_node.cc +++ b/dom/src/dom/dom_node.cc @@ -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_ << ", "; @@ -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 << ", "; } diff --git a/dom/src/dom/root_node.cc b/dom/src/dom/root_node.cc index 5032eb5bdf7..290c0e954dd 100644 --- a/dom/src/dom/root_node.cc +++ b/dom/src/dom/root_node.cc @@ -157,7 +157,9 @@ void RootNode::UpdateDomNodes(std::vector>&& 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);