Skip to content

Commit 44649d7

Browse files
pfaffeDevtools-frontend LUCI CQ
authored andcommitted
Fix resolution of color-scheme for light-dark
Fixed: 397470891 Change-Id: I499beba7308e6303ae4716dd9825901ba9225201 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6667823 Auto-Submit: Philip Pfaffe <[email protected]> Reviewed-by: Ergün Erdoğmuş <[email protected]> Commit-Queue: Philip Pfaffe <[email protected]>
1 parent e88258c commit 44649d7

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

front_end/core/sdk/CSSMatchedStyles.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,8 @@ export class CSSMatchedStyles {
831831
return domCascade ? domCascade.computeCSSVariable(style, variableName) : null;
832832
}
833833

834-
resolveProperty(name: string, startingPoint: CSSStyleDeclaration): CSSProperty|null {
835-
return this.#styleToDOMCascade.get(startingPoint)?.resolveProperty(name, startingPoint) ?? null;
834+
resolveProperty(name: string, ownerStyle: CSSStyleDeclaration): CSSProperty|null {
835+
return this.#styleToDOMCascade.get(ownerStyle)?.resolveProperty(name, ownerStyle) ?? null;
836836
}
837837

838838
resolveGlobalKeyword(property: CSSProperty, keyword: CSSWideKeyword): CSSValueSource|null {
@@ -1059,15 +1059,6 @@ function* forEach<T>(array: T[], startAfter?: T): Generator<T> {
10591059
}
10601060
}
10611061

1062-
function* forEachInclusive<T>(array: T[], startAt?: T): Generator<T> {
1063-
if (startAt === undefined || array.includes(startAt)) {
1064-
if (startAt !== undefined) {
1065-
yield startAt;
1066-
}
1067-
yield* forEach(array, startAt);
1068-
}
1069-
}
1070-
10711062
class DOMInheritanceCascade {
10721063
readonly #propertiesState = new Map<CSSProperty, PropertyState>();
10731064
readonly #availableCSSVariables = new Map<NodeCascade, Map<string, CSSVariableValue|null>>();
@@ -1116,20 +1107,20 @@ class DOMInheritanceCascade {
11161107
return null;
11171108
}
11181109

1119-
resolveProperty(name: string, startAt: CSSStyleDeclaration): CSSProperty|null {
1120-
const cascade = this.#styleToNodeCascade.get(startAt);
1110+
resolveProperty(name: string, ownerStyle: CSSStyleDeclaration): CSSProperty|null {
1111+
const cascade = this.#styleToNodeCascade.get(ownerStyle);
11211112
if (!cascade) {
11221113
return null;
11231114
}
11241115

1125-
for (const style of forEachInclusive(cascade.styles, startAt)) {
1116+
for (const style of cascade.styles) {
11261117
const candidate = style.allProperties().findLast(candidate => candidate.name === name);
11271118
if (candidate) {
11281119
return candidate;
11291120
}
11301121
}
11311122

1132-
return this.#findPropertyInParentCascadeIfInherited({name, ownerStyle: startAt});
1123+
return this.#findPropertyInParentCascadeIfInherited({name, ownerStyle});
11331124
}
11341125

11351126
#findPropertyInParentCascade(property: {name: string, ownerStyle: CSSStyleDeclaration}): CSSProperty|null {

0 commit comments

Comments
 (0)