MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / buildFromElement

Method buildFromElement

native/desc/State.cpp:99–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97 RectPtr State::_sameRootBounds = std::make_shared<Rect>();
98
99 void State::buildFromElement(WidgetPtr parentWidget, ElementPtr elem) {
100 if (elem->getParent().expired() && !(elem->getBounds()->isEmpty())) {
101 if (_sameRootBounds.get()->isEmpty() && elem) {
102 _sameRootBounds = elem->getBounds();
103 }
104 if (equals(_sameRootBounds, elem->getBounds())) {
105 this->_rootBounds = _sameRootBounds;
106 } else
107 this->_rootBounds = elem->getBounds();
108 }
109 WidgetPtr widget = nullptr;
110 widget = std::make_shared<Widget>(parentWidget, elem);
111 this->_widgets.emplace_back(widget);
112 for (const auto &childElement: elem->getChildren()) {
113 buildFromElement(widget, childElement);
114 }
115 }
116
117 uintptr_t State::hash() const {
118 return this->_hashcode;

Callers 1

createMethod · 0.45

Calls 5

equalsFunction · 0.85
getParentMethod · 0.45
isEmptyMethod · 0.45
getBoundsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected