Skip to content

Commit

Permalink
feat(dom): fix iOS compile error for RootNode
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhaihuang authored and churchill-zhang committed Apr 15, 2022
1 parent d1da973 commit c534d55
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions dom/include/dom/dom_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class DomNode : public std::enable_shared_from_this<DomNode> {
const std::vector<std::shared_ptr<DomNode>> &GetChildren() { return children_; }
void AddChildAt(const std::shared_ptr<DomNode> &dom_node, int32_t index);
std::shared_ptr<DomNode> RemoveChildAt(int32_t index);
void DoLayout();
void DoLayout(std::vector<std::shared_ptr<DomNode>>& changed_nodes);
void HandleEvent(const std::shared_ptr<DomEvent> &event);
void ParseLayoutStyleInfo();
Expand Down
5 changes: 5 additions & 0 deletions dom/src/dom/dom_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ std::shared_ptr<DomNode> DomNode::RemoveChildAt(int32_t index) {
return child;
}

void DomNode::DoLayout() {
std::vector<std::shared_ptr<DomNode>> changed_nodes;
DoLayout(changed_nodes);
}

void DomNode::DoLayout(std::vector<std::shared_ptr<DomNode>>& changed_nodes) {
layout_node_->CalculateLayout(0, 0);
TransferLayoutOutputsRecursive(changed_nodes);
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 @@ -11,7 +11,9 @@ constexpr char kOnDomUpdated[] = "onDomUpdated";
constexpr char kOnDomDeleted[] = "onDomDeleted";

RootNode::RootNode(uint32_t id)
: DomNode(id, 0, 0) {}
: DomNode(id, 0, 0) {
SetExtStyleMap(std::make_shared<std::unordered_map<std::string, std::shared_ptr<DomValue>>>());
}

void RootNode::CreateDomNodes(std::vector<std::shared_ptr<DomNode>>&& nodes) {
std::vector<std::shared_ptr<DomNode>> nodes_to_create;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
787C19A22726A1020062EBFF /* HippyInspectorDomain.m in Sources */ = {isa = PBXBuildFile; fileRef = 787C199A2726A1020062EBFF /* HippyInspectorDomain.m */; };
787C19A32726A1020062EBFF /* HippyInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = 787C199B2726A1020062EBFF /* HippyInspector.m */; };
7882DFDC272929D300C12149 /* HippyCSSPropsDefine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7882DFDB272929D300C12149 /* HippyCSSPropsDefine.m */; };
9252AE8B2809532F00B27E50 /* root_node.cc in Sources */ = {isa = PBXBuildFile; fileRef = 9252AE8A2809532F00B27E50 /* root_node.cc */; };
AC63515623F92C99007FABA5 /* TTTGB-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = AC63515523F92C99007FABA5 /* TTTGB-Medium.otf */; };
D4B09E392750D2C000643CDF /* Flex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4B09E362750D21600643CDF /* Flex.cpp */; };
D84AB8EC273A5AAD00987D03 /* dom_manager.cc in Sources */ = {isa = PBXBuildFile; fileRef = D84AB8E5273A5AAD00987D03 /* dom_manager.cc */; };
Expand Down Expand Up @@ -369,6 +370,8 @@
787C199B2726A1020062EBFF /* HippyInspector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HippyInspector.m; sourceTree = "<group>"; };
787C19A6272801BF0062EBFF /* HippyCSSPropsDefine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HippyCSSPropsDefine.h; sourceTree = "<group>"; };
7882DFDB272929D300C12149 /* HippyCSSPropsDefine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HippyCSSPropsDefine.m; sourceTree = "<group>"; };
9252AE8A2809532F00B27E50 /* root_node.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = root_node.cc; sourceTree = "<group>"; };
9252AE8C2809534100B27E50 /* root_node.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = root_node.h; sourceTree = "<group>"; };
AC63515523F92C99007FABA5 /* TTTGB-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "TTTGB-Medium.otf"; sourceTree = "<group>"; };
B2C1237A278C0C140081B8AF /* DemoConfigs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DemoConfigs.h; sourceTree = "<group>"; };
D4B09E362750D21600643CDF /* Flex.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Flex.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1102,6 +1105,7 @@
D84AB8D9273A5AAD00987D03 /* dom */ = {
isa = PBXGroup;
children = (
9252AE8C2809534100B27E50 /* root_node.h */,
F4810952277062A1005C221B /* layer_optimized_render_manager.h */,
F4E7B435276C61DC00F17139 /* deserializer.h */,
F4E7B437276C61DC00F17139 /* diff_utils.h */,
Expand Down Expand Up @@ -1131,6 +1135,7 @@
D84AB8E4273A5AAD00987D03 /* dom */ = {
isa = PBXGroup;
children = (
9252AE8A2809532F00B27E50 /* root_node.cc */,
F4810953277062AD005C221B /* layer_optimized_render_manager.cc */,
F4E7B43B276C61EB00F17139 /* deserializer.cc */,
F4E7B439276C61EA00F17139 /* dom_argument.cc */,
Expand Down Expand Up @@ -2074,6 +2079,7 @@
D84AB9B1273A618B00987D03 /* log_settings.cc in Sources */,
787C199F2726A1020062EBFF /* HippyPageDomain.mm in Sources */,
F45D266128067B6900CAB185 /* HippyShadowTextView.mm in Sources */,
9252AE8B2809532F00B27E50 /* root_node.cc in Sources */,
F45D266828067B6900CAB185 /* HippyWaterfallView.mm in Sources */,
F472301A2774805600A120AC /* OCTypeToDomArgument.mm in Sources */,
064C5A5923AB1A51001E80DD /* HippyDisplayLink.m in Sources */,
Expand Down

0 comments on commit c534d55

Please sign in to comment.