@@ -256,7 +256,7 @@ function getTracingTooltip(
256256 ?. getWidget ( )
257257 ?. showTrace (
258258 property , text , matchedStyles , computedStyles ,
259- getPropertyRenderers (
259+ getPropertyRenderers ( property . name ,
260260 property . ownerStyle , stylesPane , matchedStyles , null ,
261261 computedStyles ) ) ;
262262 }
@@ -308,7 +308,8 @@ export class VariableRenderer extends rendererBase(SDK.CSSPropertyParserMatchers
308308 const { nodes, cssControls} = Renderer . renderValueNodes (
309309 { name : declaration . name , value : declaration . value ?? '' } ,
310310 substitution . cachedParsedValue ( declaration . declaration , this . #matchedStyles, this . #computedStyles) ,
311- getPropertyRenderers ( declaration . style , this . #stylesPane, this . #matchedStyles, null , this . #computedStyles) ,
311+ getPropertyRenderers (
312+ declaration . name , declaration . style , this . #stylesPane, this . #matchedStyles, null , this . #computedStyles) ,
312313 substitution ) ;
313314 cssControls . forEach ( ( value , key ) => value . forEach ( control => context . addControl ( key , control ) ) ) ;
314315 return nodes ;
@@ -697,7 +698,7 @@ export class ColorMixRenderer extends rendererBase(SDK.CSSPropertyParserMatchers
697698 context . addControl ( 'color' , swatch ) ;
698699 const nodeId = this . #pane. node ( ) ?. id ;
699700 if ( nodeId !== undefined ) {
700- void this . #pane. cssModel ( ) ?. resolveValues ( nodeId , colorMixText ) . then ( results => {
701+ void this . #pane. cssModel ( ) ?. resolveValues ( undefined , nodeId , colorMixText ) . then ( results => {
701702 if ( results ) {
702703 const color = Common . Color . parse ( results [ 0 ] ) ;
703704 if ( color ) {
@@ -1291,11 +1292,13 @@ export class GridTemplateRenderer extends rendererBase(SDK.CSSPropertyParserMatc
12911292
12921293// clang-format off
12931294export class LengthRenderer extends rendererBase ( SDK . CSSPropertyParserMatchers . LengthMatch ) {
1294- readonly #stylesPane: StylesSidebarPane ;
12951295 // clang-format on
1296- constructor ( stylesPane : StylesSidebarPane ) {
1296+ readonly #stylesPane: StylesSidebarPane ;
1297+ readonly #propertyName: string ;
1298+ constructor ( stylesPane : StylesSidebarPane , propertyName : string ) {
12971299 super ( ) ;
12981300 this . #stylesPane = stylesPane ;
1301+ this . #propertyName = propertyName ;
12991302 }
13001303
13011304 override render ( match : SDK . CSSPropertyParserMatchers . LengthMatch , context : RenderingContext ) : Node [ ] {
@@ -1318,7 +1321,7 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
13181321 return ;
13191322 }
13201323
1321- const pixelValue = await this . #stylesPane. cssModel ( ) ?. resolveValues ( nodeId , value ) ;
1324+ const pixelValue = await this . #stylesPane. cssModel ( ) ?. resolveValues ( this . #propertyName , nodeId , value ) ;
13221325
13231326 if ( pixelValue ) {
13241327 valueElement . textContent = pixelValue [ 0 ] ;
@@ -1331,7 +1334,7 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
13311334 return ;
13321335 }
13331336
1334- const pixelValue = await this . #stylesPane. cssModel ( ) ?. resolveValues ( nodeId , value ) ;
1337+ const pixelValue = await this . #stylesPane. cssModel ( ) ?. resolveValues ( this . #propertyName , nodeId , value ) ;
13351338 if ( ! pixelValue ) {
13361339 return ;
13371340 }
@@ -1351,17 +1354,19 @@ export class LengthRenderer extends rendererBase(SDK.CSSPropertyParserMatchers.L
13511354
13521355// clang-format off
13531356export class MathFunctionRenderer extends rendererBase ( SDK . CSSPropertyParserMatchers . MathFunctionMatch ) {
1354- readonly #stylesPane: StylesSidebarPane ;
1355- #matchedStyles: SDK . CSSMatchedStyles . CSSMatchedStyles ;
1356- #computedStyles: Map < string , string > ;
13571357 // clang-format on
1358+ readonly #stylesPane: StylesSidebarPane ;
1359+ #matchedStyles: SDK . CSSMatchedStyles . CSSMatchedStyles ;
1360+ #computedStyles: Map < string , string > ;
1361+ #propertyName: string ;
13581362 constructor (
13591363 stylesPane : StylesSidebarPane , matchedStyles : SDK . CSSMatchedStyles . CSSMatchedStyles ,
1360- computedStyles : Map < string , string > ) {
1364+ computedStyles : Map < string , string > , propertyName : string ) {
13611365 super ( ) ;
13621366 this . #matchedStyles = matchedStyles ;
13631367 this . #computedStyles = computedStyles ;
13641368 this . #stylesPane = stylesPane ;
1369+ this . #propertyName = propertyName ;
13651370 }
13661371
13671372 override render ( match : SDK . CSSPropertyParserMatchers . MathFunctionMatch , context : RenderingContext ) : Node [ ] {
@@ -1397,7 +1402,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
13971402 if ( nodeId === undefined ) {
13981403 return ;
13991404 }
1400- const evaled = await this . #stylesPane. cssModel ( ) ?. resolveValues ( nodeId , value ) ;
1405+ const evaled = await this . #stylesPane. cssModel ( ) ?. resolveValues ( this . #propertyName , nodeId , value ) ;
14011406 if ( ! evaled ?. [ 0 ] || evaled [ 0 ] === value ) {
14021407 return ;
14031408 }
@@ -1413,7 +1418,7 @@ export class MathFunctionRenderer extends rendererBase(SDK.CSSPropertyParserMatc
14131418 // and compare the function result to the values of all its arguments. Evaluating the arguments eliminates nested
14141419 // function calls and normalizes all units to px.
14151420 values . unshift ( functionText ) ;
1416- const evaledArgs = await this . #stylesPane. cssModel ( ) ?. resolveValues ( nodeId , ...values ) ;
1421+ const evaledArgs = await this . #stylesPane. cssModel ( ) ?. resolveValues ( this . #propertyName , nodeId , ...values ) ;
14171422 if ( ! evaledArgs ) {
14181423 return ;
14191424 }
@@ -1555,7 +1560,7 @@ export class PositionTryRenderer extends rendererBase(SDK.CSSPropertyParserMatch
15551560}
15561561
15571562export function getPropertyRenderers (
1558- style : SDK . CSSStyleDeclaration . CSSStyleDeclaration , stylesPane : StylesSidebarPane ,
1563+ propertyName : string , style : SDK . CSSStyleDeclaration . CSSStyleDeclaration , stylesPane : StylesSidebarPane ,
15591564 matchedStyles : SDK . CSSMatchedStyles . CSSMatchedStyles , treeElement : StylePropertyTreeElement | null ,
15601565 computedStyles : Map < string , string > ) : Array < MatchRenderer < SDK . CSSPropertyParser . Match > > {
15611566 return [
@@ -1576,8 +1581,8 @@ export function getPropertyRenderers(
15761581 new PositionAnchorRenderer ( stylesPane ) ,
15771582 new FlexGridRenderer ( stylesPane , treeElement ) ,
15781583 new PositionTryRenderer ( matchedStyles ) ,
1579- new LengthRenderer ( stylesPane ) ,
1580- new MathFunctionRenderer ( stylesPane , matchedStyles , computedStyles ) ,
1584+ new LengthRenderer ( stylesPane , propertyName ) ,
1585+ new MathFunctionRenderer ( stylesPane , matchedStyles , computedStyles , propertyName ) ,
15811586 new AutoBaseRenderer ( computedStyles ) ,
15821587 new BinOpRenderer ( ) ,
15831588 ] ;
@@ -1999,10 +2004,11 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
19992004 this . expandElement . setAttribute ( 'jslog' , `${ VisualLogging . expand ( ) . track ( { click : true } ) } ` ) ;
20002005 }
20012006
2002- const renderers = this . property . parsedOk ? getPropertyRenderers (
2003- this . style , this . parentPaneInternal , this . matchedStylesInternal ,
2004- this , this . getComputedStyles ( ) ?? new Map ( ) ) :
2005- [ ] ;
2007+ const renderers = this . property . parsedOk ?
2008+ getPropertyRenderers (
2009+ this . name , this . style , this . parentPaneInternal , this . matchedStylesInternal , this ,
2010+ this . getComputedStyles ( ) ?? new Map ( ) ) :
2011+ [ ] ;
20062012
20072013 if ( Root . Runtime . experiments . isEnabled ( 'font-editor' ) && this . property . parsedOk ) {
20082014 renderers . push ( new FontRenderer ( this ) ) ;
0 commit comments