@@ -19,12 +19,14 @@ import type {
1919} from '../../types/styles' ;
2020
2121import { CSSLengthUnitValue } from './CSSLengthUnitValue' ;
22+ import { CSSTransformValue } from './CSSTransformValue' ;
2223import { CSSUnparsedValue } from './typed-om/CSSUnparsedValue' ;
2324import { errorMsg , warnMsg } from '../../shared/logUtils' ;
2425import { fixContentBox } from './fixContentBox' ;
2526import { flattenStyle } from './flattenStyleXStyles' ;
2627import { isAllowedShortFormValue } from './isAllowedShortFormValue' ;
2728import { isAllowedStyleKey } from './isAllowedStyleKey' ;
29+ import { lengthStyleKeySet } from './isLengthStyleKey' ;
2830import { mediaQueryMatches } from './mediaQueryMatches' ;
2931import { parseTextShadow } from './parseTextShadow' ;
3032import { parseTimeValue } from './parseTimeValue' ;
@@ -44,6 +46,7 @@ type ResolveStyleOptions = $ReadOnly<{
4446 hover ?: ?boolean ,
4547 inheritedFontSize : ?number ,
4648 viewportHeight : number ,
49+ viewportScale : number ,
4750 viewportWidth : number ,
4851 writingDirection ?: ?'ltr' | 'rtl'
4952} > ;
@@ -197,7 +200,7 @@ function processStyle(
197200
198201 const maybeLengthUnitValue = CSSLengthUnitValue . parse ( styleValue ) ;
199202 if ( maybeLengthUnitValue != null ) {
200- result [ propName ] = new CSSLengthUnitValue ( ... maybeLengthUnitValue ) ;
203+ result [ propName ] = maybeLengthUnitValue ;
201204 continue ;
202205 // React Native doesn't support these keywords or functions
203206 } else if ( styleValue === 'inherit' || styleValue === 'unset' ) {
@@ -295,6 +298,7 @@ function resolveStyle(
295298 hover,
296299 inheritedFontSize,
297300 viewportHeight,
301+ viewportScale,
298302 viewportWidth
299303 } = options ;
300304 const colorScheme = options . colorScheme || 'light' ;
@@ -331,6 +335,7 @@ function resolveStyle(
331335 fontScale,
332336 inheritedFontSize : inheritedFontSize ,
333337 viewportHeight,
338+ viewportScale,
334339 viewportWidth
335340 } ) ;
336341 continue ;
@@ -343,6 +348,7 @@ function resolveStyle(
343348 fontScale,
344349 inheritedFontSize : fontSize ,
345350 viewportHeight,
351+ viewportScale,
346352 viewportWidth
347353 } ) ;
348354 } else {
@@ -352,6 +358,19 @@ function resolveStyle(
352358 }
353359 }
354360
361+ if ( styleValue instanceof CSSTransformValue ) {
362+ result [ propName ] = styleValue . resolveTransformValue ( viewportScale ) ;
363+ continue ;
364+ }
365+ if (
366+ viewportScale !== 1 &&
367+ typeof styleValue === 'number' &&
368+ lengthStyleKeySet . has ( propName )
369+ ) {
370+ result [ propName ] = styleValue * viewportScale ;
371+ continue ;
372+ }
373+
355374 // Resolve the stylex object-value syntax
356375 if (
357376 styleValue != null &&
0 commit comments