| 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; |