@@ -11,7 +11,7 @@ export class ContrastInfo extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
1111 private contrastRatioThresholds : {
1212 [ x : string ] : number ,
1313 } | null ;
14- private readonly contrastRationAPCAThreshold : number | null ;
14+ private readonly contrastRatioAPCAThresholdInternal : number | null ;
1515 private fgColor : Common . Color . Legacy | null ;
1616 private bgColorInternal : Common . Color . Legacy | null ;
1717 private colorFormatInternal : Common . Color . Format | undefined ;
@@ -21,24 +21,27 @@ export class ContrastInfo extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
2121 this . contrastRatioInternal = null ;
2222 this . contrastRatioAPCAInternal = null ;
2323 this . contrastRatioThresholds = null ;
24- this . contrastRationAPCAThreshold = 0 ;
24+ this . contrastRatioAPCAThresholdInternal = 0 ;
2525 this . fgColor = null ;
2626 this . bgColorInternal = null ;
2727
2828 if ( ! contrastInfo ) {
2929 return ;
3030 }
3131
32- if ( ! contrastInfo . computedFontSize || ! contrastInfo . computedFontWeight || ! contrastInfo . backgroundColors ||
33- contrastInfo . backgroundColors . length !== 1 ) {
32+ if ( ! contrastInfo . computedFontSize || ! contrastInfo . computedFontWeight ) {
3433 return ;
3534 }
3635
3736 this . isNullInternal = false ;
3837 this . contrastRatioThresholds =
3938 Common . ColorUtils . getContrastThreshold ( contrastInfo . computedFontSize , contrastInfo . computedFontWeight ) ;
40- this . contrastRationAPCAThreshold =
39+ this . contrastRatioAPCAThresholdInternal =
4140 Common . ColorUtils . getAPCAThreshold ( contrastInfo . computedFontSize , contrastInfo . computedFontWeight ) ;
41+
42+ if ( ! contrastInfo . backgroundColors || contrastInfo . backgroundColors . length !== 1 ) {
43+ return ;
44+ }
4245 const bgColorText = contrastInfo . backgroundColors [ 0 ] ;
4346 const bgColor = Common . Color . parse ( bgColorText ) ?. asLegacyColor ( ) ;
4447 if ( bgColor ) {
@@ -74,7 +77,7 @@ export class ContrastInfo extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
7477 }
7578
7679 contrastRatioAPCAThreshold ( ) : number | null {
77- return this . contrastRationAPCAThreshold ;
80+ return this . contrastRatioAPCAThresholdInternal ;
7881 }
7982
8083 setBgColor ( bgColor : Common . Color . Legacy ) : void {
0 commit comments