Optimisation

This commit is contained in:
Alexei Anoshenko 2025-08-23 22:05:12 +03:00
parent 469980428c
commit da3d963b40
6 changed files with 12 additions and 10 deletions

View File

@ -926,7 +926,7 @@ func (session *sessionData) registerAnimation(props []AnimatedProperty) string {
}
cssBuilder.startAnimationFrame("from")
writeViewStyleCSS(NewViewStyle(fromParams), &cssBuilder, session)
writeViewStyleCSS(NewViewStyle(fromParams), &cssBuilder, session, false)
cssBuilder.endAnimationFrame()
if len(frames) > 0 {
@ -942,14 +942,14 @@ func (session *sessionData) registerAnimation(props []AnimatedProperty) string {
if len(params) > 0 {
cssBuilder.startAnimationFrame(strconv.Itoa(frame) + "%")
writeViewStyleCSS(NewViewStyle(params), &cssBuilder, session)
writeViewStyleCSS(NewViewStyle(params), &cssBuilder, session, false)
cssBuilder.endAnimationFrame()
}
}
}
cssBuilder.startAnimationFrame("to")
writeViewStyleCSS(NewViewStyle(toParams), &cssBuilder, session)
writeViewStyleCSS(NewViewStyle(toParams), &cssBuilder, session, false)
cssBuilder.endAnimationFrame()
cssBuilder.endAnimation()

View File

@ -1616,7 +1616,7 @@ func tableViewCurrent(view View) CellIndex {
func (table *tableViewData) cssStyle(self View, builder cssBuilder) {
session := table.Session()
writeViewStyleCSS(table, builder, session)
writeViewStyleCSS(table, builder, session, false)
gap, ok := sizeProperty(table, Gap, session)
if !ok || gap.Type == Auto || gap.Value <= 0 {

View File

@ -18,7 +18,7 @@ func (cell *tableCellView) init(session Session) {
func (cell *tableCellView) cssStyle(self View, builder cssBuilder) {
session := cell.Session()
writeViewStyleCSS(cell, builder, session)
writeViewStyleCSS(cell, builder, session, false)
if value, ok := enumProperty(cell, TableVerticalAlign, session, 0); ok {
builder.add("vertical-align", enumProperties[TableVerticalAlign].values[value])

View File

@ -661,7 +661,7 @@ func (theme *theme) cssText(session Session) string {
for _, tag := range styleList(theme.styles) {
if style := theme.styles[tag]; style != nil {
builder.startStyle(tag)
writeViewStyleCSS(style, &builder, session)
writeViewStyleCSS(style, &builder, session, false)
builder.endStyle()
}
}
@ -671,7 +671,7 @@ func (theme *theme) cssText(session Session) string {
for _, tag := range styleList(media.styles) {
if style := media.styles[tag]; style != nil {
builder.startStyle(tag)
writeViewStyleCSS(style, &builder, session)
writeViewStyleCSS(style, &builder, session, false)
builder.endStyle()
}
}

View File

@ -1094,7 +1094,7 @@ func (view *viewData) addToCSSStyle(addCSS map[string]string) {
}
func (view *viewData) cssStyle(self View, builder cssBuilder) {
writeViewStyleCSS(view, builder, view.session)
writeViewStyleCSS(view, builder, view.session, view.tag == "ListView")
if view.addCSS != nil {
for tag, value := range view.addCSS {
builder.add(tag, value)

View File

@ -187,7 +187,7 @@ func writeListStyleCSS(style Properties, builder cssBuilder, session Session) {
}
func writeViewStyleCSS(style Properties, builder cssBuilder, session Session) {
func writeViewStyleCSS(style Properties, builder cssBuilder, session Session, ignoreListStyle bool) {
if visibility, ok := enumProperty(style, Visibility, session, Visible); ok {
switch visibility {
@ -369,7 +369,9 @@ func writeViewStyleCSS(style Properties, builder cssBuilder, session Session) {
}
}
writeListStyleCSS(style, builder, session)
if !ignoreListStyle {
writeListStyleCSS(style, builder, session)
}
if r, ok := rangeProperty(style, Row, session); ok {
builder.add("grid-row", fmt.Sprintf("%d / %d", r.First+1, r.Last+2))