mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
956c055cd8
commit_hash:0f7ba811b37db6d2a9fc05efe5f94502feda4856
43 lines
1.0 KiB
Swift
43 lines
1.0 KiB
Swift
import Foundation
|
|
import LayoutKit
|
|
import VGSL
|
|
|
|
final class DebugBlock: WrapperBlock, LayoutCachingDefaultImpl {
|
|
let child: Block
|
|
|
|
let errorCollector: DebugErrorCollector
|
|
let showDebugInfo: (ViewType) -> Void
|
|
|
|
var debugDescription: String {
|
|
"DebugBlock errors: \(errorCollector.debugDescription). Child: \(child)"
|
|
}
|
|
|
|
init(
|
|
child: Block,
|
|
errorCollector: DebugErrorCollector,
|
|
showDebugInfo: @escaping (ViewType) -> Void
|
|
) {
|
|
self.child = child
|
|
self.errorCollector = errorCollector
|
|
self.showDebugInfo = showDebugInfo
|
|
}
|
|
|
|
func makeCopy(wrapping block: Block) -> DebugBlock {
|
|
DebugBlock(
|
|
child: block,
|
|
errorCollector: errorCollector,
|
|
showDebugInfo: showDebugInfo
|
|
)
|
|
}
|
|
|
|
func equals(_ other: any LayoutKit.Block) -> Bool {
|
|
if self === other { return true }
|
|
guard let other = other as? DebugBlock else { return false }
|
|
return errorCollector === other.errorCollector && child.equals(other.child)
|
|
}
|
|
|
|
func getImageHolders() -> [any VGSLUI.ImageHolder] {
|
|
child.getImageHolders()
|
|
}
|
|
}
|