MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / moveToParent

Method moveToParent

Source/Node/Node.cpp:594–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592}
593
594void Node::moveToParent(Node* parent) {
595 AssertIf(parent == nullptr, "can not move node to an invalid parent (nullptr).");
596 if (_parent == parent) return;
597 if (_parent) {
598 auto childRef = Value::alloc(this);
599 if (_parent->_children->remove(childRef.get())) {
600 if (!parent->_children) {
601 parent->_children = Array::create();
602 }
603 Node* last = nullptr;
604 if (!parent->_children->isEmpty()) {
605 last = parent->_children->getLast()->to<Node>();
606 }
607 parent->_children->add(Value::alloc(this));
608 if (last && last->getOrder() > getOrder()) {
609 parent->_flags.setOn(Node::Reorder);
610 }
611 _parent = parent;
612 updateRealColor3();
613 updateRealOpacity();
614 markDirty();
615 }
616 } else {
617 parent->addChild(this);
618 }
619}
620
621void Node::cleanup() {
622 if (_flags.isOff(Node::Cleanup)) {

Callers 3

reconcileElementFunction · 0.80
moveChildMethod · 0.80
node_move_to_parentFunction · 0.80

Calls 11

getOrderFunction · 0.85
markDirtyFunction · 0.85
getOrderMethod · 0.80
setOnMethod · 0.80
removeMethod · 0.65
getMethod · 0.65
addMethod · 0.65
allocFunction · 0.50
createFunction · 0.50
isEmptyMethod · 0.45
addChildMethod · 0.45

Tested by

no test coverage detected