| 250 | void Layer::onChildRemoved(Layer* /*childLayer*/) {} |
| 251 | |
| 252 | void Layer::removeChild(Layer* childLayer, bool shouldNotify) { |
| 253 | auto erased = false; |
| 254 | { |
| 255 | auto children = _children.writeAccess(); |
| 256 | auto it = children->begin(); |
| 257 | while (it != children->end()) { |
| 258 | if (it->get() == childLayer) { |
| 259 | it = children->erase(it); |
| 260 | erased = true; |
| 261 | } else { |
| 262 | it++; |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | if (erased) { |
| 268 | if (shouldNotify) { |
| 269 | onChildRemoved(childLayer); |
| 270 | } |
| 271 | setChildNeedsDisplay(); |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | void Layer::removeFromParent() { |
| 276 | removeFromParent(true); |
no test coverage detected