Skip to content

Commit

Permalink
Convert SquooshTreeBuilder.kt
Browse files Browse the repository at this point in the history
Fixes: #1912
  • Loading branch information
yiqunw700 committed Dec 21, 2024
1 parent f145970 commit 0a08113
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 205 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,10 @@ fun CustomizationContext.getComponent(
// and it does a lot of hashing and string operations. We can optimize this by parsing the node
// variants and sorting them in Rust during doc generation, and by interning strings in the
// serialized doc so that we don't need to hash.
fun CustomizationContext.getMatchingVariant(maybeComponentInfo: Optional<ComponentInfo>): String? {
if (!maybeComponentInfo.isPresent) return null
fun CustomizationContext.getMatchingVariant(componentInfo: ComponentInfo?): String? {
if (componentInfo == null) return null
if (variantProperties.isEmpty()) return null

val componentInfo = maybeComponentInfo.get()
val nodeVariants = parseNodeVariants(componentInfo.name)

// Check to see if any of the variant properties set match the variant properties in this node.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ internal fun Optional<ViewData>.ifTextGetText(): Text? {
return (this.get().view_data_type.get() as? ViewDataType.Text)?.value
}

@Deprecated("This function will be removed in the future.")
internal fun Optional<Trigger>.isSupportedInteraction() =
this.type is TriggerType.AfterTimeout ||
this.type is TriggerType.Click ||
Expand Down
Loading

0 comments on commit 0a08113

Please sign in to comment.