in packages/core/src/rendering/render-object.ts [919:942]
markPaintDirty(cause?: RenderObject) {
assert(!cause || cause._parent === this)
if (this._paintDirty) {
return
}
// 先标记自己
this._paintDirty = true
if (this.repaintBoundary) {
// 当前是 RepaintBoundary,我们可以重绘自己
assert(this._layer instanceof TransformLayer, '当前节点是 repaintBoundary,但 _layer 不是 ')
if (this._owner) {
this._owner.addPaintDirty(this)
this._owner.requestVisualUpdate()
}
} else if (this._parent instanceof RenderObject) {
// 逐级寻找 parent,到 repaintBoundary 为止
this._parent.markPaintDirty(this)
} else {
// 根节点,例如 RenderCanvas,此时已经被加入 Pipeline.paintDirtyObjects
// 我们只需要 requestVisualUpdate 即可
this.owner?.requestVisualUpdate()
}
}