Bug 1723938 - Keep looking for background-colors when finding a background-image with transparent background-color. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D121770
This commit is contained in:
Emilio Cobos Álvarez
2021-08-05 11:21:29 +00:00
parent 7ce6ca794c
commit a14e48ea16
4 changed files with 41 additions and 6 deletions

View File

@@ -235,13 +235,15 @@ static Maybe<nscolor> GetBackplateColor(nsIFrame* aFrame) {
if (!drawColor && !drawImage) {
continue;
}
if (NS_GET_A(backgroundColor) != 0) {
// NOTE: We intentionally disregard the alpha channel here for the purpose
// of the backplate, in order to guarantee contrast.
return Some(NS_RGB(NS_GET_R(backgroundColor), NS_GET_G(backgroundColor),
NS_GET_B(backgroundColor)));
if (NS_GET_A(backgroundColor) == 0) {
// Even if there's a background image, if there's no background color we
// keep going up the frame tree, see bug 1723938.
continue;
}
break;
// NOTE: We intentionally disregard the alpha channel here for the purpose
// of the backplate, in order to guarantee contrast.
return Some(NS_RGB(NS_GET_R(backgroundColor), NS_GET_G(backgroundColor),
NS_GET_B(backgroundColor)));
}
return Some(aFrame->PresContext()->DefaultBackgroundColor());
}