| Summary: | Some WPT are failing because of colors being in the wrong format | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Tim Nguyen (:ntim) <ntim> | ||||
| Component: | CSS | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Normal | CC: | graouts, koivisto, sam, simon.fraser, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | Safari 14 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
Tim Nguyen (:ntim)
2021-03-29 11:36:48 PDT
Created attachment 424555 [details]
Minimal test case
Looks like something (likely CSSGradientValue) is not resolving color identifiers down to Colors before serializing. I haven't dropped into the debugger yet, but I am pretty sure this happening in ComputedStyleExtractor::valueForPropertyInStyle():
case CSSPropertyBackgroundImage:
case CSSPropertyWebkitMaskImage: {
auto& layers = propertyID == CSSPropertyWebkitMaskImage ? style.maskLayers() : style.backgroundLayers();
if (!layers.next()) {
if (layers.image())
return layers.image()->cssValue();
return cssValuePool.createIdentifierValue(CSSValueNone);
}
auto list = CSSValueList::createCommaSeparated();
for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next()) {
if (currLayer->image())
list->append(currLayer->image()->cssValue());
else
list->append(cssValuePool.createIdentifierValue(CSSValueNone));
}
return list;
}
When the `layers.image()->cssValue()` call happens, the `image()`, which is of type CSSGradientValue, has not had its color styles resolved. You can see in the lines above it what a call with color resolving looks like:
case CSSPropertyBackgroundColor:
return m_allowVisitedStyle ? cssValuePool.createColorValue(style.visitedDependentColor(CSSPropertyBackgroundColor)) : currentColorOrValidColor(&style, style.backgroundColor());
So, somehow, we need to resolve those colors.
Antti, any ideas on a good pattern for this? |