mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
32 lines
1012 B
Swift
32 lines
1012 B
Swift
import Foundation
|
|
import LayoutKit
|
|
import VGSL
|
|
|
|
extension DivGifImage: DivBlockModeling, DivImageProtocol {
|
|
public func makeBlock(context: DivBlockModelingContext) throws -> Block {
|
|
let context = modifiedContextParentPath(context)
|
|
return try applyBaseProperties(
|
|
to: { try makeBaseBlock(context: context) },
|
|
context: context,
|
|
actionsHolder: self,
|
|
customAccessibilityParams: CustomAccessibilityParams(defaultTraits: .image)
|
|
)
|
|
}
|
|
|
|
private func makeBaseBlock(context: DivBlockModelingContext) throws -> Block {
|
|
try checkLayoutTraits(context: context)
|
|
|
|
let expressionResolver = context.expressionResolver
|
|
let imageHolder = context.imageHolderFactory.make(
|
|
resolveGifUrl(expressionResolver),
|
|
resolvePlaceholder(expressionResolver)
|
|
)
|
|
return AnimatableImageBlock(
|
|
imageHolder: imageHolder,
|
|
widthTrait: resolveContentWidthTrait(context),
|
|
height: resolveHeight(context),
|
|
contentMode: resolveContentMode(context)
|
|
)
|
|
}
|
|
}
|