@@ -262,7 +262,8 @@ export class VariableRenderer extends rendererBase(SDK.CSSPropertyParserMatchers
262262 const { nodes, cssControls} = Renderer . renderValueNodes (
263263 { name : declaration . name , value : declaration . value ?? '' } ,
264264 substitution . cachedParsedValue ( declaration . declaration , this . #matchedStyles, this . #computedStyles) ,
265- getPropertyRenderers ( declaration . style , this . #stylesPane, this . #matchedStyles, null , this . #computedStyles) ,
265+ getPropertyRenderers (
266+ declaration . name , declaration . style , this . #stylesPane, this . #matchedStyles, null , this . #computedStyles) ,
266267 substitution ) ;
267268 cssControls . forEach ( ( value , key ) => value . forEach ( control => context . addControl ( key , control ) ) ) ;
268269 return nodes ;
@@ -658,7 +659,7 @@ export class ColorMixRenderer extends rendererBase(SDK.CSSPropertyParserMatchers
658659 context . addControl ( 'color' , swatch ) ;
659660 const nodeId = this . #pane. node ( ) ?. id ;
660661 if ( nodeId !== undefined ) {
661- void this . #pane. cssModel ( ) ?. resolveValues ( nodeId , colorMixText ) . then ( results => {
662+ void this . #pane. cssModel ( ) ?. resolveValues ( undefined , nodeId , colorMixText ) . then ( results => {
662663 if ( results ) {
663664 const color = Common . Color . parse ( results [ 0 ] ) ;
664665 if ( color ) {
@@ -1258,10 +1259,12 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
12581259 // clang-format on
12591260 readonly #stylesPane: StylesSidebarPane ;
12601261 readonly #treeElement: StylePropertyTreeElement | null ;
1261- constructor ( stylesPane : StylesSidebarPane , treeElement : StylePropertyTreeElement | null ) {
1262+ readonly #propertyName: string ;
1263+ constructor ( stylesPane : StylesSidebarPane , propertyName : string , treeElement : StylePropertyTreeElement | null ) {
12621264 super ( ) ;
12631265 this . #stylesPane = stylesPane ;
12641266 this . #treeElement = treeElement ;
1267+ this . #propertyName = propertyName ;
12651268 }
12661269
12671270 override render ( match : SDK . CSSPropertyParserMatchers . LengthMatch , context : RenderingContext ) : Node [ ] {
@@ -1284,7 +1287,7 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
12841287 return ;
12851288 }
12861289
1287- const pixelValue = await this . #stylesPane. cssModel ( ) ?. resolveValues ( nodeId , value ) ;
1290+ const pixelValue = await this . #stylesPane. cssModel ( ) ?. resolveValues ( this . #propertyName , nodeId , value ) ;
12881291
12891292 if ( pixelValue ) {
12901293 valueElement . textContent = pixelValue [ 0 ] ;
@@ -1297,7 +1300,7 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
12971300 return ;
12981301 }
12991302
1300- const pixelValue = await this . #stylesPane. cssModel ( ) ?. resolveValues ( nodeId , value ) ;
1303+ const pixelValue = await this . #stylesPane. cssModel ( ) ?. resolveValues ( this . #propertyName , nodeId , value ) ;
13011304 if ( ! pixelValue ) {
13021305 return ;
13031306 }
@@ -1324,14 +1327,16 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
13241327 readonly #matchedStyles: SDK . CSSMatchedStyles . CSSMatchedStyles ;
13251328 readonly #computedStyles: Map < string , string > ;
13261329 readonly #treeElement: StylePropertyTreeElement | null ;
1330+ readonly #propertyName: string ;
13271331 constructor (
13281332 stylesPane : StylesSidebarPane , matchedStyles : SDK . CSSMatchedStyles . CSSMatchedStyles ,
1329- computedStyles : Map < string , string > , treeElement : StylePropertyTreeElement | null ) {
1333+ computedStyles : Map < string , string > , propertyName : string , treeElement : StylePropertyTreeElement | null ) {
13301334 super ( ) ;
13311335 this . #matchedStyles = matchedStyles ;
13321336 this . #computedStyles = computedStyles ;
13331337 this . #stylesPane = stylesPane ;
13341338 this . #treeElement = treeElement ;
1339+ this . #propertyName = propertyName ;
13351340 }
13361341
13371342 override render ( match : SDK . CSSPropertyParserMatchers . MathFunctionMatch , context : RenderingContext ) : Node [ ] {
@@ -1367,7 +1372,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
13671372 if ( nodeId === undefined ) {
13681373 return ;
13691374 }
1370- const evaled = await this . #stylesPane. cssModel ( ) ?. resolveValues ( nodeId , value ) ;
1375+ const evaled = await this . #stylesPane. cssModel ( ) ?. resolveValues ( this . #propertyName , nodeId , value ) ;
13711376 if ( ! evaled ?. [ 0 ] || evaled [ 0 ] === value ) {
13721377 return ;
13731378 }
@@ -1383,7 +1388,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
13831388 // and compare the function result to the values of all its arguments. Evaluating the arguments eliminates nested
13841389 // function calls and normalizes all units to px.
13851390 values . unshift ( functionText ) ;
1386- const evaledArgs = await this . #stylesPane. cssModel ( ) ?. resolveValues ( nodeId , ...values ) ;
1391+ const evaledArgs = await this . #stylesPane. cssModel ( ) ?. resolveValues ( this . #propertyName , nodeId , ...values ) ;
13871392 if ( ! evaledArgs ) {
13881393 return ;
13891394 }
@@ -1525,7 +1530,7 @@ export class PositionTryRenderer extends rendererBase(SDK.CSSPropertyParserMatch
15251530}
15261531
15271532export function getPropertyRenderers (
1528- style : SDK . CSSStyleDeclaration . CSSStyleDeclaration , stylesPane : StylesSidebarPane ,
1533+ propertyName : string , style : SDK . CSSStyleDeclaration . CSSStyleDeclaration , stylesPane : StylesSidebarPane ,
15291534 matchedStyles : SDK . CSSMatchedStyles . CSSMatchedStyles , treeElement : StylePropertyTreeElement | null ,
15301535 computedStyles : Map < string , string > ) : Array < MatchRenderer < SDK . CSSPropertyParser . Match > > {
15311536 return [
@@ -1546,8 +1551,8 @@ export function getPropertyRenderers(
15461551 new PositionAnchorRenderer ( stylesPane ) ,
15471552 new FlexGridRenderer ( stylesPane , treeElement ) ,
15481553 new PositionTryRenderer ( matchedStyles ) ,
1549- new LengthRenderer ( stylesPane , treeElement ) ,
1550- new MathFunctionRenderer ( stylesPane , matchedStyles , computedStyles , treeElement ) ,
1554+ new LengthRenderer ( stylesPane , propertyName , treeElement ) ,
1555+ new MathFunctionRenderer ( stylesPane , matchedStyles , computedStyles , propertyName , treeElement ) ,
15511556 new AutoBaseRenderer ( computedStyles ) ,
15521557 new BinOpRenderer ( ) ,
15531558 ] ;
@@ -1951,10 +1956,11 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
19511956 this . expandElement . setAttribute ( 'jslog' , `${ VisualLogging . expand ( ) . track ( { click : true } ) } ` ) ;
19521957 }
19531958
1954- const renderers = this . property . parsedOk ? getPropertyRenderers (
1955- this . style , this . parentPaneInternal , this . matchedStylesInternal ,
1956- this , this . getComputedStyles ( ) ?? new Map ( ) ) :
1957- [ ] ;
1959+ const renderers = this . property . parsedOk ?
1960+ getPropertyRenderers (
1961+ this . name , this . style , this . parentPaneInternal , this . matchedStylesInternal , this ,
1962+ this . getComputedStyles ( ) ?? new Map ( ) ) :
1963+ [ ] ;
19581964
19591965 if ( Root . Runtime . experiments . isEnabled ( 'font-editor' ) && this . property . parsedOk ) {
19601966 renderers . push ( new FontRenderer ( this ) ) ;
@@ -2118,7 +2124,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
21182124 ?. getWidget ( )
21192125 ?. showTrace (
21202126 property , text , matchedStyles , computedStyles ,
2121- getPropertyRenderers (
2127+ getPropertyRenderers ( property . name ,
21222128 property . ownerStyle , stylesPane , matchedStyles , null , computedStyles ) ) ;
21232129 }
21242130 } }
0 commit comments